/* ==========================================================================
   LAYOUT PROFESIONAL: SIDEBAR + NAVBAR PARA COTIZACIONES INTELIGENTES
   ========================================================================== */

/* Contenedor principal de la aplicación */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
    background-color: var(--bg-page);
    color: var(--text-primary);
}

/* Sidebar lateral */
.app-sidebar {
    width: 260px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-main);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    height: 100vh;
    position: sticky;
    top: 0;
}

/* Sidebar colapsado en desktop */
.app-sidebar.collapsed {
    width: 76px;
}

.app-sidebar.collapsed .sidebar-text,
.app-sidebar.collapsed .sidebar-badge,
.app-sidebar.collapsed .sidebar-section-title,
.app-sidebar.collapsed .sidebar-user-info {
    display: none !important;
}

.app-sidebar.collapsed .sidebar-nav-item {
    justify-content: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.app-sidebar.collapsed .sidebar-header {
    justify-content: center !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
}

/* Items de navegación del sidebar */
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    border-radius: 0.85rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    cursor: pointer;
    position: relative;
    user-select: none;
    border: 1px solid transparent;
}

.sidebar-nav-item:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

.sidebar-nav-item.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(13, 148, 136, 0.2));
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.25);
}

[data-theme="light"] .sidebar-nav-item.active {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.12), rgba(13, 148, 136, 0.15));
    color: #047857;
    border-color: rgba(5, 150, 105, 0.3);
}

/* Wrapper del contenido principal con navbar */
.app-main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

/* Navbar superior */
.app-navbar {
    height: 64px;
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Drawer móvil */
.sidebar-backdrop {
    display: none;
}

@media (max-width: 1023px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    }

    .app-sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar-backdrop.active {
        display: block;
        position: fixed;
        inset: 0;
        background-color: rgba(0, 0, 0, 0.65);
        backdrop-filter: blur(3px);
        z-index: 45;
    }
}

/* Badges visuales de estatus de cotización */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
    border: 1px solid transparent;
}

.badge-status-borrador {
    background-color: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
    border-color: rgba(100, 116, 139, 0.25);
}

.badge-status-enviada {
    background-color: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.3);
}

.badge-status-aceptada {
    background-color: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

.badge-status-facturada {
    background-color: rgba(147, 51, 234, 0.15);
    color: #c084fc;
    border-color: rgba(147, 51, 234, 0.3);
}

.badge-status-pagada {
    background-color: rgba(20, 184, 166, 0.18);
    color: #2dd4bf;
    border-color: rgba(20, 184, 166, 0.35);
}

.badge-status-cancelada,
.badge-status-rechazada {
    background-color: rgba(244, 63, 94, 0.15);
    color: #fb7185;
    border-color: rgba(244, 63, 94, 0.3);
}

/* Píldoras de pestañas de estatus superiores */
.status-tab-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    background-color: var(--bg-card);
    border: 1px solid var(--border-main);
    color: var(--text-secondary);
    transition: all 0.15s ease;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

.status-tab-pill:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

.status-tab-pill.active {
    background-color: #059669;
    border-color: #059669;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.status-tab-pill .tab-count {
    padding: 0.1rem 0.45rem;
    border-radius: 9999px;
    font-size: 0.625rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    background-color: rgba(255, 255, 255, 0.15);
}

.status-tab-pill:not(.active) .tab-count {
    background-color: var(--bg-card-sub);
    color: var(--text-primary);
}
