/* SimpleScheduler — base styles.
   The full booking-page design arrives in Milestone 4; this file establishes
   the shared foundation: variables, reset, typography, panels, forms. */

:root {
    --accent: #1f6feb;
    --accent-hover: #1a5fd0;
    --bg: #f7f8fa;
    --surface: #ffffff;
    --border: #e2e5ea;
    --text: #1c2129;
    --text-muted: #5b6472;
    --danger: #c62828;
    --success: #1b7a3d;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(20, 24, 33, 0.07), 0 4px 16px rgba(20, 24, 33, 0.05);
    --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

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

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2rem 1rem;
}

h1, h2, h3 {
    line-height: 1.25;
    margin: 0 0 0.75rem;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

p {
    margin: 0 0 1rem;
}

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

a:hover {
    text-decoration: underline;
}

code {
    background: #eef1f5;
    border-radius: 4px;
    padding: 0.1em 0.35em;
    font-size: 0.9em;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    width: 100%;
    max-width: 640px;
}

.panel-center {
    margin-top: 10vh;
    text-align: center;
}

/* Forms */
label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="time"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn {
    display: inline-block;
    padding: 0.55rem 1.1rem;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
}

.field {
    margin-bottom: 1rem;
}

.field-error,
.validation-summary-errors {
    color: var(--danger);
    font-size: 0.875rem;
}

.text-muted {
    color: var(--text-muted);
}

.btn-small {
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
}

.alert {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.alert-warning {
    background: #fff7e0;
    border: 1px solid #e8ce7a;
    color: #6b5311;
}

.alert-success {
    background: #e8f5ec;
    border: 1px solid #a6d8b5;
    color: #17542c;
}

/* ---------- Admin area ---------- */

.admin-body {
    background: var(--bg);
}

.admin-body .page {
    display: block;
    padding: 0;
}

.admin-shell {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    display: flex;
    flex-direction: column;
    width: 230px;
    flex-shrink: 0;
    background: #171c26;
    color: #cbd3e0;
    padding: 1.25rem 0.9rem;
}

.admin-brand {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    padding: 0 0.6rem 1rem;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-grow: 1;
}

.admin-nav a {
    display: block;
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    color: #cbd3e0;
    font-size: 0.95rem;
}

.admin-nav a:hover {
    background: #232a38;
    color: #fff;
    text-decoration: none;
}

.admin-nav a.active {
    background: var(--accent);
    color: #fff;
}

.admin-logout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid #2a3140;
}

.admin-user {
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-content {
    flex-grow: 1;
    padding: 2rem;
    max-width: 1100px;
}

.admin-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    max-width: 720px;
}

.detail-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.4rem 1.5rem;
    margin: 0;
}

.detail-list dt {
    font-weight: 600;
    color: var(--text-muted);
}

.detail-list dd {
    margin: 0;
}

.login-panel {
    max-width: 400px;
    margin-top: 12vh;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0 1.25rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 400;
    font-size: 0.95rem;
    margin: 0.35rem 0;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

.upload-preview {
    margin-top: 0.5rem;
}

.upload-preview img {
    max-height: 64px;
    max-width: 200px;
    display: block;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px;
    background: #fff;
}

.upload-preview img.avatar-preview {
    height: 64px;
    width: 64px;
    object-fit: cover;
    border-radius: 50%;
}

.color-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.color-row input[type="color"] {
    width: 44px;
    height: 38px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
}

/* Weekly schedule editor */
.week-editor {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.day-row {
    display: grid;
    grid-template-columns: 110px 1fr auto;
    gap: 0.75rem;
    align-items: start;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.day-row:last-child {
    border-bottom: none;
}

.day-name {
    font-weight: 600;
    padding-top: 0.4rem;
}

.day-intervals {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-height: 2rem;
}

.interval-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.interval-row input[type="time"] {
    width: 110px;
}

/* Simple data tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.data-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.inline-form {
    display: inline;
}

.button-row {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.status-ok {
    color: var(--success);
    font-weight: 600;
}

.status-off {
    color: var(--text-muted);
    font-weight: 600;
}

.admin-card-wide {
    max-width: none;
}

.table-scroll {
    overflow-x: auto;
}

.filter-row {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filter-link {
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.filter-link:hover {
    text-decoration: none;
    color: var(--text);
}

.filter-link.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-confirmed { background: #e8f5ec; color: #17542c; }
.badge-pending { background: #fff7e0; color: #6b5311; }
.badge-cancelled { background: #eceef1; color: #5b6472; }
.badge-failed { background: #fdecea; color: #8c1d18; }
.badge-completed { background: #e7f0fd; color: #1c4c96; }

.copy-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--accent);
    cursor: pointer;
    text-align: left;
}

.copy-btn:hover {
    text-decoration: underline;
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #a31f1f;
}

.cancel-form {
    margin-top: 1.25rem;
}

/* ---------- Public booking page ---------- */

.booking-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 3vh 0;
}

.booking-card {
    display: grid;
    grid-template-columns: 300px minmax(320px, 1fr) 280px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    max-width: 1000px;
    width: 100%;
    min-height: 480px;
    overflow: hidden;
}

.booking-info {
    padding: 1.75rem;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.host-media {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

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

.host-logo {
    max-height: 44px;
    max-width: 170px;
    object-fit: contain;
}

.host-line {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.host-name {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.host-title {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.company-name {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.meeting-title {
    font-size: 1.45rem;
    margin: 0.5rem 0 0.75rem;
}

.meeting-meta {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.meeting-meta li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meeting-description {
    font-size: 0.95rem;
    color: var(--text);
    white-space: pre-line;
}

.host-contact {
    margin-top: auto;
    padding-top: 1rem;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.privacy-link {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

/* Calendar column */
.booking-calendar {
    padding: 1.75rem 1.5rem;
    display: flex;
    flex-direction: column;
}

.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.9rem;
}

.cal-month {
    font-weight: 600;
}

.cal-nav {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 8px;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text);
}

.cal-nav:hover:not(:disabled) {
    background: var(--bg);
}

.cal-nav:disabled {
    opacity: 0.35;
    cursor: default;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    transition: opacity 0.15s;
}

.cal-grid.loading {
    opacity: 0.45;
}

.cal-weekday {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding-bottom: 0.35rem;
}

.cal-day {
    aspect-ratio: 1;
    border: none;
    border-radius: 50%;
    background: transparent;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    position: relative;
}

.cal-day:hover:not(:disabled) {
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.cal-day:disabled {
    color: #b9bfc9;
    font-weight: 400;
    cursor: default;
}

.cal-day.selected {
    background: var(--accent);
    color: #fff;
}

.tz-picker {
    margin-top: auto;
    padding-top: 1rem;
}

.tz-picker select {
    font-size: 0.85rem;
    color: var(--text-muted);
    border: none;
    background: transparent;
    max-width: 100%;
}

.tz-picker select:hover {
    color: var(--text);
}

/* Times / form column */
.booking-side {
    padding: 1.75rem 1.5rem;
    border-left: 1px solid var(--border);
    overflow-y: auto;
    max-height: 640px;
}

.side-placeholder {
    color: var(--text-muted);
    font-size: 0.95rem;
    padding-top: 2rem;
    text-align: center;
}

.side-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.9rem;
}

.times-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.time-slot {
    padding: 0.6rem;
    border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
    border-radius: 8px;
    background: var(--surface);
    color: var(--accent);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}

.time-slot:hover {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.times-loading,
.times-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.75rem 0;
}

.back-link {
    background: none;
    border: none;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0;
    margin-bottom: 0.75rem;
}

.back-link:hover {
    color: var(--text);
}

.btn-book {
    width: 100%;
    background: var(--accent);
    margin-top: 0.5rem;
}

.btn-book:hover {
    background: color-mix(in srgb, var(--accent) 85%, black);
}

.form-error {
    background: #fdecea;
    border: 1px solid #f2b8b5;
    color: #8c1d18;
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
    margin-bottom: 0.9rem;
}

.req {
    color: var(--danger);
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 400;
    margin: 0.3rem 0;
}

.radio-label input {
    width: auto;
}

.method-choice {
    border: none;
    padding: 0;
    margin: 0 0 1rem;
}

.method-choice legend {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    padding: 0;
}

.spam-check {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.7rem 0.8rem;
}

.spam-check input {
    max-width: 140px;
}

/* Honeypot: rendered off-screen so humans never see or fill it. */
.hp-wrap {
    position: absolute;
    left: -9999px;
    top: -9999px;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Confirmation page */
.confirm-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    max-width: 560px;
    width: 100%;
    padding: 2.5rem 2rem;
    text-align: center;
}

.confirm-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--success);
    color: #fff;
    font-size: 1.8rem;
    line-height: 56px;
    margin: 0 auto 1rem;
}

.confirm-icon-muted {
    background: var(--text-muted);
}

.confirm-when {
    font-size: 1.05rem;
    margin: 1.25rem 0;
    line-height: 1.6;
}

.confirm-card .detail-list {
    text-align: left;
    margin: 1.25rem auto;
    max-width: 380px;
}

.confirm-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}

.phone-instructions {
    background: var(--bg);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    margin-top: 1rem;
    font-size: 0.95rem;
}

.confirm-extra {
    margin-top: 1.25rem;
    font-size: 0.95rem;
}

.confirm-email-note {
    margin-top: 1.25rem;
    font-size: 0.9rem;
}

.cancel-line {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .booking-card {
        grid-template-columns: 1fr;
        max-width: 480px;
        min-height: 0;
    }

    .booking-info {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .booking-side {
        border-left: none;
        border-top: 1px solid var(--border);
        max-height: none;
    }

    .times-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }
}

@media (max-width: 800px) {
    .admin-shell {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        flex-direction: column;
    }

    .admin-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .admin-content {
        padding: 1rem;
    }
}
