/* ==========================================
   SWIFTLOGÍSTICO - Estilos Generales
   ========================================== */

:root {
    --primary: #1a5276;
    --primary-dark: #0e2f44;
    --secondary: #2ecc71;
    --accent: #e67e22;
    --bg: #f4f6f7;
    --text: #2c3e50;
    --text-muted: #7f8c8d;
    --sidebar-width: 250px;
    --sidebar-collapsed: 70px;
    --header-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
}

/* ==========================================
   LOGIN PAGE
   ========================================== */
.login-page {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #2980b9 100%);
    min-height: 100vh;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
}

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--primary-dark);
    color: white;
    z-index: 1000;
    transition: width 0.3s ease;
    overflow-x: hidden;
}

.sidebar-header {
    padding: 20px;
    font-size: 18px;
    font-weight: bold;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header a {
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header i {
    font-size: 28px;
    color: var(--secondary);
}

.sidebar-nav {
    padding: 10px 0;
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-nav .nav-item.active {
    background: rgba(46, 204, 113, 0.15);
    color: var(--secondary);
    border-left-color: var(--secondary);
}

.sidebar-nav .nav-item i {
    width: 20px;
    text-align: center;
    font-size: 18px;
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar-toggle {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 999;
    display: none !important;
}

/* ==========================================
   TOP BAR
   ========================================== */
.topbar {
    background: white;
    padding: 15px 30px;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }

/* ==========================================
   METRIC CARDS
   ========================================== */
.metric-card {
    border-radius: 12px !important;
    transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1) !important;
}

.metric-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 28px;
    line-height: 1.2;
}

.metric-icon {
    border-radius: 12px !important;
}

/* ==========================================
   ALMACÉN MAPA
   ========================================== */
.estantes-grid {
    display: grid;
    grid-template-columns: 40px repeat(8, 1fr);
    gap: 4px;
    align-items: center;
}

.estante-label {
    grid-column: 1;
    font-size: 10px;
    font-weight: bold;
    color: var(--text-muted);
    text-align: center;
    background: #f8f9fa;
    border-radius: 4px;
    padding: 2px;
}

.espacio {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-height: 60px;
    border: 2px solid transparent;
}

.espacio:hover {
    transform: scale(1.08);
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.espacio .codigo {
    font-size: 11px;
    font-weight: bold;
}

.espacio .ocupado-icon,
.espacio .disponible-icon {
    font-size: 14px;
    margin-top: 2px;
}

/* Estados */
.estado-disponible {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.estado-disponible:hover {
    background: #28a745;
    color: white;
}

.estado-ocupado {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.estado-ocupado:hover {
    border-color: #dc3545;
    box-shadow: 0 4px 15px rgba(220,53,69,0.3) !important;
}

.estado-mantenimiento {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.estado-mantenimiento:hover {
    border-color: #ffc107;
}

/* Leyenda */
.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 991.98px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }
    
    .sidebar .sidebar-text,
    .sidebar .sidebar-header span {
        display: none;
    }
    
    .sidebar-header {
        padding: 15px 18px;
    }
    
    .sidebar-nav .nav-item {
        padding: 12px 18px;
        justify-content: center;
    }
    
    .sidebar-nav .nav-item i {
        margin: 0;
    }
    
    .main-content {
        margin-left: var(--sidebar-collapsed);
    }
    
    .sidebar-toggle {
        display: flex !important;
    }
}

@media (max-width: 767.98px) {
    .sidebar {
        width: 0;
        overflow: hidden;
    }
    
    .sidebar.open {
        width: var(--sidebar-width);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .topbar {
        padding: 12px 15px;
    }
    
    .estantes-grid {
        grid-template-columns: 30px repeat(4, 1fr);
        gap: 3px;
    }
}

/* ==========================================
   UTILITIES
   ========================================== */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #2980b9 100%);
}

.espacio-card {
    transition: transform 0.2s;
    cursor: default;
}

.espacio-card:hover {
    transform: translateY(-2px);
}

/* Progress bar fix */
.progress {
    border-radius: 10px;
    background-color: #e9ecef;
}

/* Card enhancements */
.card {
    border-radius: 10px !important;
}

.card-header:first-child {
    border-radius: 10px 10px 0 0 !important;
}

/* Table improvements */
.table > :not(caption) > * > * {
    padding: 10px 12px;
    vertical-align: middle;
}

/* SweetAlert2 adjustments */
.swal2-popup {
    border-radius: 12px !important;
}
