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

:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #eef2ff;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-400: #9ca3af;
    --gray-600: #4b5563;
    --gray-800: #1f2937;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,.08);
    --shadow-sm: 0 1px 4px rgba(0,0,0,.06);
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* ── Header ───────────────────────────────────────────────────────────── */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 2rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.nav-link {
    font-size: .9rem;
    color: var(--gray-600);
    padding: .4rem .8rem;
    border-radius: 8px;
    transition: background .15s;
}
.nav-link:hover { background: var(--gray-100); text-decoration: none; }

/* ── Main & Footer ────────────────────────────────────────────────────── */
.main-content { flex: 1; padding: 2rem 1rem; }

.site-footer {
    text-align: center;
    padding: 1.5rem;
    font-size: .85rem;
    color: var(--gray-400);
    border-top: 1px solid var(--gray-200);
    background: #fff;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 1.2rem;
    border-radius: 8px;
    font-size: .95rem;
    font-weight: 500;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }

.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline  { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }

.btn-ghost    { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); }

.btn-danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }

.btn-lg  { padding: .85rem 2rem; font-size: 1.05rem; }
.btn-sm  { padding: .35rem .75rem; font-size: .85rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.2rem; }
.form-group label { font-size: .9rem; font-weight: 500; color: var(--gray-600); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

input[type=text], input[type=email], input[type=url],
input[type=password], input[type=date], input[type=number],
textarea, select {
    width: 100%;
    padding: .6rem .9rem;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-size: .95rem;
    background: #fff;
    transition: border-color .15s;
    font-family: inherit;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
textarea { resize: vertical; }

.req { color: var(--danger); }
.hint { font-size: .85rem; color: var(--gray-400); margin-top: .5rem; }

.fieldset {
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.2rem;
    margin-bottom: 1.2rem;
}
.fieldset legend {
    padding: 0 .5rem;
    font-weight: 600;
    font-size: .9rem;
    color: var(--gray-600);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    gap: 1rem;
}

/* ── Alerts ───────────────────────────────────────────────────────────── */
.alert {
    padding: 1rem 1.2rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: .95rem;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Cards ────────────────────────────────────────────────────────────── */
.form-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    max-width: 680px;
    margin: 0 auto;
}
.form-card h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }

/* ── Hero ─────────────────────────────────────────────────────────────── */
.hero {
    max-width: 900px;
    margin: 2rem auto;
    text-align: center;
}
.hero-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--gray-800);
    margin-bottom: 1rem;
}
.hero-desc {
    font-size: 1.1rem;
    color: var(--gray-600);
    max-width: 560px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}
.hero-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 3rem;
}
.step-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}
.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    font-weight: 700;
    margin-bottom: .75rem;
}
.step-card h3 { margin-bottom: .5rem; }
.step-card p  { font-size: .9rem; color: var(--gray-600); }

/* ── Choose type ──────────────────────────────────────────────────────── */
.page-center { max-width: 800px; margin: 2rem auto; text-align: center; }
.page-center h1 { font-size: 1.8rem; margin-bottom: .5rem; }
.subtitle { color: var(--gray-600); margin-bottom: 2rem; }

.type-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    text-align: left;
}
.type-card {
    background: #fff;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    transition: border-color .2s, box-shadow .2s;
    text-decoration: none;
    color: inherit;
}
.type-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    text-decoration: none;
}
.type-icon { font-size: 2.5rem; }
.type-card h2 { font-size: 1.2rem; }
.type-card p  { font-size: .9rem; color: var(--gray-600); flex: 1; }

/* ── Stepper ──────────────────────────────────────────────────────────── */
.stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    gap: 0;
}
.stepper-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
    font-size: .8rem;
    color: var(--gray-400);
    min-width: 80px;
}
.stepper-item.active { color: var(--primary); }
.stepper-item.done   { color: var(--success); }

.stepper-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    background: #fff;
}
.stepper-item.active .stepper-circle { border-color: var(--primary); color: var(--primary); }
.stepper-item.done   .stepper-circle { border-color: var(--success); background: var(--success); color: #fff; }

.stepper-line {
    flex: 1;
    height: 2px;
    background: var(--gray-200);
    min-width: 30px;
    margin-bottom: 1.4rem;
}

.form-page { max-width: 720px; margin: 0 auto; }

/* ── Calendar ─────────────────────────────────────────────────────────── */
.calendar-section {
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
}
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-weight: 600;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.cal-day-name {
    text-align: center;
    font-size: .75rem;
    font-weight: 600;
    color: var(--gray-400);
    padding: .3rem 0;
}
.cal-day {
    text-align: center;
    padding: .5rem .2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: .9rem;
    transition: background .15s;
    border: 1.5px solid transparent;
}
.cal-day:hover:not(.empty):not(.past) { background: var(--primary-light); }
.cal-day.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.cal-day.past     { color: var(--gray-400); cursor: default; }
.cal-day.empty    { cursor: default; }

/* ── Slots ────────────────────────────────────────────────────────────── */
.selected-dates { margin-bottom: 1.5rem; }
.selected-dates h3 { margin-bottom: .75rem; font-size: 1rem; }
.slot-list { display: flex; flex-direction: column; gap: .5rem; }

.slot-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: .5rem .75rem;
    flex-wrap: wrap;
}
.slot-date { font-weight: 600; min-width: 120px; }
.slot-times { display: flex; gap: .5rem; flex-wrap: wrap; flex: 1; }
.slot-time-tag {
    display: flex;
    align-items: center;
    gap: .3rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 6px;
    padding: .2rem .6rem;
    font-size: .85rem;
}
.slot-time-tag button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    font-size: .8rem;
    padding: 0;
    line-height: 1;
}
.slot-add-time {
    display: flex;
    align-items: center;
    gap: .4rem;
}
.slot-add-time input[type=time] { width: 110px; padding: .25rem .5rem; font-size: .85rem; }
.slot-remove { margin-left: auto; }

/* ── Options list ─────────────────────────────────────────────────────── */
.option-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .5rem;
}
.option-input { flex: 1; }

/* ── Toggle switches ──────────────────────────────────────────────────── */
.option-toggle {
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    margin-bottom: .75rem;
}
.toggle-label {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    cursor: pointer;
}
.toggle-label input[type=checkbox] { display: none; }
.toggle-switch {
    flex-shrink: 0;
    width: 44px;
    height: 24px;
    background: var(--gray-200);
    border-radius: 12px;
    position: relative;
    transition: background .2s;
    margin-top: 2px;
}
.toggle-switch::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-label input:checked + .toggle-switch { background: var(--primary); }
.toggle-label input:checked + .toggle-switch::after { transform: translateX(20px); }
.toggle-label > div p { font-size: .85rem; color: var(--gray-600); margin-top: .2rem; }

/* ── Step 4 / Share ───────────────────────────────────────────────────── */
.text-center { text-align: center; }
.success-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.share-box {
    display: flex;
    gap: .5rem;
    margin: 1.5rem 0;
    align-items: center;
}
.share-box input { flex: 1; font-size: .9rem; }
.copy-msg { color: var(--success); font-size: .9rem; margin-top: -.5rem; }
.final-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }

/* ── Vote page ────────────────────────────────────────────────────────── */
.vote-page { max-width: 900px; margin: 0 auto; }
.vote-header {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}
.vote-header h1 { font-size: 1.6rem; margin-bottom: .5rem; }
.vote-desc { color: var(--gray-600); margin-bottom: .5rem; }
.vote-meta { font-size: .85rem; color: var(--gray-400); }

.results-table-wrap {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}
.results-table-wrap h2 { margin-bottom: 1rem; font-size: 1.1rem; }
.results-scroll { overflow-x: auto; }

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.results-table th, .results-table td {
    padding: .6rem .8rem;
    border-bottom: 1px solid var(--gray-100);
    text-align: center;
}
.results-table th:first-child, .results-table td:first-child { text-align: left; }
.results-table thead th { font-weight: 600; color: var(--gray-600); background: var(--gray-50); }
.results-table .my-row { background: var(--primary-light); }
.totals-row td { background: var(--gray-50); font-weight: 600; }

.v-yes   { color: var(--success); font-size: 1.1rem; }
.v-maybe { color: var(--warning); font-size: 1.1rem; }
.v-no    { color: var(--danger);  font-size: 1.1rem; }

.vote-form-wrap {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}
.vote-form-wrap h2 { margin-bottom: 1.2rem; font-size: 1.1rem; }

.vote-choices { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1.5rem; }
.vote-choice-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .75rem 1rem;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    flex-wrap: wrap;
}
.choice-label { flex: 1; font-weight: 500; min-width: 120px; }
.vote-btns { display: flex; gap: .5rem; flex-wrap: wrap; }

.vbtn {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .35rem .75rem;
    border-radius: 6px;
    border: 1.5px solid var(--gray-200);
    cursor: pointer;
    font-size: .85rem;
    transition: all .15s;
    background: #fff;
}
.vbtn input { display: none; }
.vbtn:hover { border-color: var(--primary); }
.active-yes   { background: #dcfce7; border-color: var(--success); color: var(--success); }
.active-maybe { background: #fef3c7; border-color: var(--warning); color: var(--warning); }
.active-no    { background: #fee2e2; border-color: var(--danger);  color: var(--danger); }

/* ── Admin ────────────────────────────────────────────────────────────── */
.admin-page { max-width: 1100px; margin: 0 auto; }
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.admin-header h1 { font-size: 1.6rem; }
.admin-actions { display: flex; gap: .75rem; }

.surveys-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}
.survey-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.survey-card-header { display: flex; gap: .5rem; align-items: center; }
.survey-type-badge {
    font-size: .75rem;
    padding: .2rem .6rem;
    border-radius: 20px;
    font-weight: 600;
}
.survey-type-badge.date   { background: #dbeafe; color: #1d4ed8; }
.survey-type-badge.option { background: #f3e8ff; color: #7c3aed; }

.badge {
    font-size: .75rem;
    padding: .2rem .6rem;
    border-radius: 20px;
    font-weight: 600;
}
.badge-active  { background: #dcfce7; color: var(--success); }
.badge-expired { background: #fee2e2; color: var(--danger); }

.survey-card h2 { font-size: 1.05rem; }
.survey-desc { font-size: .85rem; color: var(--gray-600); }
.survey-meta { display: flex; gap: .75rem; font-size: .8rem; color: var(--gray-400); flex-wrap: wrap; }
.share-box-sm input {
    width: 100%;
    font-size: .8rem;
    padding: .4rem .6rem;
    background: var(--gray-50);
    color: var(--gray-600);
}
.survey-card-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: auto; }

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-400);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* ── Install page ─────────────────────────────────────────────────────── */
.install-page { background: var(--gray-100); }
.install-container {
    max-width: 760px;
    margin: 2rem auto;
    padding: 0 1rem 3rem;
}
.install-header {
    text-align: center;
    margin-bottom: 2rem;
}
.install-header .logo-icon { font-size: 3rem; }
.install-header h1 { font-size: 1.8rem; margin: .5rem 0 .25rem; }
.install-header p  { color: var(--gray-600); }

.install-form { display: flex; flex-direction: column; gap: 0; }
.form-section {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.form-section h2 { font-size: 1rem; margin-bottom: 1.2rem; color: var(--gray-800); }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .hero-content h1 { font-size: 1.8rem; }
    .hero-steps { grid-template-columns: 1fr; }
    .type-cards  { grid-template-columns: 1fr; }
    .form-row    { grid-template-columns: 1fr; }
    .stepper-item span { display: none; }
    .vote-choice-row { flex-direction: column; align-items: flex-start; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions .btn { width: 100%; justify-content: center; }
    .admin-header { flex-direction: column; align-items: flex-start; }
}
