/* ============================================================
   EveÓptica - Sistema de Gestión para Óptica
   Paleta: Índigo profundo + Cyan brillante + Modo oscuro sidebar
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary:       #4f46e5;
    --primary-dark:  #3730a3;
    --primary-light: #e0e7ff;
    --accent:        #06b6d4;
    --success:       #10b981;
    --warning:       #f59e0b;
    --danger:        #ef4444;
    --sidebar-bg:    #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active:#4f46e5;
    --sidebar-text:  #94a3b8;
    --sidebar-w:     260px;
    --topbar-h:      64px;
    --body-bg:       #f8fafc;
    --card-bg:       #ffffff;
    --border:        #e2e8f0;
    --text:          #1e293b;
    --text-muted:    #64748b;
    --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:     0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
    --radius:        .75rem;
    --transition:    .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    font-size: .9rem;
    background: var(--body-bg);
    color: var(--text);
    min-height: 100vh;
}

/* ─── LAYOUT ─────────────────────────────────────────────── */
#wrapper { display: flex; min-height: 100vh; }

/* ─── SIDEBAR ────────────────────────────────────────────── */
#sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 0 0 2rem;
    transition: width var(--transition);
    overflow-x: hidden;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 1000;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: 1.5rem 1.25rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.07);
    margin-bottom: .5rem;
}
.sidebar-brand i { color: var(--accent); font-size: 1.4rem; }

.sidebar-section-label {
    font-size: .65rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #475569;
    padding: 1rem 1.25rem .25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .875rem;
    border-radius: .5rem;
    margin: .1rem .75rem;
    transition: background var(--transition), color var(--transition);
}
.sidebar-link i { width: 1.2rem; text-align: center; font-size: .9rem; }
.sidebar-link:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.sidebar-link.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.sidebar-link.text-danger { color: #f87171 !important; }
.sidebar-link.text-danger:hover { background: rgba(239,68,68,.1); }

/* ─── CONTENT WRAPPER ───────────────────────────────────── */
#content-wrapper {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

/* Sidebar collapsed */
#wrapper.sidebar-collapsed #sidebar { width: 0; padding: 0; }
#wrapper.sidebar-collapsed #content-wrapper { margin-left: 0; }

/* ─── TOPBAR ─────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.topbar-title { font-weight: 600; font-size: 1rem; color: var(--text); }
.topbar-user { display: flex; align-items: center; font-size: .85rem; }
.btn-icon { background: none; border: 1px solid var(--border); border-radius: .5rem; width: 36px; height: 36px; display:flex; align-items:center; justify-content:center; cursor:pointer; color:var(--text-muted); transition: all var(--transition); }
.btn-icon:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* ─── MAIN CONTENT ───────────────────────────────────────── */
.main-content { padding: 1.75rem; flex: 1; }

/* ─── CARDS ──────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

/* STAT CARDS */
.stat-card {
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow);
    background: var(--card-bg);
    border: 1px solid var(--border);
    transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
    width: 54px; height: 54px;
    border-radius: .75rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-icon.green  { background: #d1fae5; color: #059669; }
.stat-icon.yellow { background: #fef3c7; color: #d97706; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.cyan   { background: #cffafe; color: #0891b2; }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .78rem; color: var(--text-muted); margin-top: .25rem; }

/* ─── TABLAS ─────────────────────────────────────────────── */
.table { font-size: .875rem; }
.table thead th { background: #f8fafc; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid var(--border); color: var(--text-muted); }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: #f8fafc; }
.table-responsive { border-radius: var(--radius); }

/* ─── BADGES ─────────────────────────────────────────────── */
.badge { font-size: .72rem; font-weight: 500; padding: .3em .6em; border-radius: .4rem; }
.bg-primary-subtle { background: var(--primary-light) !important; }

/* ─── FORMULARIOS ────────────────────────────────────────── */
.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: .5rem;
    font-size: .875rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.form-label { font-weight: 500; font-size: .85rem; margin-bottom: .35rem; }

/* ─── BOTONES ─────────────────────────────────────────────── */
.btn { border-radius: .5rem; font-size: .875rem; font-weight: 500; transition: all var(--transition); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-sm { padding: .3rem .75rem; font-size: .8rem; }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-danger  { background: var(--danger);  border-color: var(--danger); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

/* ─── PAGE HEADER ────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.35rem; font-weight: 700; }
.page-header .breadcrumb { font-size: .8rem; margin: 0; }

/* ─── LOGIN ──────────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    position: relative;
    overflow: hidden;
}
.login-wrapper::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(79,70,229,.2) 0%, transparent 70%);
    top: -200px; right: -200px;
    border-radius: 50%;
}
.login-card {
    background: rgba(255,255,255,.97);
    backdrop-filter: blur(20px);
    border-radius: 1.25rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px rgba(0,0,0,.4);
    position: relative;
    z-index: 1;
}
.login-logo { font-size: 3rem; color: var(--primary); margin-bottom: .5rem; }
.login-title { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.login-subtitle { color: var(--text-muted); font-size: .875rem; }

/* ─── ALERTAS ────────────────────────────────────────────── */
.alert { border-radius: var(--radius); border: none; font-size: .875rem; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger  { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info    { background: #cffafe; color: #155e75; }

/* ─── STOCK BADGE ────────────────────────────────────────── */
.stock-ok   { background: #d1fae5; color: #065f46; }
.stock-low  { background: #fef3c7; color: #92400e; }
.stock-zero { background: #fee2e2; color: #991b1b; }

/* ─── RECETA CARD ────────────────────────────────────────── */
.receta-eye-card { background: #f8fafc; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.receta-eye-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); margin-bottom: 1rem; }

/* ─── AGENDA/CITAS ───────────────────────────────────────── */
.cita-badge-pendiente { background: #fef3c7; color: #92400e; }
.cita-badge-atendida  { background: #d1fae5; color: #065f46; }
.cita-badge-cancelada { background: #fee2e2; color: #991b1b; }

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 768px) {
    #sidebar { transform: translateX(-100%); transition: transform .25s ease; }
    #wrapper.sidebar-open #sidebar { transform: translateX(0); width: var(--sidebar-w); }
    #content-wrapper { margin-left: 0 !important; }
    .main-content { padding: 1rem; }
    .stat-card .stat-value { font-size: 1.3rem; }
}
