/* ============================================
   LAYOUT - I.E.P.E. Apóstol Pablo
   Estilos para sidebar, header y estructura principal
   ============================================ */

/* Variables de Layout */
.admin-layout {
    --sidebar-width: 250px;
    --sidebar-collapsed: 70px;
    --header-height: 60px;
    --sidebar-bg: var(--color-primary);
    --sidebar-hover: rgba(255,255,255,0.1);
    --sidebar-active: rgba(255,255,255,0.2);
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: #f5f7fa;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: width 0.3s ease, transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
}

/* Header del Sidebar */
.sidebar-header {
    padding: 1.5rem 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    display: flex;
    justify-content: center;
}

.sidebar .logo-img {
    width: 100px;
    height: auto;
    border-radius: 10px;
    transition: width 0.3s ease;
}

.sidebar.collapsed .logo-img {
    width: 50px;
}

.sidebar .logo-fallback {
    width: 80px;
    height: 80px;
}

.sidebar.collapsed .logo-fallback {
    width: 45px;
    height: 50px;
}

/* Navegacion del Sidebar */
.sidebar-nav {
    flex: 1;
    padding: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    color: white;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: var(--sidebar-hover);
}

.nav-item.active {
    background: var(--color-highlight);
    color: #1a1a1a;
    font-weight: 600;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.85rem;
}

.sidebar.collapsed .nav-item span {
    display: none;
}

/* ============================================
   CONTENIDO PRINCIPAL
   ============================================ */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-wrapper {
    margin-left: var(--sidebar-collapsed);
}

/* ============================================
   HEADER
   ============================================ */
.main-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-menu {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
}

.btn-menu:hover {
    background: var(--color-primary);
    color: white;
}

.btn-menu svg {
    width: 20px;
    height: 20px;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #6b7280;
}

.breadcrumb-icon svg {
    width: 16px;
    height: 16px;
}

.breadcrumb a {
    color: var(--color-primary);
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .separator {
    color: #d1d5db;
}

.breadcrumb .current {
    color: #374151;
    font-weight: 500;
}

/* Header Derecha */
.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #6b7280;
    position: relative;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: #f3f4f6;
    color: var(--color-primary);
}

.btn-icon svg {
    width: 22px;
    height: 22px;
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: var(--color-error);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Usuario Dropdown */
.user-dropdown {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.user-avatar svg {
    width: 22px;
    height: 22px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1f2937;
}

.user-role {
    font-size: 0.75rem;
    color: #6b7280;
}

.btn-logout {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: #fef2f2;
    color: #dc2626;
}

.btn-logout svg {
    width: 20px;
    height: 20px;
}

/* Contenido */
.main-content {
    flex: 1;
    padding: 1.5rem;
}

/* Overlay mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-overlay {
        display: block;
    }

    .main-wrapper {
        margin-left: 0 !important;
    }

    .user-info {
        display: none;
    }
}

@media (max-width: 640px) {
    .main-header {
        padding: 0 1rem;
    }

    .main-content {
        padding: 1rem;
    }

    .breadcrumb {
        display: none;
    }
}
