/* Variables CSS Globales */
:root {
    --color-bg-primary: #f8f9fa;
    --color-bg-secondary: #ffffff;
    --color-text-primary: #212529;
    --color-text-secondary: #6c757d;
    --color-border: #dee2e6;
    --color-primary: #212529;
    --color-primary-hover: #000000;
    --color-success: #28a745;
    --color-danger: #dc3545;
    --color-warning: #ffc107;
    --color-info: #17a2b8;
    
    --sidebar-width-collapsed: 70px;
    --sidebar-width-expanded: 250px;
    --header-height: 60px;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.1);
    
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    overflow-x: hidden;
}

/* Layout Principal */
.admin-layout {
    position: relative;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    width: var(--sidebar-width-collapsed);
    background: var(--color-bg-secondary);
    border-right: 1px solid var(--color-border);
    transition: var(--transition);
    z-index: 100;
    overflow-y: auto;
    overflow-x: visible;
    display: flex;
    flex-direction: column;
}

.sidebar:not(.expanded) {
    overflow-x: visible;
}

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

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
}

.sidebar-menu li {
    margin-bottom: 4px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--color-text-primary);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}

.sidebar-menu a:hover:not(.active) {
    background: var(--color-bg-primary);
}

.sidebar-menu a.active {
    background: var(--color-bg-primary);
    border-left: 3px solid var(--color-primary);
}

.sidebar-menu a.active:hover {
    background: var(--color-bg-primary);
}

.sidebar-menu a .icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--color-bg-primary);
    transition: var(--transition);
}

.sidebar-menu a:hover:not(.active) .icon {
    background: #e9ecef;
}

.sidebar-menu a.active .icon {
    background: var(--color-primary);
    color: white;
}

.sidebar-menu a.active .icon:hover {
    background: var(--color-primary);
}

.sidebar-menu a.active .icon svg {
    stroke: white;
}

.sidebar-menu a .icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--color-text-secondary);
    stroke-width: 1.5;
    fill: none;
    transition: var(--transition);
}

.sidebar-menu a:hover:not(.active) .icon svg {
    stroke: var(--color-text-primary);
}

/* Tooltip para sidebar colapsado */
.sidebar-menu a {
    position: relative;
}

.sidebar:not(.expanded) .sidebar-menu li {
    position: relative;
}

.sidebar-tooltip {
    position: fixed;
    background: var(--color-text-primary);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 10000;
    box-shadow: var(--shadow-md);
    font-weight: 500;
}

.sidebar-tooltip::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: var(--color-text-primary);
}

.sidebar-tooltip.show {
    opacity: 1;
    visibility: visible;
}

.sidebar-menu a .text {
    margin-left: 16px;
    white-space: nowrap;
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
}

.sidebar.expanded .sidebar-menu a .text {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-separator {
    height: 1px;
    background: var(--color-border);
    margin: 12px 20px;
}

/* Información del Sistema (al final del sidebar, aparte del menú) */
.sidebar-info {
    margin-top: auto;
    padding-bottom: 20px;
}
.sidebar-info .sidebar-separator {
    margin: 12px 20px;
}
.sidebar-info-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: var(--transition);
    font-size: 13px;
}
.sidebar-info-link:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
}
.sidebar-info-link.active {
    color: var(--color-primary);
    background: var(--color-bg-primary);
}
.sidebar-info-link .icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--color-bg-primary);
}
.sidebar-info-link .icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
}
.sidebar-info-link .text {
    margin-left: 16px;
    white-space: nowrap;
    opacity: 0;
    transition: var(--transition);
}
.sidebar.expanded .sidebar-info-link .text {
    opacity: 1;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-primary);
    transition: var(--transition);
    border-radius: var(--border-radius);
}

.expand-btn:hover {
    background: var(--color-bg-primary);
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-menu {
    position: relative;
}

.user-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.user-btn:hover {
    background: var(--color-bg-primary);
}

.user-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 1001;
}

.user-menu.active .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown a {
    display: block;
    padding: 12px 16px;
    color: var(--color-text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.user-dropdown a:hover {
    background: var(--color-bg-primary);
}

/* Main Content */
.main-content-wrapper {
    margin-left: var(--sidebar-width-collapsed);
    margin-top: var(--header-height);
    transition: var(--transition);
    min-height: calc(100vh - var(--header-height));
}

.main-content {
    padding: 30px;
    min-height: calc(100vh - var(--header-height));
}

/* Cards */
.card {
    background: var(--color-bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 24px;
    margin-bottom: 24px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--color-text-primary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--color-bg-secondary);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

.stat-card h3 {
    color: var(--color-text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
    text-transform: uppercase;
    font-weight: 500;
}

.stat-card .number {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-text-primary);
}

.stat-card.aceptados .number {
    color: var(--color-success);
}

.stat-card.rechazados .number {
    color: var(--color-danger);
}

.stat-card.pendientes .number {
    color: var(--color-warning);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
        box-shadow: var(--shadow-lg);
        width: var(--sidebar-width-expanded);
    }
    
    .sidebar.expanded {
        transform: translateX(0);
    }
    
    .main-content-wrapper {
        margin-left: 0 !important;
    }
    
    .main-content {
        padding: 20px;
    }
    
    /* Overlay cuando sidebar está abierto en mobile */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: var(--transition);
        pointer-events: none;
    }
    
    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
}

