/*
  ShiftOrganizer ↔ Google Calendar — Frontend styles
  - Modern, responsive, accessible
  - Consistent vertical rhythm across cards & wizard steps
*/

:root {
    --bg: #0b1220;
    --bg-accent: #111a2e;
    --card: #ffffff;
    --ink: #0b1220;
    --muted: #5b6577;
    --primary: #3b82f6;
    --primary-ink: #fff;
    --ok: #16a34a;
    --warn: #f59e0b;
    --danger: #ef4444;
    --chip-bg: #eef2ff;
    --ring: 24, 119, 242;

    --radius: 16px;
    --shadow: 0 10px 30px rgba(0, 0, 0, .12);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, .08);

    --space-1: 8px;
    --space-2: 12px;
    --space-3: 16px;
    --space-4: 24px;
    --space-5: 32px;
    --space-6: 48px;

    /* vertical rhythm (single source of truth) */
    --vr: 16px; /* base gap between stacked rows */
    --row-gap: 6px; /* inside a field: label → input → error */

    /* card padding is reused for symmetrical button gaps */
    --card-pad: 20px;

    /* stepper sizing */
    --dot: clamp(24px, 6vw, 36px);
    --track: 2px;
    --step-gap: clamp(8px, 2.2vw, 14px);
    --label-gap: clamp(4px, 1.2vw, 8px);

    --transition: 260ms cubic-bezier(.2, .8, .2, 1);
}

@media (min-width: 1024px) {
    :root {
        --vr: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --transition: 0ms linear;
    }

    * {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
    color: var(--ink);
    background: var(--bg);
}

/* Background glow */
.bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: radial-gradient(1200px 500px at 10% 10%, rgba(59, 130, 246, .35), transparent 60%),
    radial-gradient(1000px 600px at 90% 20%, rgba(16, 185, 129, .28), transparent 65%),
    radial-gradient(900px 500px at 50% 100%, rgba(99, 102, 241, .25), transparent 60%),
    linear-gradient(180deg, #0b1220, #0b1220);
}

/* Header */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px clamp(16px, 6vw, 40px);
    color: #e6ecff;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: .2px;
}

.brand .logo {
    color: #c8d5ff;
}

/*.user-mini {*/
/*    font-size: 14px;*/
/*    color: #cfd8ea;*/
/*}*/

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

.small {
    font-size: 12px;
    margin-block-start: .5rem;
}

/* Layout */
.app, .wizard {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 clamp(16px, 6vw, 40px) 80px;
}

.app-head .title {
    color: #fff;
    font-weight: 700;
    font-size: clamp(24px, 2.2rem, 40px);
    margin: 8px 0 6px;
}

.greeting {
    color: #cfd8ea;
    margin: 0 0 20px;
}

.grid {
    display: grid;
    grid-template-columns:1fr;
    gap: 16px;
}

@media (min-width: 900px) {
    .grid {
        grid-template-columns:repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .hello::after {
        content: "\A";
        white-space: pre;
    }

}

.user-banner {
    margin: 10px 0 22px;
    color: #fff;
}

.user-banner .hello {
    opacity: .8;
    margin-right: 6px;
}

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--card-pad);
    margin-block: 16px;
}

.card h2 {
    margin: 0 0 var(--vr);
}

/* Wizard step panes match cards */
.step-pane {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--card-pad);
    margin: 10px 0;
}

.step-pane[hidden] {
    display: none;
}

.step-pane h2 {
    margin: 0 0 var(--vr);
}

/* Stacks: apply the same rhythm to direct children of cards & step panes */
.card > * + *,
.step-pane > * + * {
    margin-top: var(--vr);
}

/* Buttons */
.btn {
    --bg: #e7ecf7;
    --fg: var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    background: var(--bg);
    color: var(--fg);
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition), filter var(--transition);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
}

.btn:hover {
    filter: brightness(1.03);
    box-shadow: var(--shadow);
}

.btn:active {
    filter: brightness(.98);
}

.btn.block {
    width: 100%;
}

.btn.subtle {
    background: #fff;
    border: 1px solid #ccc;
}

.btn.subtle.red {
    background: var(--danger);
    color: #fff;
}

.btn:focus-visible {
    outline: 3px solid rgba(var(--ring), .6);
    outline-offset: 2px;
}

.btn[disabled], .btn[aria-disabled="true"] {
    opacity: .55;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-primary {
    --bg: var(--primary);
    --fg: var(--primary-ink);
}

/* Edit action row (calendar + schedule editors) */
.card .edit-actions,
.step-pane .edit-actions {
    display: flex;
    width: 100%;
    gap: var(--card-pad); /* symmetric with card padding */
    margin-top: var(--vr);
}

.card .edit-actions .btn,
.step-pane .edit-actions .btn {
    flex: 1 1 0;
    min-height: 44px;
}

@media (max-width: 420px) {
    .card .edit-actions, .step-pane .edit-actions {
        flex-direction: column;
        gap: 12px;
    }
}

/* Fields (single rhythm) */
.field, .field-inline {
    display: grid;
    gap: var(--row-gap);
    margin: 0; /* the container stack controls spacing */
}

.card .field, .card .field-inline,
.step-pane .field, .step-pane .field-inline {
    margin-block: var(--vr);
}

/* Labels */
.field label, .field-inline label {
    color: var(--ink);
    font-weight: 600;
}

/* Inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea, select {
    flex: 1;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #f9f9f9;
    color: var(--ink);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color .2s, background-color .2s, box-shadow .2s;
    margin: 0; /* reset: rhythm is from the stack */
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus, select:focus {
    border-color: #007aff;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, .1);
}

input:focus-visible {
    outline: 3px solid rgba(var(--ring), .6);
    outline-offset: 1px;
    border-color: transparent;
}

/* Inline validation */
.input-error {
    border-color: var(--danger) !important;
    background: #fff5f5;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, .10);
}

.field-msg.error {
    color: var(--danger);
    font-size: 12px;
    margin: 0; /* sits directly under the input */
}

/* “Advanced” section spacing follows rhythm */
.advanced {
    margin-top: var(--vr);
}

/* Actions (submit rows) */
.actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: var(--vr);
}

.form-error {
    color: var(--danger);
    font-size: 14px;
}

/* Inline note look */
.note {
    background: #f5f7ff;
    border: 1px dashed #cfd8ea;
    padding: 10px 12px;
    border-radius: 10px;
}

.note-inline {
    padding: 10px 12px;
    line-height: 1.25;
}

/* Small round edit button */
.btn-icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e9f5;
    background: #fff;
    padding: 0;
    font-size: 14px;
}

.btn-icon:hover {
    filter: brightness(.98);
}

.btn-icon:focus-visible {
    outline: 3px solid rgba(var(--ring), .6);
    outline-offset: 2px;
}

/* Schedule helper text section aligns to rhythm */
.schedule-form {
    display: grid;
    grid-template-columns:1fr;
    gap: 10px;
}

.schedule-label {
    font-weight: 600;
    color: var(--ink);
}

.schedule-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.schedule-input .suffix {
    color: var(--muted);
    min-width: max-content;
}

/* Wizard “Done” animation */
.done-anim {
    display: grid;
    place-items: center;
    gap: 8px;
    padding: 8px 0;
}

.done__svg {
    width: min(120px, 40%);
    height: auto;
}

.done__circle {
    stroke: #21c274;
    stroke-width: 4;
    stroke-dasharray: 190;
    stroke-dashoffset: 190;
    animation: circleDraw 700ms ease forwards;
}

.done__check {
    stroke: #21c274;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    animation: checkDraw 500ms 300ms ease forwards;
}

.done__text {
    color: #1c9c61;
    font-weight: 700;
}

@keyframes circleDraw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes checkDraw {
    to {
        stroke-dashoffset: 0;
    }
}


/* Stepper */
.stepper {
    margin: clamp(8px, 3vh, 24px) 0 18px;
}

.stepper ol {
    list-style: none;
    display: grid;
    grid-template-columns:repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: var(--step-gap);
    padding: 0 0 8px;
    position: relative;
}

.stepper .step {
    position: relative;
    display: grid;
    grid-template-rows:var(--dot) auto;
    justify-items: center;
    align-items: start;
    row-gap: var(--label-gap);
    text-align: center;
    color: #e7ecff;
}

.stepper .step span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--dot);
    height: var(--dot);
    border-radius: 50%;
    border: 2px solid #c0d1ff80;
    background: #c0d1ff33;
    color: #fff;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    z-index: 1;
}

.stepper .step label {
    display: block;
    font-size: clamp(11px, 2.8vw, 13px);
    line-height: 1.2;
    font-weight: 600;
    color: #e7ecff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stepper .step::after {
    content: "";
    position: absolute;
    top: calc(var(--dot) / 2);
    left: calc(-50% - var(--step-gap) / 2 + var(--dot) / 2);
    right: calc(50% + var(--step-gap) / 2 + var(--dot) / 2);
    height: var(--track);
    background: #c0d1ffaa;
    border-radius: 2px;
    transform: translateY(-50%) scaleX(0);
    transform-origin: left center;
    transition: transform 600ms cubic-bezier(.2, .8, .2, 1);
    z-index: 0;
}

.stepper .step:first-child::after {
    display: none;
}

.stepper .step.is-done::after, .stepper .step.is-active::after {
    transform: translateY(-50%) scaleX(1);
}

.stepper .step.is-active span, .stepper .step.is-done span {
    border-color: #c0d1ffaa;
    background: #c0d1ff66;
}

.stepper .step.is-active label {
    color: #fff;
}

@media (max-width: 340px) {
    .stepper .step label {
        display: none;
    }
}

/* safety: remove any full-width base track */
.stepper ol::before {
    display: none !important;
}

/* Runs */
.runs {
    margin-top: 18px;
}

.runs-list {
    display: grid;
    gap: 10px;
}

.runs-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.run {
    border: 1px solid #e5e9f5;
    border-radius: 12px;
    padding: 12px;
    background: #fff;
}

.run__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.run__left {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.run__meta {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.3;
}

.run__id::after {
    content: "#" attr(data-n); /* → e.g. "#12" */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.run__details {
    margin-top: 8px;
}

.run__pre {
    margin: 8px 0 0;
    padding: 10px;
    background: #0f172a;
    color: #e5e7eb;
    border-radius: 10px;
    overflow: auto;
}

/* Chips */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid #e2e8f0;
}

.chip-ok {
    background: #e8faef;
    color: #065f46;
    border-color: #bbf7d0;
}

.chip-warn {
    background: #fff7ed;
    color: #92400e;
    border-color: #fed7aa;
}

.chip-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.chip-running {
    background: #eef2ff;
    color: #3730a3;
    border-color: #c7d2fe;
}

/* Toasts (bottom-right, as designed) */
.toasts {
    position: fixed;
    right: 16px;
    bottom: 16px;
    display: grid;
    gap: 10px;
    z-index: 99;
}

.toast {
    background: #111827;
    color: #fff;
    padding: 10px 12px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    font-size: 14px;
    transform: translateY(8px);
    opacity: 0;
    transition: transform var(--transition), opacity var(--transition);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.ok {
    background: #065f46;
}

.toast.err {
    background: #7f1d1d;
}

/* Success overlay */
.done-overlay {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, .35);
    backdrop-filter: blur(2px);
}

.done-card {
    background: #fff;
    color: var(--ink);
    border-radius: 16px;
    padding: 22px 28px;
    box-shadow: var(--shadow);
    text-align: center;
}

.check {
    width: 60px;
    height: 60px;
    display: block;
    margin: 0 auto 6px;
}

.check .ring {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 2;
}

.check .tick {
    fill: none;
    stroke: var(--ok);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 36 100;
    stroke-dashoffset: 36;
    animation: tick var(--transition) forwards;
}

@keyframes tick {
    to {
        stroke-dashoffset: 0;
    }
}

/* Utilities */
.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.callout {
    display: grid;
    gap: 10px;
}

[hidden] {
    display: none !important;
}

.hidden {
    display: none !important;
}

/* Footer (unchanged) */
.footer-basic {
    padding: 40px 0;
    color: #f4f5f5;
    text-align: center;
}

.footer-basic li {
    padding: 0 10px;
}

.footer-basic ul a {
    color: inherit;
    text-decoration: none;
    opacity: .8;
}

.footer-basic ul a:hover {
    opacity: 1;
}

.footer-basic > a {
    font-size: 24px;
    width: 40px;
    height: 40px;
    line-height: 40px;
    display: inline-block;
    text-align: center;
    border-radius: 50%;
    border: 1px solid #ccc;
    margin: 0 8px;
    color: inherit;
    opacity: .75;
}

.footer-basic .copyright {
    margin-top: 15px;
    font-size: 13px;
    color: #aaa;
    margin-bottom: 0;
}