/* ========== Temă aplicație: culori simple, curate, ușor la ochi ========== */
:root {
    /* Primary – albastru discret */
    --bs-primary: #2563eb;
    --bs-primary-rgb: 37, 99, 235;
    --bs-primary-text-emphasis: #1d4ed8;
    --bs-primary-bg-subtle: #dbeafe;
    --bs-primary-border-subtle: #93c5fd;
    /* Danger – roșu închis, mai puțin strident */
    --bs-danger: #b91c1c;
    --bs-danger-rgb: 185, 28, 28;
    --bs-danger-text-emphasis: #991b1b;
    --bs-danger-bg-subtle: #fee2e2;
    --bs-danger-border-subtle: #fecaca;
    /* Warning – amber, mai cald */
    --bs-warning: #d97706;
    --bs-warning-rgb: 217, 119, 6;
    --bs-warning-text-emphasis: #b45309;
    --bs-warning-bg-subtle: #fffbeb;
    --bs-warning-border-subtle: #fde68a;
    /* Success – verde calm */
    --bs-success: #059669;
    --bs-success-rgb: 5, 150, 105;
    --bs-success-text-emphasis: #047857;
    --bs-success-bg-subtle: #d1fae5;
    --bs-success-border-subtle: #a7f3d0;
    /* Secondary – gri slate */
    --bs-secondary: #64748b;
    --bs-secondary-rgb: 100, 116, 139;
}

/* Butoane: aspect curat, umbră discretă */
.btn {
    font-weight: 500;
    border-radius: 0.375rem;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-success:hover { filter: brightness(1.05); }
.btn-warning { color: #1f2937; }
.btn-warning:hover { color: #111827; filter: brightness(1.05); }
.btn-danger:hover { filter: brightness(1.08); }

/* Badge-uri obligatoriu (import): același danger mai moale */
.badge.bg-danger {
    background-color: var(--bs-danger) !important;
}

/* Link-uri text-danger (ex: Deconectare, switch user) – același roșu temperat */
.text-danger, a.text-danger {
    color: var(--bs-danger) !important;
}
a.text-danger:hover {
    color: var(--bs-danger-text-emphasis) !important;
}

/* Iconițe de alertă (expirat etc.) – roșu discret */
.fa-info-circle.text-danger, .text-danger.pilot-icons {
    color: var(--bs-danger) !important;
}

/* Dropdown item Deconectare în sidebar */
.dropdown-item.text-danger {
    color: var(--bs-danger) !important;
}
.dropdown-item.text-danger:hover {
    background-color: var(--bs-danger-bg-subtle);
    color: var(--bs-danger-text-emphasis) !important;
}

/* ========== Restul stilurilor ========== */
.footer {
    position: static;
    left: 0;
    bottom: 0;
    width: 100%;
    background-color: #f5f5f5;
    clear: both;
    display: none;
}

/* Layout pe tot ecranul: lățime 100%, înălțime viewport */
html, body {
    width: 100%;
    min-height: 100vh;
    margin: 0;
}
.body-container {
    clear: both;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-left: 0;
    padding-right: 0;
}
.body-container > .row.flex-nowrap {
    flex: 1;
    min-height: 0;
    align-items: stretch;
}
.body-container .main-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.body-container .sidebar-col {
    display: flex;
    flex-direction: column;
}
.body-container .sidebar-col .sidebar {
    flex: 1;
    min-height: 0;
}

.dropdown-toggle {
    outline: 0;
}

.btn-toggle {
    padding: .25rem .5rem;
    font-weight: 600;
    color: rgba(0, 0, 0, .65);
    background-color: transparent;
}

.btn-toggle:hover,
.btn-toggle:focus {
    color: rgba(0, 0, 0, .85);
    background-color: #d2f4ea;
}

.btn-toggle::before {
    width: 1.25em;
    line-height: 0;
    content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%280,0,0,.5%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 14l6-6-6-6'/%3e%3c/svg%3e");
    transition: transform .35s ease;
    transform-origin: .5em 50%;
}

.btn-toggle[aria-expanded="true"] {
    color: rgba(0, 0, 0, .85);
}

.btn-toggle[aria-expanded="true"]::before {
    transform: rotate(90deg);
}

.btn-toggle-nav a {
    padding: .1875rem .5rem;
    margin-top: .125rem;
    margin-left: 1.25rem;
}

.btn-toggle-nav a:hover,
.btn-toggle-nav a:focus {
    background-color: #d2f4ea;
}

.scrollarea {
    overflow-y: auto;
}

/* ========== Sidebar (meniu stânga) ========== */
.sidebar {
    width: 90%;
    max-width: 100%;
    min-width: 0;
    height: 100vh;
    background: linear-gradient(180deg, #212529 0%, #1a1d20 100%);
    color: #dee2e6;
    font-weight: 500;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header {
    padding: 0.5rem 0.75rem;
    min-height: 2.5rem;
}

.sidebar-header .btn-link {
    text-decoration: none;
    opacity: 0.85;
}

.sidebar-header .btn-link:hover {
    opacity: 1;
}

.sidebar-brand {
    padding: 0.75rem 1rem;
}

.sidebar-logo {
    max-width: 160px;
    height: auto;
    max-height: 100px;
    object-fit: contain;
}

.sidebar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85);
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    transition: background-color 0.15s, color 0.15s;
}

.sidebar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background-color: rgba(var(--bs-primary-rgb), 0.35);
    color: #fff;
}

.sidebar-footer .dropdown-toggle::after {
    margin-left: 0.35em;
}

/* Buton restrânge (desktop) - poziționat în colț */
#collapseSidebar {
    margin-left: auto;
}

/* ========== Desktop: meniul fix, înălțime viewport ========== */
@media (min-width: 768px) {
    .sidebar-col {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: 25%;
        z-index: 1030;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    .sidebar-col .sidebar {
        height: 100%;
        min-height: 100vh;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
    }
    .body-container .main-content {
        margin-left: 25%;
        width: 75%;
        max-width: 75%;
        flex: 0 0 75%;
    }
}
@media (min-width: 992px) {
    .sidebar-col {
        width: 16.666667%;
    }
    .body-container .main-content {
        margin-left: 16.666667%;
        width: 83.333333%;
        max-width: 83.333333%;
        flex: 0 0 83.333333%;
    }
}

/* ========== Mobil: meniul ascuns, hamburger + overlay ========== */
.sidebar-mobile-toggle {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1040;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar-overlay {
    display: none !important;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1045;
    opacity: 0;
    transition: opacity 0.25s ease;
}

body.sidebar-open .sidebar-overlay {
    display: block !important;
    opacity: 1;
}

@media (max-width: 767.98px) {
    .sidebar-col {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.25s ease-out;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }

    body.sidebar-open .sidebar-col {
        transform: translateX(0);
    }

    .sidebar-col .sidebar {
        width: 100%;
        border-radius: 0;
    }

    .main-content {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
    }

    .padding-left-30 {
        padding-left: 0.75rem !important;
        padding-top: 3.5rem !important; /* spațiu pentru hamburger */
    }
}

@media (min-width: 768px) {
    .sidebar-mobile-toggle,
    .sidebar-overlay {
        display: none !important;
    }
}

@media (max-width: 575.98px) {
    .sidebar {
        width: 100%;
    }
    .padding-left-30 {
        padding-left: 0.5rem !important;
    }
}

/* Cross-device: conținut principal cu overflow pentru tabele responsive */
.main-content {
    min-width: 0;
    overflow-x: auto;
}

.nav-link:active,
.nav-link:focus {
    outline: 0;
}

.action-btn {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.user-delete-section .user-delete-form {
    margin: 0;
}

.user-delete-section .user-delete-btn {
    min-width: 11rem;
}

@media (max-width: 767.98px) {
    .action-btn {
        gap: 0.5rem;
    }

    .user-delete-section .user-delete-btn {
        width: 100%;
        min-width: 0;
    }
}

/* Toolbar listări: buton Adaugă + dropdown Număr rezultate – pe mobil unul stânga, altul dreapta */
.list-page-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
}
@media (max-width: 767.98px) {
    .list-page-toolbar {
        justify-content: space-between;
    }
}

/* ========== Mobil: listări și tabele – butoane vizibile, fără tăieri ========== */
@media (max-width: 767.98px) {
    /* Conținut listări: padding ca să nu se lipească de margini */
    .main-content .row {
        margin-left: -0.375rem;
        margin-right: -0.375rem;
    }
    .main-content .row > [class*="col-"] {
        padding-left: 0.375rem;
        padding-right: 0.375rem;
    }

    /* Titlu + butoane din header: butoanele unul lângă altul (nu sub altul) */
    .main-content .row.mt-3 .d-flex.gap-2,
    .main-content .row.mt-3 .d-grid.gap-2 {
        display: flex !important;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .main-content .row.mt-3 .d-grid.gap-2 .btn,
    .main-content .row.mt-3 .d-grid.gap-2 a.btn,
    .main-content .row.mt-3 .d-flex.gap-2 .btn,
    .main-content .row.mt-3 .d-flex.gap-2 a.btn {
        width: auto;
        flex: 0 0 auto;
    }
    /* Când link-ul e singur și are d-grid (ex: Adaugă User), să nu ocupe toată lățimea */
    .main-content .row.mt-3 a.btn.d-grid {
        display: inline-flex !important;
        width: auto;
    }
    /* Zone acțiuni (Înapoi, Edit, Șterge): butoane pe același rând */
    .main-content .action-btn {
        display: flex;
        flex-wrap: wrap;
        flex-direction: row;
        gap: 0.5rem;
        align-items: center;
    }
    .main-content .action-btn .btn,
    .main-content .action-btn a.btn,
    .main-content .action-btn form {
        flex: 0 0 auto;
        margin: 0;
    }

    /* Tabel: celule cu text care poate să se încheie la rând */
    .table-responsive .table td {
        white-space: normal;
        word-wrap: break-word;
        vertical-align: middle !important;
    }
    .table-responsive .table th {
        white-space: normal;
        font-size: 0.875rem;
    }

    /* Zona de scroll a tabelului: padding dreapta ca ultimele butoane să nu fie tăiate */
    .table-responsive {
        padding-right: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }

    /* ========== Coloana acțiuni (toate listările): lățime fixă, cross‑platform ========== */
    .table-responsive .table th:last-child,
    .table-responsive .table td:last-child,
    .table-responsive .table .table-col-actions {
        min-width: 150px;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        white-space: nowrap;
        vertical-align: middle;
    }
    .table-responsive .table td:last-child {
        white-space: nowrap;
    }

    /* Butoane din coloana acțiuni: lățime minimă fixă, aliniere uniformă (edit, șterge, arată, etc.) */
    .table-responsive .table td:last-child .btn,
    .table-responsive .table td:last-child form .btn,
    .table-responsive .table .table-col-actions .btn {
        display: inline-block;
        min-width: 7.5rem;
        margin: 0.25rem 0.35rem 0.25rem 0;
        padding: 0.4rem 0.65rem;
        font-size: 0.875rem;
        text-align: center;
        white-space: nowrap;
        box-sizing: border-box;
    }
    .table-responsive .table td:last-child form,
    .table-responsive .table .table-col-actions form {
        display: inline-block;
        margin: 0.25rem 0.35rem 0.25rem 0;
    }
    .table-responsive .table td:last-child form .btn,
    .table-responsive .table .table-col-actions form .btn {
        margin-right: 0;
    }
    .table-responsive .table .table-col-actions .btn i,
    .table-responsive .table td:last-child .btn i {
        margin-right: 0.25rem;
    }

    /* Listare exerciții: coloană acțiuni mai lată ca butonul Edit să aibă spațiu */
    .table-responsive .table.table-exercitiu-list .table-col-actions {
        min-width: 14rem;
    }
    .table-responsive .table.table-exercitiu-list .table-col-actions .btn {
        min-width: 10rem;
    }

    /* Tabele: butoane în restul tabelului (dacă există) – păstrăm aspect rezonabil */
    .table-responsive .table .btn {
        font-size: 0.875rem;
        padding: 0.35rem 0.6rem;
    }
    .table-responsive .table .btn i {
        margin-right: 0.2rem;
    }

    /* Paginare: să nu depășească ecranul */
    #navigation {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
    }
    #navigation .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }
}

@media (max-width: 575.98px) {
    /* Ecrane foarte mici: butoane acțiuni compacte, dar lățime minimă uniformă */
    .table-responsive .table td:last-child .btn,
    .table-responsive .table td:last-child form .btn,
    .table-responsive .table .table-col-actions .btn {
        min-width: 6.25rem;
        font-size: 0.8125rem;
        padding: 0.35rem 0.5rem;
        margin: 0.2rem 0.25rem 0.2rem 0;
    }
    .table-responsive .table th:last-child,
    .table-responsive .table td:last-child,
    .table-responsive .table .table-col-actions {
        min-width: 150px;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    .table-responsive .table.table-exercitiu-list .table-col-actions {
        min-width: 150px;
    }
    .table-responsive .table.table-exercitiu-list .table-col-actions .btn {
        min-width: 8rem;
    }
    .table-responsive .table .btn {
        font-size: 0.8125rem;
        padding: 0.3rem 0.5rem;
    }
}

/* Pagina /admin/rapoarte: pe mobil filtrele sunt ascunse implicit */
@media (max-width: 767.98px) {
    .filters-rapoarte-page .filters-form-row {
        display: none;
    }
}

/* Același rând: butoane unul lângă altul (wrap doar dacă nu încap) */
.filters-rapoarte-page .filters-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Listare exercitii: pastram coloana de actiuni suficient de lata */
.table-responsive .table.table-exercitii-list {
    table-layout: fixed;
    width: 100%;
}

.table-responsive .table.table-exercitii-list th:first-child,
.table-responsive .table.table-exercitii-list td:first-child {
    width: 7rem;
}

.table-responsive .table.table-exercitii-list .table-col-actions {
    width: 12rem;
    min-width: 12rem;
}

.table-responsive .table.table-exercitii-list .table-col-detalii {
    white-space: normal;
    word-break: break-word;
}

/* Lista rapoarte pe mobil/tablet: carduri în loc de tabel */
@media (max-width: 991.98px) {
    .filters-rapoarte-page .rapoarte-table-wrapper {
        margin-left: -0.375rem;
        margin-right: -0.375rem;
        padding: 0 0.375rem;
    }
    .filters-rapoarte-page .rapoarte-list-table thead {
        display: none;
    }
    .filters-rapoarte-page .rapoarte-list-table tbody tr {
        display: block;
        border: 1px solid var(--bs-border-color, #dee2e6);
        border-radius: 0.5rem;
        margin-bottom: 1rem;
        padding: 0;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
        overflow: hidden;
    }
    .filters-rapoarte-page .rapoarte-list-table tbody tr.first-in-raport {
        border-left: 3px solid var(--bs-primary);
        background: linear-gradient(to right, var(--bs-primary-bg-subtle, #e7f1ff) 0%, #fff 2rem);
    }
    .filters-rapoarte-page .rapoarte-list-table tbody td {
        display: flex;
        align-items: baseline;
        padding: 0.4rem 0.75rem;
        border: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }
    .filters-rapoarte-page .rapoarte-list-table tbody td:last-child {
        border-bottom: none;
    }
    .filters-rapoarte-page .rapoarte-list-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.8rem;
        color: var(--bs-secondary, #64748b);
        min-width: 10rem;
        flex-shrink: 0;
        margin-right: 0.5rem;
    }
    .filters-rapoarte-page .rapoarte-list-table tbody td.align-middle.text-center::before {
        min-width: 0;
    }
    .filters-rapoarte-page #navigation {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }
    .filters-rapoarte-page #navigation .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
}

.hidden {
    display: none;
}
.field-icon {
    float: right;
    margin-left: -25px;
    margin-top: -25px;
    position: relative;
    z-index: 2;
    cursor: pointer;
}


.padding-left-30 {
    padding-left: 30px!important;
}

/* ========== Cadru uniform pentru toate paginile: același padding și distanțe ========== */
.page-frame {
    padding: 1rem 0.75rem 1.5rem;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
}
@media (min-width: 576px) {
    .page-frame {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
@media (min-width: 768px) {
    .page-frame {
        padding: 1.25rem 1.25rem 2rem;
    }
}
@media (min-width: 992px) {
    .page-frame {
        padding: 1.5rem 1.5rem 2rem;
    }
}

/* Formulare profil (schimbă parolă, PIN etc.) – lățime restrânsă în cadrul page-frame */
.content-page-form .container-form-card {
    max-width: 42rem;
    margin: 0 auto;
}
.content-page-form .container-form-card h1 {
    font-size: 1.5rem;
}

.line-through {
    text-decoration: line-through;
}
