:root {
    --bg-dark: #0a0a0a;
    --bg-darker: #050505;
    --card-bg: #111111;
    --card-hover: #1a1a1a;
    --cyan: #00E5FF;
    --magenta: #B026FF;
    --text-main: #F5F5F5;
    --text-muted: #888888;
    --danger: #ff4757;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { font-family: 'Inter', sans-serif; background-color: var(--bg-darker); color: var(--text-main); line-height: 1.6; }
a { text-decoration: none; color: inherit; }
.text-cyan { color: var(--cyan); }
.w-100 { width: 100%; }
.mt-3 { margin-top: 15px; }
.border-cyan { border: 1px solid rgba(0,229,255,0.3) !important; }

/* Botones */
.btn-primary { display: block; background: var(--cyan); color: #000; font-weight: 800; padding: 15px; border-radius: 8px; text-transform: uppercase; letter-spacing: 1px; border: none; cursor: pointer; text-align: center; }
.btn-secondary { display: block; background: #222; color: #fff; padding: 12px; border: 1px solid #333; border-radius: 8px; cursor: pointer; text-align: center; font-weight: 600; }
.btn-logout { display: block; background: transparent; color: var(--danger); border: 1px solid var(--danger); padding: 12px; text-align: center; border-radius: 8px; font-weight: 600; margin-top: 20px;}

/* Login View */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-container { background: var(--bg-dark); width: 100%; max-width: 400px; padding: 40px 30px; border-radius: 15px; border: 1px solid rgba(255,255,255,0.05); box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.login-header { text-align: center; margin-bottom: 30px; }
.login-logo { width: 180px; margin-bottom: 20px; }
.login-header h2 { font-weight: 800; font-size: 1.5rem; }
.alert-error { background: rgba(255, 71, 87, 0.1); color: var(--danger); padding: 12px; border-radius: 8px; margin-bottom: 20px; font-size: 0.9rem; border: 1px solid rgba(255, 71, 87, 0.3); text-align: center; }
.login-footer { text-align: center; margin-top: 20px; font-size: 0.8rem; color: var(--text-muted); }

/* Dashboard Header */
.admin-header { position: fixed; top: 0; left: 0; width: 100%; height: 65px; background: var(--bg-dark); display: flex; justify-content: space-between; align-items: center; padding: 0 20px; z-index: 100; border-bottom: 1px solid #111; }
.header-left { display: flex; align-items: center; gap: 15px; }
.header-title { font-size: 1.2rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; white-space: nowrap;}
.menu-btn { background: transparent; border: none; cursor: pointer; display: flex; flex-direction: column; gap: 5px; width: 30px; padding: 5px 0; }
.menu-btn span { display: block; width: 100%; height: 2px; background: var(--text-main); transition: 0.3s; }
.admin-greeting { font-size: 0.9rem; font-weight: 600; }

/* Sidebar */
.sidebar { position: fixed; top: 0; left: -300px; width: 280px; height: 100vh; background: var(--card-bg); z-index: 200; transition: left 0.3s ease; display: flex; flex-direction: column; border-right: 1px solid #222; }
.sidebar.active { left: 0; }
.sidebar-header { padding: 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #222; }
.sidebar-logo { width: 120px; }
.close-btn { background: transparent; border: none; color: var(--text-main); font-size: 2rem; cursor: pointer; line-height: 1; }
.sidebar-menu { list-style: none; padding: 20px 0; flex: 1; overflow-y: auto; }
.sidebar-menu li a { display: block; padding: 15px 25px; font-size: 1.1rem; color: var(--text-muted); border-left: 3px solid transparent; transition: 0.2s; }
.sidebar-menu li a:hover, .sidebar-menu li a.active { background: #1a1a1a; color: var(--text-main); border-left-color: var(--cyan); }
.sidebar-footer { padding: 20px; border-top: 1px solid #222; }
.overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; background: rgba(0,0,0,0.7); z-index: 150; display: none; opacity: 0; transition: opacity 0.3s; }
.overlay.active { display: block; opacity: 1; }

/* Main Content */
.admin-main { padding: 85px 20px 30px; max-width: 1200px; margin: 0 auto; }
.welcome-card { background: var(--card-bg); padding: 25px; border-radius: 12px; margin-bottom: 30px; border: 1px solid #222; }
.welcome-card h2 { font-size: 1.5rem; margin-bottom: 10px; font-weight: 800; }
.welcome-card p { color: var(--text-muted); font-size: 0.95rem; }

.dashboard-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.dash-card { background: var(--card-bg); padding: 25px; border-radius: 12px; border: 1px solid #222; text-align: center; }
.dash-card h3 { font-size: 1rem; color: var(--text-muted); margin-bottom: 10px; font-weight: 600; text-transform: uppercase; }
.big-number { font-size: 3.5rem; font-weight: 900; line-height: 1; }

/* Listas y Botones Comunes */
.back-btn { font-size: 1.5rem; color: var(--text-main); text-decoration: none; padding-right: 10px; line-height: 1;}
.btn-add { background: var(--cyan); color: #000; padding: 8px 15px; border-radius: 5px; font-weight: 800; font-size: 0.8rem; text-transform: uppercase; display: flex; align-items: center; justify-content: center;}
.list-container { display: flex; flex-direction: column; gap: 15px; }
.item-card { background: var(--card-bg); padding: 20px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; border: 1px solid #222; }
.item-card.inactive { opacity: 0.5; border-style: dashed; }
.badge-mini { font-size: 0.6rem; background: #222; padding: 2px 6px; border-radius: 3px; color: var(--text-muted); text-transform: uppercase; }
.item-actions { display: flex; gap: 15px; font-size: 1.2rem; }
.alert-success { background: rgba(0, 229, 255, 0.1); color: var(--cyan); padding: 15px; border-radius: 8px; margin-bottom: 20px; text-align: center; border: 1px solid rgba(0, 229, 255, 0.3); }

/* --- FORMULARIOS (Corrección de Inputs, Selects y Textareas) --- */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-size: 0.85rem; color: var(--text-muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; height: 1.2rem;}
.form-group input, 
.form-group select, 
.form-group textarea, 
.admin-form select, 
.admin-form textarea { 
    width: 100%; 
    padding: 15px; 
    border-radius: 8px; 
    background: #1a1a1a; 
    border: 1px solid #333; 
    color: #fff; 
    font-size: 1rem; 
    font-family: 'Inter', sans-serif; 
    transition: all 0.3s;
    appearance: none; /* Elimina la flecha fea por defecto de los selects */
}
/* Añadir flecha personalizada a los selects */
.form-group select, .admin-form select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/200.svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2300E5FF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 15px;
    padding-right: 40px;
}
.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus,
.admin-form select:focus, 
.admin-form textarea:focus { 
    outline: none; 
    border-color: var(--cyan); 
    box-shadow: 0 0 10px rgba(0,229,255,0.1); 
    background: #111;
}

/* Grilla Responsiva para Formularios */
.grid-form { display: grid; grid-template-columns: 1fr; gap: 0; } /* Por defecto (móvil) es 1 columna */

/* --- MEDIA QUERIES --- */

/* Teléfonos Pequeños (Ajuste del botón Nuevo) */
@media (max-width: 400px) {
    .header-title { font-size: 1rem; }
    .btn-add { width: 35px; height: 35px; border-radius: 50%; padding: 0; font-size: 1.2rem; }
    .btn-add-text { display: none; } /* Ocultar texto, dejar solo el ícono/botón redondo */
}

/* Tablets hacia arriba (Restaurar 2 columnas) */
@media (min-width: 768px) {
    .grid-form { grid-template-columns: 1fr 1fr; gap: 15px; } /* En tablet/desktop vuelve a ser 2 columnas */
    .dashboard-grid { grid-template-columns: repeat(3, 1fr); }
    .sidebar { left: 0; } 
    .admin-header { padding-left: 300px; } 
    .admin-main { padding-left: 300px; }
    .menu-btn, .close-btn, .overlay { display: none; }
}