@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,700;0,9..144,800;1,9..144,700&family=DM+Sans:wght@400;500;600&display=swap');

/* ─── VARIABLES ─── */
:root {
    --bg:      #09090f;
    --bg2:     #0e0e1c;
    --surface: #141428;
    --border:  rgba(255,255,255,0.07);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --glow:    rgba(99,102,241,0.3);
    --accent:  #a78bfa;
    --text:    #eeeef8;
    --muted:   rgba(238,238,248,0.5);
    --danger:  #ef4444;
    --success: #10b981;
    --radius:  12px;
}

/* ─── RESET & BASE ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--text); }

/* ─── NAV ─── */
nav {
    position: sticky;
    top: 0;
    z-index: 200;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    background: rgba(9,9,15,.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

@keyframes pulse-ring {
    0%   { transform: scale(1);   opacity: .6; }
    100% { transform: scale(2.2); opacity: 0; }
}

.brand {
    font-family: 'Fraunces', serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.01em;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}
.brand::before {
    content: '';
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 0 0 0 var(--primary);
    animation: pulse-ring 2.5s ease infinite;
}
.brand:hover { color: var(--text); }

.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a {
    font-size: .875rem;
    font-weight: 500;
    color: var(--muted);
    transition: color .2s;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a.nav-cta {
    background: var(--primary);
    color: #fff;
    padding: .38rem 1rem;
    border-radius: 8px;
    transition: background .2s;
}
.nav-links a.nav-cta:hover { background: var(--primary-hover); color: #fff; }

/* ─── CONTAINER ─── */
.container { max-width: 900px; margin: 2.5rem auto; padding: 0 1.5rem; }

/* ─── PAGE TITLE ─── */
.page-title {
    font-family: 'Fraunces', serif;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: 1.75rem;
    color: var(--text);
}

/* ─── CARD ─── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
}
.card h2 {
    font-family: 'Fraunces', serif;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -.01em;
    margin-bottom: 1.1rem;
    color: var(--text);
}

/* ─── FORMS ─── */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: .825rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: .4rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.form-group input,
.form-group select {
    width: 100%;
    padding: .6rem .85rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .95rem;
    font-family: 'DM Sans', sans-serif;
    color: var(--text);
    transition: border-color .2s, box-shadow .2s;
}
.form-group input::placeholder { color: var(--muted); }
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.form-group select option { background: var(--surface); }

/* ─── BUTTONS ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.25rem;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    border: none;
    transition: background .15s, transform .1s, box-shadow .15s;
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
    color: #fff;
    box-shadow: 0 6px 20px var(--glow);
}

.btn-secondary {
    background: rgba(255,255,255,.07);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255,255,255,.11); color: var(--text); }

.btn-danger {
    background: rgba(239,68,68,.15);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,.25);
}
.btn-danger:hover { background: rgba(239,68,68,.25); color: #fca5a5; }

.btn-google {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}
.btn-google:hover { background: #1e1e35; border-color: rgba(255,255,255,.15); color: var(--text); }

/* ─── ALERTS ─── */
.alert {
    padding: .85rem 1.1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: .875rem;
    font-weight: 500;
}
.alert-error {
    background: rgba(239,68,68,.1);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,.25);
}
.alert-success {
    background: rgba(16,185,129,.1);
    color: #6ee7b7;
    border: 1px solid rgba(16,185,129,.2);
}

/* ─── AUTH PAGES ─── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 2rem 1rem;
}
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 80px rgba(0,0,0,.4);
}
.auth-card h1 {
    font-family: 'Fraunces', serif;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: .3rem;
    color: var(--text);
}
.auth-card .subtitle {
    text-align: center;
    color: var(--muted);
    font-size: .875rem;
    margin-bottom: 1.75rem;
}
.auth-card a { color: var(--accent); }
.auth-card a:hover { color: var(--text); }

/* ─── CALENDAR LIST ─── */
.cal-list { list-style: none; }
.cal-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}
.cal-item:last-child { border-bottom: none; }
.cal-info strong { display: block; color: var(--text); margin-bottom: .2rem; }
.cal-info span {
    font-size: .8rem;
    color: var(--muted);
    display: block;
    word-break: break-all;
}


/* ─── NOTIFICATION PILLS ─── */
.pill-wrap { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: rgba(99,102,241,.15);
    color: #c4b5fd;
    border: 1px solid rgba(99,102,241,.25);
    border-radius: 99px;
    padding: .3rem .85rem;
    font-size: .825rem;
    font-weight: 600;
}
.pill button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--accent);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    transition: color .15s;
}
.pill button:hover { color: #fca5a5; }

/* ─── DASHBOARD STATS ─── */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
}
.stat-card .num {
    font-family: 'Fraunces', serif;
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    letter-spacing: -.03em;
}
.stat-card .lbl {
    font-size: .78rem;
    color: var(--muted);
    margin-top: .35rem;
    font-weight: 500;
}

/* ─── TABLES ─── */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table thead tr {
    border-bottom: 1px solid var(--border);
}
.data-table th {
    padding: .7rem 1rem;
    text-align: left;
    font-size: .75rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}
.data-table td {
    padding: .85rem 1rem;
    font-size: .875rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgba(255,255,255,.02); }

/* ─── EVENT NOTIFICATION TOGGLES ─── */
.notif-toggle {
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: .22rem .65rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
    cursor: pointer;
    margin-left: .3rem;
    transition: background .15s, color .15s, border-color .15s;
    font-family: 'DM Sans', sans-serif;
    background: rgba(255,255,255,.05);
    color: var(--muted);
}
.notif-toggle[data-value="1"] {
    background: rgba(16,185,129,.15);
    color: #6ee7b7;
    border-color: rgba(16,185,129,.3);
}
.notif-toggle:hover { opacity: .8; }
.notif-toggle:disabled { cursor: default; opacity: .5; }

/* ─── MISC HELPERS ─── */
.text-muted  { color: var(--muted); }
.text-accent { color: var(--accent); }
code {
    background: rgba(255,255,255,.06);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: .1em .4em;
    font-size: .875em;
    color: var(--accent);
}

/* ─── EVENT LIST ─── */
.event-list { list-style: none; }

.event-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
.event-item:last-child { border-bottom: none; }

.event-main { flex: 1; min-width: 0; }

.event-name {
    font-weight: 600;
    font-size: .925rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: .3rem;
}

.event-meta {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex-wrap: wrap;
}
.event-time {
    font-size: .8rem;
    color: var(--muted);
    white-space: nowrap;
}
.event-cal-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.event-cal-name {
    font-size: .8rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.event-toggles {
    display: flex;
    gap: .4rem;
    flex-shrink: 0;
}

/* ─── TABLE SCROLL WRAPPER ─── */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1.75rem;          /* bleed to card edges */
    padding: 0 1.75rem;
}
.table-wrap .data-table { min-width: 520px; }

/* ─── MOBILE NAV ─── */
.nav-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform .25s, opacity .2s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-mobile-menu {
    display: none;
    position: fixed;
    top: 60px;
    left: 0; right: 0;
    background: rgba(9,9,15,.97);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem 1.5rem;
    flex-direction: column;
    gap: .25rem;
    z-index: 199;
}
.nav-mobile-menu.open { display: flex; }
.nav-mobile-menu a {
    display: block;
    padding: .75rem 0;
    font-size: 1rem;
    font-weight: 500;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    transition: color .2s;
}
.nav-mobile-menu a:last-child { border-bottom: none; }
.nav-mobile-menu a:hover { color: var(--text); }
.nav-mobile-menu a.nav-cta {
    margin-top: .75rem;
    background: var(--primary);
    color: #fff;
    text-align: center;
    padding: .75rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 700px) {
    nav { padding: 0 1rem; }
    .nav-links { display: none; }
    .nav-hamburger { display: flex; }

    .container { margin: 1.25rem auto; padding: 0 1rem; }

    .card { padding: 1.25rem; }
    .card h2 { font-size: 1.05rem; }

    .page-title { font-size: 1.4rem; margin-bottom: 1.25rem; }

    /* Stats: 2 per row on small screens */
    .stats { grid-template-columns: 1fr 1fr; gap: .75rem; }
    .stat-card { padding: 1rem; }
    .stat-card .num { font-size: 1.75rem; }

    /* Table bleed reset on smaller cards */
    .table-wrap { margin: 0 -1.25rem; padding: 0 1.25rem; }

    /* Calendar list: stack remove button below info */
    .cal-item { flex-direction: column; align-items: flex-start; gap: .6rem; }

    /* Quick action buttons: full width stack */
    .btn-stack { flex-direction: column; }
    .btn-stack .btn { width: 100%; justify-content: center; }

    /* Auth card: tighter padding */
    .auth-card { padding: 2rem 1.25rem; }

    /* Pill input row: stack vertically */
    .pill-form-row { flex-direction: column; align-items: stretch !important; }
    .pill-form-row .form-group { margin-bottom: 0; }
    .pill-form-row input { width: 100% !important; }

    /* Settings voice/phone forms: stack */
    .settings-form-row { flex-direction: column !important; align-items: stretch !important; }
    .settings-form-row input { width: 100% !important; }

    /* Notify toggle column: smaller */
    .notif-toggle { padding: .2rem .5rem; font-size: .68rem; }

    /* Events: stack name+meta / toggles vertically on small screens */
    .event-item { padding: .9rem 1.25rem; }
    .event-name { white-space: normal; }
}
