body.backoffice-body {
    background-color: #0b0f19;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Layout */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 70px;
    background: rgba(15, 23, 42, 0.95);
    border-right: 1px solid var(--border-color);
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(12px);
    z-index: 100;
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), padding 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
    overflow: hidden;
    position: relative;
}

/* Deshabilitar transición durante carga inicial para evitar parpadeo */
html.sidebar-no-transition .sidebar {
    transition: none !important;
}

@media (min-width: 1201px) {
    .sidebar:hover,
    .sidebar.expanded-init,
    html.sidebar-keep-expanded .sidebar {
        width: 250px;
        padding: 24px 20px;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }
}


.brand-section {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 40px;
    height: 40px;
    overflow: hidden;
}

.brand-icon-img {
    height: 32px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
    transition: opacity 0.2s ease, display 0.2s ease;
}

.brand-logo-img {
    height: 28px;
    width: auto;
    object-fit: contain;
    display: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

@media (min-width: 1201px) {
    .sidebar:hover .brand-icon-img,
    .sidebar.expanded-init .brand-icon-img,
    html.sidebar-keep-expanded .sidebar .brand-icon-img {
        display: none;
        opacity: 0;
    }
    .sidebar:hover .brand-logo-img,
    .sidebar.expanded-init .brand-logo-img,
    html.sidebar-keep-expanded .sidebar .brand-logo-img {
        display: block;
        opacity: 1;
    }

    /* Desktop comprimido: solo icono centrado, texto oculto y sin espacio */
    .sidebar .nav-item a {
        justify-content: center;
        padding: 0;
        gap: 0;
    }
    .sidebar .nav-text {
        opacity: 0;
        flex: 0;
        width: 0;
        overflow: hidden;
        white-space: nowrap;
    }
    .sidebar .user-details {
        opacity: 0;
    }

    /* Desktop expandido: layout normal con texto */
    .sidebar:hover .nav-item a,
    .sidebar.expanded-init .nav-item a,
    html.sidebar-keep-expanded .sidebar .nav-item a {
        justify-content: flex-start;
        padding: 0 14px;
        gap: 14px;
    }
    .sidebar:hover .nav-text,
    .sidebar.expanded-init .nav-text,
    html.sidebar-keep-expanded .sidebar .nav-text {
        opacity: 1;
        flex: 1;
        width: auto;
        max-width: 200px;
        overflow: hidden;
        white-space: normal;
    }
    .sidebar:hover .user-details,
    .sidebar.expanded-init .user-details,
    html.sidebar-keep-expanded .sidebar .user-details {
        opacity: 1;
    }
}

.brand-logo-img-mobile {
    height: 26px;
    width: auto;
    object-fit: contain;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: stretch;
}

/* Mobile-first: layout normal con ícono + texto */
.nav-item a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    padding: 0 14px;
    height: 46px;
    width: 100%;
    border-radius: 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.nav-item a i {
    font-size: 1.15rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Mobile-first: texto siempre visible */
.nav-text {
    opacity: 1;
    flex: 1;
    width: auto;
    overflow: hidden;
    white-space: normal;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    transition: opacity 0.2s ease, flex 0.2s ease, width 0.2s ease;
    line-height: 1.2;
    font-size: 0.85rem;
}



.nav-item.active a, .nav-item a:hover {
    color: var(--text-main);
    background: rgba(16, 185, 129, 0.1);
}

.nav-item.active a {
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
    border-radius: 0 12px 12px 0;
}

.user-profile {
    margin-top: auto;
    padding: 12px 4px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #0c0f16;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

@media (min-width: 1201px) {
    .sidebar:hover .user-details {
        opacity: 1;
    }
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    padding: 30px 40px;
    overflow-y: auto;
    max-height: 100vh;
}

.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
}

.welcome-title {
    font-size: 1.8rem;
    font-weight: 700;
}

.welcome-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.logout-btn {
    color: var(--error-color) !important;
}
.logout-btn:hover {
    background: rgba(244, 63, 94, 0.1) !important;
}

/* Tablas y Formularios Estándar */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-color);
    color: #0c0f16;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.table-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    backdrop-filter: blur(12px);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    padding: 14px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 12px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Estilos de Formularios */
.form-card {
    max-width: 600px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px;
    backdrop-filter: blur(16px);
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-control {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 1rem;
    color: var(--text-main);
    outline: none;
    transition: all 0.3s;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-icon-wrapper > i:first-child {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
    transition: color 0.3s;
}

.input-icon-wrapper:has(> i:first-child) .form-control {
    padding-left: 45px;
}

.input-icon-wrapper .form-control:focus ~ i {
    color: var(--primary-color);
}

.input-icon-wrapper .form-control.password-input {
    padding-right: 45px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.2s ease, background-color 0.2s ease;
    z-index: 2;
}

.toggle-password i {
    position: static;
    transform: none;
    font-size: 1rem;
    color: inherit;
    pointer-events: auto;
}

.toggle-password:hover {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.05);
}

.toggle-password:focus {
    outline: none;
    color: var(--primary-color);
}


.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 30px;
}

.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary-color);
}

.badge-danger {
    background: rgba(244, 63, 94, 0.15);
    color: var(--error-color);
}

/* Mobile Header & Backdrop styling */
.mobile-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 99;
    backdrop-filter: blur(10px);
}

.mobile-toggle-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.mobile-toggle-btn:hover {
    color: var(--primary-color);
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
}

.mobile-brand span {
    color: var(--text-main);
}

.mobile-brand span span {
    color: var(--primary-color);
}

.mobile-brand i {
    color: var(--primary-color);
    filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.4));
}

.mobile-user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #0c0f16;
    flex-shrink: 0;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 98;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* Media Queries for responsiveness */
@media (max-width: 1200px) {
    body.backoffice-body {
        height: auto;
        overflow: auto;
    }

    .mobile-header {
        display: flex;
    }
    
    .sidebar-backdrop {
        display: block;
    }
    
    .app-container {
        flex-direction: column;
        min-height: calc(100vh - 60px);
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        height: 100dvh;
        padding: 24px 20px;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 100;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }
    
    .sidebar .nav-text,
    .sidebar .user-details {
        opacity: 1;
    }
    
    .sidebar .brand-icon-img {
        display: none;
    }
    
    .sidebar .brand-logo-img {
        display: block;
        opacity: 1;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        padding: 24px 20px;
        max-height: none;
        overflow-y: visible;
    }
    
    .header-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .header-section .btn {
        width: 100%;
        justify-content: center;
    }
    
    .table-card {
        padding: 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        min-width: 600px;
    }
}

@media (max-width: 640px) {
    .form-card {
        padding: 24px 16px;
    }
    
    .form-actions {
        flex-direction: column-reverse;
        gap: 8px;
    }
    
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .welcome-title {
        font-size: 1.5rem;
    }
}

/* Reusable Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 15, 25, 0.75);
    backdrop-filter: blur(8px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 750px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.modal-container form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.modal-close-btn {
    display: none !important;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: rgba(15, 23, 42, 0.5);
    flex-shrink: 0;
}


