/* ═══════════════════════════════════════════════════════════════════════════
   Birthday Automation System — Design System
   ═══════════════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Variables ───────────────────────────────────────────────────────────── */
:root {
    --brand:       #4f46e5;
    --brand-2:     #06b6d4;
    --brand-hover: #4338ca;
    --success:     #10b981;
    --danger:      #ef4444;
    --warning:     #f59e0b;
    --sidebar-bg:  #0f172a;
    --sidebar-w:   270px;
    --app-bg:      #f8fafc;
    --surface:     #ffffff;
    --border:      rgba(0, 0, 0, 0.06);
    --text:        #1e293b;
    --muted:       #64748b;
    --radius:      16px;
    --shadow-sm:   0 2px 8px rgba(0,0,0,.05);
    --shadow:      0 8px 32px rgba(0,0,0,.07);
    --shadow-lg:   0 20px 60px rgba(0,0,0,.1);
    --font:        'Inter', system-ui, sans-serif;
    --transition:  .22s cubic-bezier(.4,0,.2,1);
}

/* ── Reset y base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--app-bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    margin: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   APP LAYOUT (sidebar + main)
   ══════════════════════════════════════════════════════════════════════════ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.app-sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: width var(--transition), transform var(--transition);
    overflow: hidden;
}

.sidebar-header { padding: 1.5rem 1.25rem 1rem; }

.app-brand {
    display: flex;
    align-items: center;
    gap: .85rem;
    text-decoration: none;
    color: #fff;
}

.brand-logo { height: 40px; object-fit: contain; }

.brand-icon {
    font-size: 1.8rem;
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
}

.brand-name { font-weight: 700; font-size: 1rem; line-height: 1.2; display: block; }
.brand-sub  { font-size: .7rem; color: #94a3b8; display: block; }

/* ── Nav menú ─────────────────────────────────────────────────────────────── */
.sidebar-nav {
    flex: 1;
    padding: .5rem 1rem;
    overflow-y: auto;
    overflow-x: hidden;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem .85rem;
    border-radius: 10px;
    color: #94a3b8;
    text-decoration: none;
    font-weight: 500;
    font-size: .875rem;
    position: relative;
    transition: all var(--transition);
    white-space: nowrap;
}

.nav-item:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
    transform: translateX(3px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(79,70,229,.25), rgba(79,70,229,.1));
    color: #fff;
}

.nav-item.active .nav-active-indicator {
    position: absolute;
    right: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 60%;
    background: var(--brand);
    border-radius: 2px 0 0 2px;
}

.nav-item .bi { font-size: 1.1rem; min-width: 20px; text-align: center; }

/* ── User footer ─────────────────────────────────────────────────────────── */
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.06);
}

.user-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem;
    border-radius: 12px;
    background: rgba(255,255,255,.03);
    margin-bottom: .75rem;
}

.user-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.user-avatar-initial {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
}

.user-info { min-width: 0; }
.user-name { font-weight: 600; font-size: .8rem; color: #f8fafc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .7rem; color: #64748b; }

.user-actions {
    display: flex;
    gap: .5rem;
}

.action-btn {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border-radius: 8px;
    background: rgba(255,255,255,.05);
    color: #94a3b8;
    text-decoration: none;
    transition: all var(--transition);
    font-size: .95rem;
    flex: 1;
}
.action-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.action-btn-danger:hover { background: rgba(239,68,68,.2); color: #ef4444; }

/* ── Sidebar collapsed ────────────────────────────────────────────────────── */
.sidebar-collapsed .app-sidebar {
    width: 68px;
}
.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-section-label,
.sidebar-collapsed .nav-item span,
.sidebar-collapsed .user-info,
.sidebar-collapsed .user-actions { display: none; }
.sidebar-collapsed .nav-item { justify-content: center; padding: .7rem; }
.sidebar-collapsed .user-card { justify-content: center; }
.sidebar-collapsed .app-main { margin-left: 68px; }

/* ── App main ────────────────────────────────────────────────────────────── */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: blur(12px);
    background: rgba(255,255,255,.9);
}

.topbar-left { display: flex; align-items: center; gap: 1rem; }
.topbar-right { display: flex; align-items: center; gap: .75rem; }

.sidebar-toggle {
    background: none; border: none;
    width: 36px; height: 36px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 1.3rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--app-bg); color: var(--text); }

.page-title { font-size: 1.05rem; font-weight: 700; margin: 0; }
.page-breadcrumb { font-size: .75rem; color: var(--muted); margin-top: 1px; }
.page-breadcrumb a { color: var(--brand); text-decoration: none; }
.page-breadcrumb a:hover { text-decoration: underline; }

.topbar-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    font-weight: 700; font-size: .85rem;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
    overflow: hidden;
    transition: transform var(--transition);
}
.topbar-avatar:hover { transform: scale(1.08); }
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Page content ─────────────────────────────────────────────────────────── */
.page-content {
    flex: 1;
    padding: 1.75rem 2rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-section-title { font-size: 1.25rem; font-weight: 700; margin: 0; }
.page-section-sub   { color: var(--muted); font-size: .875rem; margin: .25rem 0 0; }

/* ── Flash alerts ─────────────────────────────────────────────────────────── */
.flash-alert {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1.25rem;
    margin: 0 2rem .5rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: .875rem;
    opacity: 1;
    transition: opacity .4s ease;
}
.flash-alert button {
    margin-left: auto; background: none; border: none;
    cursor: pointer; opacity: .6; padding: 0;
}
.flash-alert button:hover { opacity: 1; }
.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ══════════════════════════════════════════════════════════════════════════
   COMPONENTES
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Surface card ─────────────────────────────────────────────────────────── */
.surface-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

/* ── Stat cards ────────────────────────────────────────────────────────────── */
.stat-card {
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.stat-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(79,70,229,.04) 0%, transparent 60%);
    pointer-events: none;
}

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}
.stat-icon-purple { background: rgba(79,70,229,.12); color: var(--brand); }
.stat-icon-pink   { background: rgba(236,72,153,.12); color: #ec4899; }
.stat-icon-cyan   { background: rgba(6,182,212,.12);  color: var(--brand-2); }
.stat-icon-amber  { background: rgba(245,158,11,.12); color: var(--warning); }

.stat-value { font-size: 2rem; font-weight: 800; line-height: 1; color: var(--text); }
.stat-label { font-size: .8rem; color: var(--muted); margin-top: .35rem; }

/* ── Dashboard hero ──────────────────────────────────────────────────────── */
.dashboard-hero {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    background-image: radial-gradient(circle at 80% 50%, rgba(79,70,229,.05) 0%, transparent 60%);
}

/* ── Tabla ────────────────────────────────────────────────────────────────── */
.table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: rgba(79,70,229,.03);
}
table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--app-bg) !important; }
table td, table th { padding: .9rem 1.25rem !important; vertical-align: middle; }
table td { border-color: var(--app-bg); font-size: .875rem; }

/* ── Botones ──────────────────────────────────────────────────────────────── */
.btn { border-radius: 8px; font-weight: 500; font-size: .875rem; transition: all var(--transition); }
.btn-primary { background: var(--brand); border-color: var(--brand); box-shadow: 0 4px 14px rgba(79,70,229,.25); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(79,70,229,.35); }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; font-size: .875rem; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge-channel {
    display: inline-flex; align-items: center;
    padding: .3rem .7rem;
    border-radius: 20px;
    font-size: .75rem; font-weight: 600;
}
.badge-channel.email    { background: rgba(79,70,229,.1); color: var(--brand); }
.badge-channel.whatsapp { background: rgba(16,185,129,.1); color: var(--success); }

.channel-badge {
    width: 28px; height: 28px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .8rem;
}
.channel-badge.active { background: rgba(16,185,129,.15); color: var(--success); }
.channel-badge.off    { background: var(--app-bg); color: #cbd5e1; }

.status-dot {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .8rem; font-weight: 500;
}
.status-dot::before {
    content: '';
    width: 7px; height: 7px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot.online::before  { background: var(--success); box-shadow: 0 0 0 2px rgba(16,185,129,.2); }
.status-dot.offline::before { background: #cbd5e1; }

/* ── Contact avatar ──────────────────────────────────────────────────────── */
.contact-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    font-weight: 700; font-size: .85rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.contact-avatar.sm { width: 30px; height: 30px; font-size: .7rem; }

/* ── Toggle card (checkbox elegante) ─────────────────────────────────────── */
.toggle-card {
    cursor: pointer;
    display: inline-block;
}
.toggle-card input[type="checkbox"] { display: none; }
.toggle-card-body {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 1rem 1.5rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    transition: all var(--transition);
    text-align: center;
    min-width: 140px;
}
.toggle-card input:checked + .toggle-card-body {
    border-color: var(--brand);
    background: rgba(79,70,229,.05);
}
.toggle-card-body.flex-row { flex-direction: row; text-align: left; min-width: unset; }

/* ── Upload zone ─────────────────────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: var(--app-bg);
    transition: all var(--transition);
}
.upload-zone:hover { border-color: var(--brand); background: rgba(79,70,229,.03); }

/* ── Section heading ─────────────────────────────────────────────────────── */
.section-heading {
    display: flex; align-items: center; gap: 1rem;
}
.section-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: rgba(79,70,229,.1);
    color: var(--brand);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
}
.section-icon.green  { background: rgba(16,185,129,.1); color: var(--success); }
.section-icon.amber  { background: rgba(245,158,11,.1);  color: var(--warning); }

/* ── Calendario ──────────────────────────────────────────────────────────── */
#birthdayCalendar { min-height: 600px; }
.fc .fc-toolbar-title { font-size: 1.1rem !important; font-weight: 700 !important; }
.fc .fc-button-primary { background: var(--brand) !important; border-color: var(--brand) !important; border-radius: 8px !important; }
.fc .fc-daygrid-event { border-radius: 6px !important; font-size: .75rem !important; }

/* ── Hover brand color ───────────────────────────────────────────────────── */
.hover-brand:hover { color: var(--brand) !important; }

/* ══════════════════════════════════════════════════════════════════════════
   LOGIN (guest layout)
   ══════════════════════════════════════════════════════════════════════════ */
.guest-body {
    background: radial-gradient(ellipse at top, #1e293b 0%, #0f172a 60%);
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem;
}

.login-screen {
    display: flex;
    width: 100%;
    max-width: 960px;
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 40px 100px rgba(0,0,0,.4);
}

.login-aside {
    flex: 1;
    background: linear-gradient(145deg, #4f46e5 0%, #0ea5e9 100%);
    padding: 3rem 2.5rem;
    display: flex;
    align-items: stretch;
    position: relative;
    overflow: hidden;
}
.login-aside::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at 20% 80%, rgba(255,255,255,.15), transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255,255,255,.1), transparent 40%);
}

.login-aside-inner {
    position: relative; z-index: 1;
    display: flex; flex-direction: column;
    justify-content: space-between;
    width: 100%;
}

.login-brand { display: flex; align-items: center; gap: 1rem; margin-bottom: 2.5rem; }
.login-brand-icon { font-size: 2.5rem; }

.login-features { display: flex; flex-direction: column; gap: 1.25rem; }
.login-feature {
    display: flex; align-items: center; gap: .85rem;
    color: rgba(255,255,255,.85);
    font-size: .9rem;
}
.login-feature .bi { font-size: 1.2rem; color: rgba(255,255,255,.7); }

.login-aside-footer { color: rgba(255,255,255,.45); font-size: .8rem; }

/* ── Login form panel ─────────────────────────────────────────────────────── */
.login-form-panel {
    width: 420px; flex-shrink: 0;
    padding: 3rem 2.5rem;
    display: flex; align-items: center;
}
.login-form-inner { width: 100%; }

.login-title    { font-size: 1.6rem; font-weight: 800; margin-bottom: .5rem; }
.login-subtitle { color: var(--muted); font-size: .9rem; margin-bottom: 2rem; }

.form-label-custom {
    display: flex; align-items: center; gap: .5rem;
    font-weight: 600; font-size: .85rem; color: var(--text);
    margin-bottom: .5rem;
}
.form-label-custom .bi { color: var(--brand); }

.form-input-custom {
    width: 100%;
    padding: .8rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: .9rem;
    transition: all var(--transition);
    outline: none;
    background: #f8fafc;
}
.form-input-custom:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(79,70,229,.1); }

.input-with-eye { position: relative; }
.input-with-eye .form-input-custom { padding-right: 3rem; }
.eye-btn {
    position: absolute; right: .85rem; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--muted); cursor: pointer; padding: .2rem;
    font-size: .95rem; transition: color var(--transition);
}
.eye-btn:hover { color: var(--brand); }

.btn-login {
    width: 100%;
    padding: .9rem;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: .95rem; font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 8px 20px rgba(79,70,229,.3);
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(79,70,229,.4); }
.btn-login:active { transform: translateY(0); }

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 991.98px) {
    .app-sidebar   { transform: translateX(-100%); }
    .app-main      { margin-left: 0; }
    .page-content  { padding: 1.25rem; }
    .topbar        { padding: .9rem 1.25rem; }
    .flash-alert   { margin: 0 1.25rem .5rem; }
    .dashboard-hero { flex-direction: column; align-items: flex-start; }
    .login-screen  { flex-direction: column; max-width: 480px; }
    .login-aside   { display: none; }
    .login-form-panel { width: 100%; padding: 2.5rem 2rem; }
}

@media (max-width: 575.98px) {
    .stat-value { font-size: 1.6rem; }
    .page-section-title { font-size: 1.1rem; }
    table td, table th { padding: .7rem .9rem !important; font-size: .8rem; }
}
