/* 
   styles.css
   Tema: iOS 26 Glassmorphism (Futuristic Crystal)
   Autor: Lumo (para Abel Maestre)
   Actualizado: Layout horizontal para desktop
*/

:root {
    /* Paleta de Colores Base */
    --bg-gradient-start: #0f0c29;
    --bg-gradient-mid: #302b63;
    --bg-gradient-end: #24243e;
    
    /* Colores de Cristal */
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-highlight: rgba(255, 255, 255, 0.25);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    /* Tipografía y Acentos */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --accent-color: #0a84ff;
    --accent-glow: rgba(10, 132, 255, 0.4);
    --danger-color: #ff453a;
    --success-color: #30d158;
    
    /* Layout */
    --sidebar-width: 280px;
    --header-height: 70px;
    
    /* Efectos */
    --blur-strength: 20px;
    --border-radius-lg: 24px;
    --border-radius-md: 16px;
    --transition-speed: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ==========================================
   BODY - Layout base horizontal
   ========================================== */

body {
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-mid), var(--bg-gradient-end));
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
    /* Eliminado el centrado vertical para desktop */
    display: block;
}

/* Animación suave del fondo */
@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ==========================================
   Elementos decorativos (Orbs)
   ========================================== */

.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.5;
    animation: float 10s infinite ease-in-out;
    pointer-events: none;
}

.orb-1 {
    width: 300px;
    height: 300px;
    background: #ff00cc;
    top: -50px;
    left: -50px;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: #3333ff;
    bottom: -100px;
    right: -100px;
    animation-delay: 2s;
}

.orb-3 {
    width: 200px;
    height: 200px;
    background: #00ffcc;
    top: 40%;
    left: 60%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(20px, -20px); }
}

/* ==========================================
   Layout Principal - Horizontal Desktop
   ========================================== */

.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Sidebar lateral */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: rgba(15, 12, 41, 0.6);
    backdrop-filter: blur(var(--blur-strength));
    -webkit-backdrop-filter: blur(var(--blur-strength));
    border-right: 1px solid var(--glass-border);
    padding: 2rem 1.5rem;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-speed);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 2rem;
    text-decoration: none;
    color: var(--text-primary);
}

.sidebar-logo {
    font-size: 2rem;
}

.sidebar-title {
    font-size: 1.3rem;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-speed);
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.nav-icon {
    font-size: 1.2rem;
}

.sidebar-footer {
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

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

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Área de contenido principal */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header superior */
.main-header {
    height: var(--header-height);
    background: rgba(15, 12, 41, 0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 700;
}

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

/* Contenido */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1600px;
    width: 100%;
}

/* ==========================================
   Clases de utilidad para efecto cristal
   ========================================== */

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur-strength));
    -webkit-backdrop-filter: blur(var(--blur-strength));
    border: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-highlight);
    border-left: 1px solid var(--glass-highlight);
    box-shadow: var(--glass-shadow);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    transition: all var(--transition-speed);
}

.glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.25);
}

/* ==========================================
   Tipografía
   ========================================== */

h1, h2, h3 {
    font-weight: 600;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

h1 { font-size: 2rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.8rem; }
h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
p { color: var(--text-secondary); line-height: 1.6; }

/* ==========================================
   Formularios
   ========================================== */

input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

input:focus, select:focus, textarea:focus {
    background: rgba(0, 0, 0, 0.3);
    border-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-glow);
}

input::placeholder, textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* ==========================================
   Botones
   ========================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color), #0056b3);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--text-primary);
}

.btn-danger {
    background: rgba(255, 69, 58, 0.2);
    color: var(--danger-color);
    border: 1px solid rgba(255, 69, 58, 0.4);
}

.btn-danger:hover {
    background: rgba(255, 69, 58, 0.3);
    box-shadow: 0 0 15px rgba(255, 69, 58, 0.4);
}

/* ==========================================
   Grid para Dashboard
   ========================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

/* ==========================================
   Tablas estilo cristal
   ========================================== */

.table-container {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

tr:hover td {
    background: rgba(255, 255, 255, 0.05);
}

tr:last-child td {
    border-bottom: none;
}

/* ==========================================
   Login - Centrado vertical solo aquí
   ========================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

/* ==========================================
   Responsive - Tablet y Móvil
   ========================================== */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-area {
        margin-left: 0;
    }
    
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    h1 { font-size: 1.5rem; }
    
    .main-content {
        padding: 1rem;
    }
    
    .main-header {
        padding: 0 1rem;
    }
    
    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .glass-panel {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .header-actions {
        gap: 0.5rem;
    }
}

/* ==========================================
   Utilidades adicionales
   ========================================== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Footer crédito */
.footer-credit {
    padding: 1rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.5;
}