/* =========================================================
   1. BAZĂ GLOBALĂ (valabilă pentru toate paginile)
   ========================================================= */
* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background:#e5ecf5;              /* fundal general deschis */
    margin:0;
    color:#222;
}

/* Wrapper principal pentru toate paginile (index, selectie, admin, status) */
.container {
    width:100%;
    max-width: 1100px;
    margin:40px auto;
    background:#fff;
    padding:24px 28px 60px;
    border-radius:10px;
    box-shadow:0 10px 30px rgba(4,27,92,.18); /* albastru TAROM subtil */
    border-top:4px solid #041B5C;             /* accent TAROM */
}

/* Titluri generale */
h1, h2, h3 {
    margin-top:0;
    color:#041B5C;
}

/* =========================================================
   2. MESAJERIE (folosită în index, selectie, admin, status)
   ========================================================= */
.alert {
    padding:10px;
    border-radius:4px;
    margin-bottom:10px;
    font-size:0.9em;
}
.alert-ok {
    background:#e6ffed;
    border:1px solid #7ac27a;
}
.alert-err {
    background:#ffe6e6;
    border:1px solid #cc0000;
}
/* mesaj de tip avertizare (index.php – în afara ferestrei de selecție) */
.alert-warn {
    background:#fffbe6;
    border:1px solid #e6c200;
}

/* Status box (selectie.php, status.php) */
.status-box {
    background:#f0f2f7;
    padding:10px;
    border-radius:4px;
    margin-bottom:15px;
    font-size:0.9em;
}

/* =========================================================
   3. TABELE (sloturi A/B/C, liste de useri în admin)
   ========================================================= */
table {
    width:100%;
    border-collapse:collapse;
    margin-bottom:20px;
}
th, td {
    border:1px solid #ccc;
    padding:6px 8px;
    text-align:left;
    font-size:0.9em;
}
th {
    background:#eef1f7;
}

/* Culori pentru tabele sloturi A/B/C (selectie.php) */
.slotA th { background:#d8f0d8; }   /* verde deschis */
.slotB th { background:#d8e9ff; }   /* albastru deschis */
.slotC th { background:#ffe6d5; }   /* portocaliu deschis */

.full {
    color:#cc0000;
    font-weight:bold;
}

/* =========================================================
   4. BUTOANE (generale) + BUTOANE SPECIALE (header selectie/admin)
   ========================================================= */

/* Butoane generale (submit, etc.) – folosite în toate paginile */
button,
.btn {
    padding:8px 16px;
    border:none;
    background:#007bff;
    color:#fff;
    border-radius:4px;
    cursor:pointer;
    font-size:0.9em;
}
button:hover,
.btn:hover {
    background:#005fcc;
}

/* Buton „Vezi statusul selecției tale" (selectie.php) și alte linkuri tip buton */
.btn-secondary,
/* Buton Logout (selectie.php, status.php, eventual admin.php) */
.btn-logout {
    display:inline-block;
    padding:8px 14px;
    font-size:0.9em;
    border-radius:4px;
    text-decoration:none;
    border:none;
    cursor:pointer;
    margin-right:8px;
}

/* Stil pentru .btn-secondary – link tip buton albastru închis TAROM */
.btn-secondary {
    background:#041B5C;
    color:#fff;
}
.btn-secondary:hover {
    background:#06257d;
}

/* Stil pentru .btn-logout – buton roșu logout */
.btn-logout {
    background:#b32025;
    color:#fff;
}
.btn-logout:hover {
    background:#8f181d;
}

/* =========================================================
   5. INPUTURI & CONTROALE FORM (toate paginile)
   ========================================================= */
input[type="text"],
input[type="password"],
select {
    padding:6px 8px;
    border:1px solid #ccc;
    border-radius:4px;
    font-size:0.9em;
}

/* Checkbox / radio pentru sloturi (selectie.php) */
input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: #007bff;
}
input[type="checkbox"] {
    border-radius: 50%;
}

/* =========================================================
   6. FORMULARE ADMIN (admin.php – adăugare / editare utilizator)
   ========================================================= */
.add-box {
    margin-top:20px;
    padding:10px;
    border-radius:4px;
    background:#f0f4ff;
    font-size:0.9em;
}
.add-grid {
    display:grid;
    grid-template-columns:1fr 1.5fr 1fr 1fr;
    gap:8px;
}
.add-box input[type="text"],
.add-box select {
    width:100%;
}
@media (max-width: 700px) {
    .add-grid { grid-template-columns:1fr; }
}

/* =========================================================
   7. FOOTER GLOBAL (toate paginile prin render_footer())
   ========================================================= */
.site-footer {
    background:#041B5C;
    color:#fff;
    padding:10px 0;
    font-size:0.8em;
    text-align:center;
    margin-top:30px;
}
.site-footer a {
    color:#fff;
    text-decoration:none;
}
.site-footer a:hover {
    text-decoration:underline;
}

/* =========================================================
   8. PAGINĂ LOGIN (index.php)
   ========================================================= */

/* Cardul de login este mai îngust decât cel standard */
.login-container {
    max-width: 560px;
}

/* Mesajele introductive de sus (fereastră deschisă / închisă) */
.login-intro {
    margin-bottom:18px;
}

/* Formular de login: label + inputuri */
.login-form label {
    display:block;
    margin-top:14px;
    font-weight:bold;
}

.login-form input[type="text"] {
    width:100%;
    padding:9px 10px;
    margin-top:4px;
    border:1px solid #ccc;
    border-radius:4px;
}

/* Butonul principal de login – full width pe card */
.login-form button {
    margin-top:22px;
    width:100%;
}

/* Text explicativ sub câmpuri */
.login-info {
    font-size:0.9em;
    color:#555;
    margin-top:10px;
}

/* Instrucțiuni de la finalul paginii de login */
.login-instructions {
    font-size:0.85em;
    color:#555;
    margin-top:12px;
}

/* =========================================================
   9. RESPONSIVE (toate paginile)
   ========================================================= */
@media (max-width: 600px) {
    .container {
        margin:20px 10px;
        padding:18px 16px 40px;
    }
    h1 {
        font-size:1.4rem;
    }
}

.admin-login-container h1 {
    font-size:1.5rem;
}

@media (max-width: 600px) {
    .admin-login-container h1 {
        font-size:1.3rem;
    }
}

/* =========================================================
   10. HEADER TAROM ALBASTRU - ÎNUNTRUL CONTAINER (index.php)
   ========================================================= */

/* Header container - piesă albastră mare la top cu logo */
.container-header {
    background: linear-gradient(135deg, #041B5C 0%, #06257d 100%);
    color: white;
    padding: 50px 30px;
    margin: -24px -28px 30px -28px;
    border-radius: 10px 10px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    box-shadow: 0 4px 12px rgba(4, 27, 92, 0.2);
    text-align: center;
}

/* Logo în header - mai mare */
.header-logo {
    height: 100px;
    width: auto;
    filter: brightness(1.3);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.header-logo:hover {
    transform: scale(1.08);
}

/* Titlu în header - mai mare */
.container-header h1 {
    margin: 0;
    font-size: 2rem;
    color: white;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Responsive header */
@media (max-width: 600px) {
    .container-header {
        padding: 40px 20px;
        margin: -18px -16px 25px -16px;
        gap: 15px;
        flex-direction: column;
    }

    .header-logo {
        height: 80px;
    }

    .container-header h1 {
        font-size: 1.6rem;
        margin-top: 10px;
    }
}


/* =========================================================
   11. ADMIN PANEL (admin.php) - STILURI SPECIFICE
   ========================================================= */

/* Header admin cu info și acțiuni */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eef1f7;
}

.admin-info {
    flex: 1;
    min-width: 250px;
}

.admin-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Mesaje admin (msg/err) */
.msg {
    margin: 15px 0;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 500;
}

.msg-ok {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-left: 4px solid #28a745;
    color: #155724;
}

.msg-err {
    background: linear-gradient(135deg, #f8d7da 0%, #f1c4c8 100%);
    border-left: 4px solid #dc3545;
    color: #721c24;
}

/* Panel editare + adăugare utilizator */
.edit-panel,
.add-user-panel {
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.edit-panel {
    background: linear-gradient(135deg, #fff4e5 0%, #ffe8cc 100%);
    border: 2px solid #ffc107;
}

.add-user-panel {
    background: linear-gradient(135deg, #f0f4ff 0%, #e1e8ff 100%);
    border: 2px solid #007bff;
    margin-top: 25px;
}

/* Tabel utilizatori wrapper */
.users-table-wrapper {
    overflow-x: auto;
    margin-bottom: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Tabel admin (users, sloturi) */
.admin-table {
    min-width: 900px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.admin-table th {
    background: linear-gradient(135deg, #041B5C 0%, #1e3a8a 100%);
    color: white;
    font-weight: 600;
    padding: 12px 10px;
    position: sticky;
    top: 0;
    z-index: 10;
    text-align: center;
    font-size: 0.85em;
}

.admin-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    font-size: 0.88em;
}

.admin-table tr:hover {
    background: #f8f9ff;
}

/* Status badge-uri */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
    text-align: center;
    min-width: 80px;
}

.status-badge.pending {
    background: #fff3cd;
    color: #856404;
}

.status-badge.approved {
    background: #d4edda;
    color: #155724;
}

.status-badge.changerequired {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.faraselectie {
    background: #e2e3e5;
    color: #495057;
}

/* Acțiuni (butoane în tabel) */
.actions-cell {
    white-space: nowrap;
    text-align: center;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8em;
    margin: 2px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.btn-approve {
    background: #28a745;
    color: white;
}

.btn-approve:hover {
    background: #218838;
}

.btn-change {
    background: #ffc107;
    color: #212529;
}

.btn-change:hover {
    background: #e0a800;
}

.btn-edit {
    background: #007bff;
    color: white;
}

.btn-edit:hover {
    background: #0056b3;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}

.btn-edit-slots {
    background: #17a2b8 !important;
    color: white !important;
}

.btn-edit-slots:hover {
    background: #138496 !important;
}

/* Form grid (editare utilizator) */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #041B5C;
    font-size: 0.9em;
}

.form-group input,
.form-group select {
    padding: 10px;
    border: 2px solid #e0e6ed;
    border-radius: 6px;
    font-size: 0.9em;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-group input[readonly] {
    background: #f8f9fa;
    color: #6c757d;
}

/* Modal pentru sloturi */
.slot-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.2s;
}

.slot-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, #041B5C 0%, #1e3a8a 100%);
    color: white;
    padding: 20px;
    margin: 0;
}

.modal-body {
    padding: 25px;
    max-height: 65vh;
    overflow-y: auto;
}

.slot-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.slot-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

.slot-section h4 {
    margin: 0 0 15px 0;
    color: #041B5C;
    font-size: 1.1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slot-count {
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
}

.slot-inputs {
    min-height: 120px;
}

.slot-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    margin-bottom: 8px;
}

.slot-select {
    flex: 1;
    padding: 6px 10px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.82em;
    background: white;
    min-height: 38px;
}

.slot-select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.slot-text {
    flex: 1;
    padding: 6px 10px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.85em;
    display: none;
    min-height: 38px;
}

.slot-text.active {
    display: block;
}

.btn-toggle-mode {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    min-width: 36px;
    height: 38px;
}

.btn-add-slot {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    width: 100%;
    margin-top: 10px;
}

.btn-remove-slot {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    height: 38px;
    min-width: 40px;
}

.slots-info {
    font-size: 0.78em;
    color: #6c757d;
    margin-top: 6px;
    line-height: 1.3;
}

.modal-actions {
    padding: 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Responsive admin */
@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        text-align: center;
    }

    .admin-actions {
        justify-content: center;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .admin-table {
        min-width: 700px;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 4px;
        font-size: 0.8em;
    }

    .btn-small {
        padding: 4px 8px;
        font-size: 0.75em;
        min-width: 50px;
    }

    .slot-grid {
        grid-template-columns: 1fr;
    }

    .slot-input-wrapper {
        flex-direction: column;
        gap: 4px;
    }

    .slot-select,
    .slot-text {
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .admin-table {
        min-width: 600px;
    }

    .admin-table th:nth-child(4),
    .admin-table th:nth-child(5),
    .admin-table th:nth-child(6),
    .admin-table th:nth-child(7),
    .admin-table td:nth-child(4),
    .admin-table td:nth-child(5),
    .admin-table td:nth-child(6),
    .admin-table td:nth-child(7) {
        display: none;
    }
}
/* Wrapper tabele admin - DEJA EXISTĂ dar îl facem clar pentru mobil */
.users-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Tabel admin – permite micșorarea pe mobil */
.admin-table {
    width: 100%;
    min-width: 900px; /* ok pe desktop, dar vedem media query jos */
}

/* MEDIA QUERY pentru ecrane înguste (telefon) */
@media (max-width: 600px) {
    .admin-table {
        min-width: 700px;           /* mai mic decât 900px */
        font-size: 0.78em;          /* text mai mic în tabel */
    }

    .admin-table th,
    .admin-table td {
        padding: 6px 4px;
        white-space: nowrap;        /* evită ruperea pe două rânduri */
    }

    /* Dacă tot e prea mare, poți ascunde unele coloane în C:
       (ex. SCC și CC, doar pe mobil) */
    .admin-table th:nth-child(7),
    .admin-table td:nth-child(7),
    .admin-table th:nth-child(8),
    .admin-table td:nth-child(8) {
        display: none;
    }
}
/* =========================================================
   12. Tabele selectie.php (Sloturi A/B/C)
   ========================================================= */

/* Wrapper scroll orizontal pentru tabelele din selectie.php */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Permite tabelelor de selecție să fie mai late decât ecranul */
.table-wrapper table.slotA,
.table-wrapper table.slotB,
.table-wrapper table.slotC {
    min-width: 650px;   /* ajustează 700–750 dacă vrei mai aerisit */
}

/* Pe telefon: text mai mic și fără rupere pe 2 rânduri */
@media (max-width: 600px) {
    .slotA th, .slotA td,
    .slotB th, .slotB td,
    .slotC th, .slotC td {
        font-size: 0.8em;
        padding: 4px;
        white-space: nowrap;
    }
}

