/* ============================================
   ESTRUCTURA DE 4 ZONAS - Verifactu Blazor Server
   ============================================ */

/* Reset y Base */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #ffffff;
}

/* ============================================
   HEADER - Zona Superior Completa
   ============================================ */
.header-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background-color: #ffffff;
    border-bottom: 2px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    min-height: 70px;
    z-index: 100;
}

/* ============================================
   ZONA 1: Superior Izquierda - Logo y Título
   ============================================ */
.site-left {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 250px;
}

.logo {
    display: flex;
    align-items: center;
}

.site-title {
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -0.5px;
}

/* ============================================
   ZONA 2: Superior Derecha - Submenú + Usuario
   ============================================ */
.submenu-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
    margin-right: 20px;
}

.top-btn {
    padding: 10px 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    color: #495057;
}

.top-btn:hover:not(:disabled) {
    background-color: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.top-btn.active {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
    box-shadow: 0 2px 6px rgba(13, 110, 253, 0.3);
}

.top-btn:disabled {
    opacity: 0;
    cursor: not-allowed;
    color: transparent;
    border-color: transparent;
    background: transparent;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 20px;
    border-left: 2px solid #dee2e6;
    min-width: 250px;
    justify-content: flex-end;
}

.nav-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle .bar {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #1f2937;
    margin: 5px 0;
    transition: 0.3s;
    border-radius: 3px;
}

/* ============================================
   MAIN CONTAINER - Contiene Sidebar + Content
   ============================================ */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ============================================
   ZONA 3: Inferior Izquierda - Menú Principal
   ============================================ */
.side-menu {
    width: 220px;
    background-color: #f5f7fa;
    border-right: 2px solid #e5e7eb;
    padding: 20px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.03);
}

.main-btn {
    width: 100%;
    padding: 14px 18px;
    margin-bottom: 8px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #495057;
    transition: all 0.2s ease;
}

.main-btn:hover {
    background-color: #f8f9fa;
    color: #212529;
    border-color: #dee2e6;
    transform: translateX(4px);
}

.main-btn.active {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.25);
}

.main-btn.active:hover {
    background-color: #0b5ed7;
    border-color: #0b5ed7;
    transform: translateX(0);
}

/* ============================================
   ZONA 4: Inferior Derecha - Contenido Principal
   ============================================ */
.content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    background-color: #ffffff;
}

.page-content {
    padding: 24px;
    max-width: 100%;
    margin: 0;
}

/* Alertas y mensajes informativos con margen */
.page-content .alert {
    margin: 24px;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    padding: 16px 24px;
    background-color: #ffffff;
    border-top: 2px solid #e5e7eb;
    font-size: 13px;
    color: #6c757d;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
}

/* ============================================
   BOTONES GENERALES
   ============================================ */
.btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-primary {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
}

.btn-outline-primary {
    background-color: transparent;
    color: #0d6efd;
    border-color: #0d6efd;
}

.btn-outline-primary:hover {
    background-color: #0d6efd;
    color: white;
}

.btn-outline-secondary {
    background-color: transparent;
    color: #6c757d;
    border-color: #6c757d;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    color: white;
}

/* ============================================
   ALERTAS
   ============================================ */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert h4 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 18px;
}

.alert-info {
    background-color: #cfe2ff;
    border-color: #9ec5fe;
    color: #084298;
}

.alert-secondary {
    background-color: #e2e3e5;
    border-color: #d3d6d8;
    color: #41464b;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: #ffe69c;
    color: #664d03;
}

/* ============================================
   UTILIDADES
   ============================================ */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   RESPONSIVE - MÓVIL
   ============================================ */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    .side-menu {
        position: fixed;
        left: -250px;
        top: 70px;
        height: calc(100vh - 70px);
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    }

    .side-menu.open {
        left: 0;
    }

    .submenu-row {
        position: fixed;
        top: 70px;
        right: -100%;
        width: 100%;
        max-width: 350px;
        background: white;
        padding: 20px;
        box-shadow: -2px 0 12px rgba(0, 0, 0, 0.15);
        transition: right 0.3s ease;
        flex-direction: column;
        align-items: stretch;
        z-index: 999;
        height: auto;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
    }

    .submenu-row.open {
        right: 0;
    }

    .top-btn {
        width: 100%;
        margin-bottom: 8px;
    }

    .user-section {
        flex-direction: column;
        align-items: stretch;
        border-left: none;
        border-top: 2px solid #dee2e6;
        padding-left: 0;
        padding-top: 16px;
        margin-top: 16px;
    }

    .content {
        padding: 0;
    }

    .page-content {
        padding: 20px 15px;
    }

    .site-left {
        min-width: auto;
    }

    .site-title {
        font-size: 18px;
    }

    .header-line {
        padding: 10px 15px;
    }
}

/* ============================================
   SCROLLBAR PERSONALIZADO
   ============================================ */
.side-menu::-webkit-scrollbar,
.content::-webkit-scrollbar {
    width: 8px;
}

.side-menu::-webkit-scrollbar-track,
.content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.side-menu::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.side-menu::-webkit-scrollbar-thumb:hover,
.content::-webkit-scrollbar-thumb:hover {
    background: #555;
}
