/* =============================================
   Style CSS dla modułu Zlecenia
   ============================================= */

/* =============================================
   Style dla formularzy
   ============================================= */
.zlecenia-form-table {
    width: 1024px;
    margin: auto;
    text-align: left;
}

.zlecenia-form-table-edit {
    width: 860px;
    margin: auto;
    text-align: left;
}

.zlecenia-label {
    width: 200px;
    text-align: right;
}

.zlecenia-label-desc {
    width: 250px;
    text-align: right;
}

.zlecenia-input-200 {
    width: 200px;
}

.zlecenia-input-650 {
    width: 651px;
}

.zlecenia-input-date {
    width: 100px;
}

/* =============================================
   Style dla tabeli listingów
   ============================================= */
.zlecenia-table {
    margin: auto;
}

.zlecenia-table-wide {
    width: 1250px;
    margin: auto;
}

.zlecenia-col-date {
    min-width: 65px;
}

.zlecenia-col-etapy {
    font-weight: normal;
}

/* =============================================
   Style dla akcji i przycisków
   ============================================= */
.zlecenia-actions {
    text-align: center;
}

.zlecenia-actions-left {
    text-align: left;
}

.zlecenia-inline-button {
    display: inline;
}

/* =============================================
   Style dla widoku przebiegu
   ============================================= */
.zlecenia-przebieg-nav {
    margin: auto;
    width: 1250px;
    text-align: left;
    margin-bottom: 5px;
}

.przebieg-col-120 {
    width: 120px;
}

.przebieg-col-800 {
    width: 800px;
}

.przebieg-col-580 {
    width: 580px;
    text-align: left;
}

.przebieg-time-normal {
    background-color: #F5FFE0;
}

.przebieg-time-overtime {
    background-color: #E0F8FF;
}

.przebieg-summary {
    background-color: #DDFF7F;
}

.przebieg-overtime-summary {
    background-color: #84E6FF;
    padding: 10px;
    margin: 1px;
}

.przebieg-overtime-label {
    width: 120px;
    float: left;
    padding: 10px;
    margin: 1px;
}

/* =============================================
   Style dla komentarzy i ToDo
   ============================================= */
.td-komentarz {
    background-color: #e6ffe6;
    padding: 5px;
    text-align: left;
}

.td-todo {
    background-color: #ffe4d1;
    padding: 5px;
    text-align: left;
}

/* Style dla list w komentarzach i todo */
.komentarz-current ul,
.komentarz-current ol,
.todo-current ul,
.todo-current ol {
    margin: 5px 0;
    padding-left: 20px;
    text-align: left;
}

.komentarz-current ul li,
.todo-current ul li {
    list-style-type: disc;
    margin: 3px 0;
    text-align: left;
}

.komentarz-current ol li,
.todo-current ol li {
    list-style-type: decimal;
    margin: 3px 0;
    text-align: left;
}

.komentarz-current ul ul,
.todo-current ul ul {
    list-style-type: circle;
}

.komentarz-current ul ul ul,
.todo-current ul ul ul {
    list-style-type: square;
}

.komentarz-current,
.todo-current {
    display: block;
    text-align: left;
    word-wrap: break-word;
    font-size: 11px;
}

/* =============================================
   Style dla inline edycji ToDo i Komentarzy
   ============================================= */
.todo-editable,
.komentarz-editable {
    display: block;
    width: 100%;
    min-height: 20px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
}

.todo-editable:hover,
.komentarz-editable:hover {
    background-color: #f5f5f5;
    outline: 1px solid #e0e0e0;
}

.todo-editable .placeholder,
.komentarz-editable .placeholder {
    color: #999;
    font-style: italic;
    font-size: 11px;
}

/* Textarea dla inline edycji */
.inline-edit-textarea {
    width: 100%;
    border: 1px solid #3498db;
    border-radius: 3px;
    padding: 4px 6px;
    font-family: inherit;
    font-size: 11px;
    line-height: 1.3;
    resize: vertical;
    min-height: 50px;
    max-height: 150px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin: 0;
    box-sizing: border-box;
}

.todo-inline-textarea {
    border-color: #3498db;
}

.komentarz-inline-textarea {
    border-color: #28a745;
}

.inline-edit-textarea:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

/* Kontenery dla komentarzy i todo */
.komentarz-display-container,
.todo-display-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: visible;
}

/* Style dla kolumn tabeli */
.td-komentarz,
.td-todo {
    width: 300px;
    word-wrap: break-word;
    overflow: visible;
    padding: 4px !important;
}

/* Komunikat o zapisie */
.status-saved {
    position: absolute;
    top: -20px;
    right: 0;
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    z-index: 1000;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(5px); }
    20% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-5px); }
}

/* =============================================
   STARE Style dla popup ToDo - NIE UŻYWANE
   ============================================= */
/*
.todo-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    z-index: 1000;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s ease-out;
}

.todo-popup-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    width: 800px;
    height: 434px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid #e1e5e9;
    animation: slideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.todo-popup h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    padding-bottom: 15px;
    position: relative;
}

.todo-popup h3:before {
    content: "📝";
    margin-right: 8px;
    font-size: 22px;
}

.todo-textarea-container {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.todo-popup textarea {
    width: 100%;
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 8px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.2;
    resize: none;
    background: #f8f9fa;
    box-sizing: border-box;
}

.todo-popup textarea:focus {
    outline: none;
    border-color: #3498db;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.todo-popup textarea::placeholder {
    color: #95a5a6;
    font-style: italic;
}

.todo-char-counter {
    margin-top: 5px;
    text-align: right;
    font-size: 12px;
    color: #95a5a6;
}

.todo-popup-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 25px;
}

.todo-popup-buttons .button1,
.todo-popup-buttons .button3 {
    margin: 0 6px;
    min-width: 80px;
}

/* =============================================
   Style dla popup Komentarz
   ============================================= */
.komentarz-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    z-index: 1000;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s ease-out;
}

.komentarz-popup-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    width: 800px;
    height: 434px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid #e1e5e9;
    animation: slideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.komentarz-popup h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    padding-bottom: 15px;
    position: relative;
}

.komentarz-popup h3:before {
    content: "💬";
    margin-right: 8px;
    font-size: 22px;
}

.komentarz-textarea-container {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.komentarz-popup textarea {
    width: 100%;
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 8px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.2;
    resize: none;
    background: #e8f5e9;
    box-sizing: border-box;
}

.komentarz-popup textarea:focus {
    outline: none;
    border-color: #28a745;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.komentarz-popup textarea::placeholder {
    color: #6c757d;
    font-style: italic;
}

.komentarz-char-counter {
    margin-top: 5px;
    text-align: right;
    font-size: 12px;
    color: #6c757d;
}

.komentarz-popup-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 25px;
}

.komentarz-popup-buttons .button1,
.komentarz-popup-buttons .button3 {
    margin: 0 6px;
    min-width: 80px;
}

/* =============================================
   Animacje
   ============================================= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
        scale: 0.9;
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
        scale: 1;
    }
}

/* =============================================
   Responsywność
   ============================================= */
@media (max-width: 600px) {
    .todo-popup-content,
    .komentarz-popup-content {
        width: 95%;
        padding: 20px;
        margin: 20px;
    }

    .todo-popup h3,
    .komentarz-popup h3 {
        font-size: 20px;
    }

    .todo-popup-buttons,
    .komentarz-popup-buttons {
        flex-direction: column;
    }

    .todo-popup-buttons .button1,
    .todo-popup-buttons .button3,
    .komentarz-popup-buttons .button1,
    .komentarz-popup-buttons .button3 {
        width: 100%;
        margin: 5px 0;
    }
}

*/
/* =============================================
   STARE Style dla przycisków dodawania - NIE UŻYWANE
   ============================================= */
/*
.komentarz-add-btn,
.todo-add-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    margin-left: 5px;
    transition: transform 0.2s;
}

.komentarz-add-btn {
    color: #28a745;
}

.todo-add-btn {
    color: #007cba;
}

.komentarz-add-btn:hover,
.todo-add-btn:hover {
    transform: scale(1.2);
}
*/

/* =============================================
   Style dla fieldset z opisami
   ============================================= */
.etap-zlecenia-desc {
    margin-left: 20px;
}

/* =============================================
   Style dla statusów (dropdown)
   ============================================= */
.status-dropdown {
    display: none;
}

/* współwykonawcy etapu (etap przypisany do wielu osób) */
.wspolwykonawcy {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 6px;
    max-width: 720px;
}

.wspolwykonawcy label {
    display: flex;
    align-items: center;
    gap: 6px;
    width: auto;
    margin: 0;
    padding: 5px 8px;
    text-align: left;
    white-space: nowrap;
    background-color: #F7F7F7;
    border: 1px solid #DDDDDD;
    border-radius: 4px;
    cursor: pointer;
}

.wspolwykonawcy label:hover {
    background-color: #F2FFBF;
}

.wspolwykonawcy label.zaznaczony {
    background-color: #EAFFCF;
    border-color: #65AF23;
    font-weight: bold;
}

.wspolwykonawcy input {
    margin: 0;
}

.wspolwykonawcy label.zablokowany {
    opacity: 0.45;
    cursor: not-allowed;
    background-color: #EEEEEE;
}

.wspolwykonawcy label.zablokowany:hover {
    background-color: #EEEEEE;
}

/* Lista etapów: nazwa edytowalna po kliknięciu, znacznik skopiowanego etapu */
.etap-nazwa-edycja {
    cursor: text;
}

.etap-kopia {
    display: inline-block;
    margin-left: 4px;
    padding: 0 6px;
    border-radius: 3px;
    background: #ff9800;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
}

.zlecenie-temat-edycja {
    cursor: text;
}

.etap-kopia[data-typ] {
    cursor: pointer;
}

/* znacznik kopii: na hoverze "zatwierdź" (kliknięcie zatwierdza kopię) */
.etap-kopia .kopia-zatwierdz,
.etap-kopia[data-typ]:hover .kopia-tekst {
    display: none;
}

.etap-kopia[data-typ]:hover .kopia-zatwierdz {
    display: inline;
}

.etap-kopia[data-typ]:hover {
    background: #28a745;
}
