/* ===== GLOBAL ===== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f3f4f6;
    color: #111827;
}

/* ===== HEADER ===== */

header {
    background: #111827;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    margin: 0;
    font-size: 18px;
}

/* ===== BADGES ===== */

.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: #fff;
}

.owner { background: #2563eb; }
.foreman { background: #059669; }
.worker { background: #f59e0b; }
.temp_worker { background: #7c3aed; }

/* ===== CONTAINER ===== */

.container {
    max-width: 1200px;
    margin: 16px auto;
    background: #fff;
    padding: 16px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ===== LOGIN BOX ===== */

.login-box {
    max-width: 400px;
    margin: 60px auto;
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

label {
    font-weight: bold;
    margin-top: 10px;
    display: block;
    font-size: 14px;
}

input, select, textarea {
    width: 100%;
    padding: 9px;
    margin-top: 4px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 14px;
}

/* ===== BUTTONS ===== */

button {
    padding: 9px 14px;
    border: none;
    border-radius: 6px;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
    margin-top: 12px;
    font-size: 14px;
}

button.secondary {
    background: #6b7280;
}

button.danger {
    background: #dc2626;
}

button.small {
    padding: 5px 9px;
    font-size: 12px;
    margin-top: 0;
}

/* ===== TABS ===== */

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 12px;
}

.tab {
    padding: 8px 12px;
    background: #e5e7eb;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-size: 14px;
}

.tab.active {
    background: #fff;
    border: 2px solid #e5e7eb;
    border-bottom: none;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== TABLES ===== */

#tab-hours { overflow-x: auto; } #tab-hours table { width: 100%; table-layout: auto; } #tab-hours td:last-child, #tab-hours th:last-child { min-width: 120px; white-space: nowrap; }

.time-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 4px;
}

.time-row select {
    padding: 6px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 14px;
}


table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px;
}

th, td {
    padding: 8px;
    border: 1px solid #e5e7eb;
    text-align: left;
}

th {
    background: #f9fafb;
}

/* ===== SECTION HEADER ===== */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.section-header h2 {
    margin: 0;
    font-size: 18px;
}

.section-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.section-actions input {
    max-width: 220px;
}

/* ===== PROGRESS BAR ===== */

.progress-bar {
    width: 100%;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    height: 10px;
}

.progress-inner {
    height: 10px;
    background: #10b981;
}

.progress-inner.over {
    background: #ef4444;
}

/* ===== MODALS ===== */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

.modal {
    background: #fff;
    padding: 16px;
    border-radius: 10px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.hint {
    font-weight: normal;
    font-size: 12px;
    color: #6b7280;
}

#assignedForemenList {
    padding-left: 18px;
}

/* ===== MOBILE ===== */

@media (max-width: 768px) {
    .container {
        margin: 8px;
        padding: 12px;
    }
    header h1 {
        font-size: 16px;
    }
    .tabs {
        gap: 4px;
    }
    .tab {
        font-size: 12px;
        padding: 6px 8px;
    }
    th, td {
        font-size: 12px;
        padding: 6px;
    }
    button {
        width: 100%;
    }
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .section-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    .section-actions input {
        flex: 1;
    }
}

/* ===== MOBILE SUPER OPTIMIZED ===== */

@media (max-width: 768px) {

    /* Контейнер */
    .container {
        margin: 6px;
        padding: 10px;
        border-radius: 8px;
    }

    /* Хедер */
    header {
        padding: 10px;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    header h1 {
        font-size: 15px;
    }

    /* Вкладки — горизонтальна прокрутка */
    .tabs {
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab {
        flex: 0 0 auto;
        font-size: 12px;
        padding: 6px 10px;
    }

    /* Таблиці — горизонтальна прокрутка */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        font-size: 12px;
    }

    th, td {
        padding: 6px 8px;
    }

    /* Кнопки */
    button {
        width: 100%;
        padding: 10px;
        font-size: 14px;
    }

    button.small {
        width: auto;
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Секції */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .section-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 6px;
    }

    .section-actions input,
    .section-actions select {
        width: 100%;
    }

    /* Модалки */
    .modal {
        width: 95%;
        padding: 14px;
    }

    .modal-header h3 {
        font-size: 15px;
    }

    /* Weekly Report */
    #weeklyWorkerFilter {
        font-size: 14px;
        padding: 8px;
    }

    h3 {
        font-size: 15px;
        margin-top: 14px;
    }

    h4 {
        font-size: 14px;
        margin-top: 10px;
    }
}
