/* Pretendard webfont */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

/* =========================================================
   1. Theme and base
   ========================================================= */
:root {
    color-scheme: light;
    --blue: #2563eb;
    --dark: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --bg: #f3f4f6;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--dark);
    font-family: "Pretendard Variable", Pretendard, -apple-system,
        BlinkMacSystemFont, system-ui, "Noto Sans KR", "Segoe UI", sans-serif;
}

/* =========================================================
   2. Intro splash and transition loader
   ========================================================= */
.intro-splash,
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    background: #f3f6fb;
    opacity: 0;
    pointer-events: none;
}

.intro-splash.show {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.intro-splash.leave {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.intro-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.mycar-mark {
    display: grid;
    width: 86px;
    height: 86px;
    color: #fff;
    font-size: 40px;
    font-weight: 850;
    place-items: center;
    background: linear-gradient(145deg, #1d4ed8, #3b82f6);
    border-radius: 25px 25px 25px 8px;
    box-shadow: 0 18px 38px rgba(37, 99, 235, 0.28);
    animation: mark-pop 0.55s ease both;
}

.intro-title {
    color: #172554;
    font-size: clamp(25px, 5vw, 42px);
    font-weight: 800;
    letter-spacing: -0.04em;
    white-space: nowrap;
    animation: title-slide 0.72s 0.18s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.page-loader {
    z-index: 900;
    flex-direction: column;
    gap: 13px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(4px);
    transition: opacity 0.14s ease;
}

.page-loader.show {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.idle-warning {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 850;
    width: min(calc(100% - 32px), 560px);
    padding: 13px 18px;
    color: #fff;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.45;
    text-align: center;
    visibility: hidden;
    background: rgba(30, 41, 59, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 11px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.2);
    opacity: 0;
    transform: translate(-50%, -10px);
    transition: opacity 0.22s ease, transform 0.22s ease,
        visibility 0.22s ease;
    backdrop-filter: blur(7px);
}

.idle-warning.show {
    visibility: visible;
    opacity: 1;
    transform: translate(-50%, 0);
}

.page-loader p {
    margin: 0;
    color: #4b5563;
    font-size: 13px;
    font-weight: 650;
}

.loader-spinner {
    width: 38px;
    height: 38px;
    border: 4px solid #dbeafe;
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: loader-spin 0.7s linear infinite;
}

@keyframes mark-pop {
    from {
        opacity: 0;
        transform: scale(0.68) rotate(-7deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

@keyframes title-slide {
    from {
        opacity: 0;
        transform: translateX(90px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes loader-spin {
    to {
        transform: rotate(360deg);
    }
}

/* =========================================================
   3. Shared page layout
   ========================================================= */
.landing-page {
    min-height: 100vh;
    padding: 32px 16px;
    background:
        radial-gradient(circle at 50% 8%, rgba(147, 197, 253, 0.35), transparent 32%),
        #f3f6fb;
}

.landing-shell {
    display: flex;
    flex-direction: column;
    width: min(100%, 520px);
    min-height: calc(100vh - 64px);
    padding: 56px 34px 24px;
    margin: 0 auto;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 26px;
    box-shadow: 0 24px 65px rgba(15, 23, 42, 0.13);
}

.landing-hero {
    text-align: center;
}

.landing-mark {
    margin: 0 auto 22px;
}

.landing-eyebrow {
    margin: 0 0 9px;
    color: var(--blue);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
}

.landing-hero h1 {
    margin: 0;
    color: #172554;
    font-size: clamp(31px, 7vw, 42px);
    line-height: 1.18;
    letter-spacing: -0.045em;
    animation: title-slide 0.72s 0.12s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.landing-description {
    margin: 17px 0 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.65;
}

.landing-actions {
    display: grid;
    gap: 11px;
    margin-top: 42px;
}

.landing-action {
    display: grid;
    grid-template-columns: 43px 1fr auto;
    align-items: center;
    gap: 13px;
    min-height: 82px;
    padding: 15px 17px;
    color: #1e293b;
    text-decoration: none;
    background: #fff;
    border: 1px solid #dbe3ed;
    border-radius: 15px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease,
        transform 0.18s ease;
}

.landing-action:hover {
    border-color: #93c5fd;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.09);
    transform: translateY(-2px);
}

.landing-action.primary {
    color: #fff;
    background: linear-gradient(125deg, #1d4ed8, #3b82f6);
    border-color: transparent;
}

.landing-action.primary:hover {
    border-color: transparent;
}

.landing-action .action-icon {
    display: grid;
    width: 43px;
    height: 43px;
    font-size: 22px;
    font-weight: 750;
    place-items: center;
    background: #eff6ff;
    border-radius: 12px;
}

.landing-action.primary .action-icon {
    color: #1d4ed8;
    background: #fff;
}

.landing-action strong,
.landing-action small {
    display: block;
}

.landing-action strong {
    margin-bottom: 4px;
    font-size: 17px;
}

.landing-action small {
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
}

.landing-action.primary small {
    color: #dbeafe;
}

.landing-action > b {
    font-size: 26px;
    font-weight: 400;
}

.landing-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 11px;
    margin-top: auto;
    padding-top: 36px;
}

.landing-footer p {
    margin: 0;
    color: #9ca3af;
    font-size: 11px;
}

.shell {
    width: min(100% - 28px, 520px);
    margin: 32px auto;
    overflow: hidden;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

.shell.wide {
    width: min(100% - 28px, 1100px);
}

header {
    padding: 24px;
    color: #fff;
    text-align: center;
    background: var(--blue);
}

header h1 {
    margin: 0;
    font-size: 24px;
}

main {
    padding: 24px;
}

.center {
    text-align: center;
}

.muted {
    color: var(--muted);
    font-size: 13px;
}

/* =========================================================
   4. Forms and buttons
   ========================================================= */
label {
    display: block;
    margin: 0 0 7px;
    font-size: 14px;
    font-weight: 700;
}

.input-hint {
    margin-left: 5px;
    color: var(--blue);
    font-size: 11px;
    font-weight: 600;
}

.district-booking-info {
    padding: 17px;
    margin: -3px 0 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 13px;
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.05);
}

.district-info-row {
    display: flex;
    align-items: flex-start;
    gap: 11px;
}

.district-info-row + .district-info-row {
    padding-top: 13px;
    margin-top: 13px;
    border-top: 1px solid #e2e8f0;
}

.district-info-icon {
    flex: 0 0 auto;
    font-size: 21px;
    line-height: 1.2;
}

.district-info-row strong {
    color: #1e293b;
    font-size: 14px;
}

.district-info-row p {
    margin: 4px 0 0;
    color: #334155;
    font-size: 14px;
    line-height: 1.45;
}

.district-info-row:first-child p {
    font-size: 16px;
    font-weight: 650;
}

.location-pending .district-info-row:first-child p {
    color: #64748b;
    font-style: italic;
}

.booking-count-row {
    align-items: center;
}

.booking-count-row p {
    margin: 0;
    color: #2563eb;
}

.booking-count-row span {
    color: #64748b;
    font-size: 12px;
}

.confirmation-warning {
    padding: 17px;
    margin-bottom: 20px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    border-left: 5px solid #f97316;
    border-radius: 12px;
}

.confirmation-warning-title {
    margin-bottom: 9px;
    color: #9a3412;
    font-size: 15px;
    font-weight: 800;
}

.confirmation-warning > p {
    margin: 0 0 13px;
    color: #7c2d12;
    font-size: 13px;
    line-height: 1.6;
}

.confirmation-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding-top: 12px;
    margin: 0;
    color: #431407;
    border-top: 1px solid #fed7aa;
}

.confirmation-check input {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    margin: 1px 0 0;
    accent-color: #ea580c;
}

.field {
    margin-bottom: 16px;
}

input,
select,
button {
    font: inherit;
}

input,
select {
    width: 100%;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 9px;
}

button,
.button {
    display: inline-block;
    padding: 13px 18px;
    color: #fff;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    background: var(--blue);
    border: 0;
    border-radius: 10px;
}

.button.block,
button.block {
    width: 100%;
}

.button.gray,
button.gray {
    background: #374151;
}

.button.red,
button.red {
    background: #dc2626;
}

.small-outline-button,
.footer-link {
    display: inline-flex;
    align-items: center;
    min-height: 31px;
    padding: 6px 11px;
    color: #4b5563;
    font-size: 12px;
    font-weight: 650;
    text-decoration: none;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 7px;
}

.page-bottom-actions {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

/* =========================================================
   5. Messages and cards
   ========================================================= */
.notice,
.card {
    padding: 16px;
    margin-bottom: 20px;
    background: #eff6ff;
    border: 1px solid #dbeafe;
    border-radius: 12px;
}

.card {
    background: #fff;
    border-color: var(--line);
}

.error,
.success {
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 9px;
}

.error {
    color: #b91c1c;
    background: #fef2f2;
}

.success {
    color: #047857;
    background: #ecfdf5;
}

.session-notice {
    padding: 12px 14px;
    margin-bottom: 16px;
    color: #92400e;
    font-size: 13px;
    line-height: 1.5;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 9px;
}

/* =========================================================
   6. Reservation steps
   ========================================================= */
.steps {
    display: flex;
    margin: 0 0 24px;
}

.step {
    position: relative;
    flex: 1;
    color: #9ca3af;
    font-size: 12px;
    text-align: center;
}

.step:not(:last-child)::after {
    position: absolute;
    top: 16px;
    left: 64%;
    z-index: 0;
    width: 72%;
    height: 2px;
    content: "";
    background: #e5e7eb;
}

.step b {
    position: relative;
    z-index: 1;
    display: block;
    width: 32px;
    height: 32px;
    margin: auto auto 6px;
    line-height: 32px;
    background: #e5e7eb;
    border-radius: 50%;
}

.step.on {
    color: var(--blue);
    font-weight: 700;
}

.step.on b {
    color: #fff;
    background: var(--blue);
}

.step.done:not(:last-child)::after {
    background: var(--blue);
}

.flow-panel {
    display: none;
}

.flow-panel.active {
    display: block;
    animation: fadein 0.22s ease;
}

.step-copy {
    margin: 0 0 20px;
    text-align: center;
}

.step-copy h2 {
    margin: 0 0 6px;
    font-size: 20px;
}

.step-copy p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.actions {
    display: flex;
    gap: 10px;
}

.actions > * {
    flex: 1;
}

@keyframes fadein {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* =========================================================
   7. Time slots and reservation summary
   ========================================================= */
.slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.slot {
    padding: 12px 4px;
    color: var(--blue);
    background: #fff;
    border: 2px solid #dbeafe;
}

.slot small {
    display: block;
    font-weight: 400;
}

.slot:disabled {
    color: #9ca3af;
    cursor: not-allowed;
    background: #f9fafb;
    border-color: #e5e7eb;
}

.summary {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

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

.summary dd {
    margin: 0;
    font-weight: 700;
    text-align: right;
}

/* =========================================================
   8. Admin tables and layout
   ========================================================= */
.dashboard-summary {
    margin-bottom: 22px;
}

.total-stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 118px;
    padding: 24px 28px;
    margin-bottom: 12px;
    color: #fff;
    background: linear-gradient(125deg, #1d4ed8, #3b82f6);
    border-radius: 18px;
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.2);
}

.stat-eyebrow {
    display: block;
    margin-bottom: 5px;
    color: #bfdbfe;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.total-stat-card h2 {
    margin: 0;
    font-size: 20px;
}

.total-stat-card > strong {
    font-size: 43px;
    line-height: 1;
}

.total-stat-card small,
.district-stat-card small {
    margin-left: 3px;
    font-size: 13px;
    font-weight: 650;
}

.district-stat-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 9px;
}

.district-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 78px;
    padding: 10px 6px;
    color: #64748b;
    text-decoration: none;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease,
        transform 0.15s ease;
}

.district-stat-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 7px 16px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
}

.district-stat-card span {
    margin-bottom: 7px;
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}

.district-stat-card strong {
    color: #94a3b8;
    font-size: 21px;
    line-height: 1;
}

.district-stat-card.has-booking {
    color: #1e40af;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.district-stat-card.has-booking strong {
    color: var(--blue);
}

.booking-status-field {
    padding: 0;
    margin: 20px 0;
    border: 0;
}

.booking-status-field legend {
    margin-bottom: 9px;
    font-size: 14px;
    font-weight: 700;
}

.booking-status-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

.status-radio-card {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    min-height: 83px;
    padding: 13px;
    margin: 0;
    cursor: pointer;
    background: #fff;
    border: 1px solid #dbe2ea;
    border-radius: 11px;
}

.status-radio-card input {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    margin: 2px 0 0;
    accent-color: var(--blue);
}

.status-radio-card span {
    display: block;
}

.status-radio-card strong,
.status-radio-card small {
    display: block;
}

.status-radio-card strong {
    margin-bottom: 4px;
    color: #334155;
    font-size: 14px;
}

.status-radio-card small {
    color: #64748b;
    font-size: 11px;
    font-weight: 450;
    line-height: 1.45;
}

.status-radio-card.open:has(input:checked) {
    background: #eff6ff;
    border-color: #60a5fa;
    box-shadow: 0 0 0 1px #60a5fa;
}

.status-radio-card.closed:has(input:checked) {
    background: #fff7ed;
    border-color: #fb923c;
    box-shadow: 0 0 0 1px #fb923c;
}

.status-radio-card.open:has(input:checked) strong {
    color: #1d4ed8;
}

.status-radio-card.closed:has(input:checked) strong {
    color: #c2410c;
}

.sms-settings-box {
    padding: 17px;
    margin: 22px 0;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 13px;
}

.sms-settings-box h3 {
    margin: 0 0 5px;
}

.sms-settings-box .booking-status-options {
    margin: 14px 0;
}

.sms-balance-result {
    margin-top: 4px;
}

.sms-log-card {
    margin-top: 18px;
}

.sms-log-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.sms-log-heading h2 {
    margin: 0;
}

.sms-log-heading span {
    color: #64748b;
    font-size: 12px;
}

.sms-status {
    display: inline-block;
    padding: 3px 7px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
}

.sms-status.requested {
    color: #047857;
    background: #d1fae5;
}

.sms-status.failed {
    color: #b91c1c;
    background: #fee2e2;
}

.topnav {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 16px;
}

.tablewrap {
    overflow: auto;
}

table {
    width: 100%;
    font-size: 14px;
    border-collapse: collapse;
}

th,
td {
    padding: 10px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--line);
}

th {
    background: #f9fafb;
}

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

/* =========================================================
   9. User page footer
   ========================================================= */
.site-footer {
    padding: 15px 20px 17px;
    text-align: center;
    background: #fafafa;
    border-top: 1px solid var(--line);
}

.footer-tools {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.admin-shortcut {
    justify-content: center;
    width: 31px;
    padding: 6px;
}

.admin-shortcut img {
    display: block;
    width: 16px;
    height: 16px;
}

.copyright {
    margin: 0;
    color: #9ca3af;
    font-size: 11px;
    letter-spacing: 0.01em;
}

/* =========================================================
   10. Mobile and reduced motion
   ========================================================= */
@media (max-width: 700px) {
    .landing-page {
        padding: 14px;
    }

    .landing-shell {
        min-height: calc(100vh - 28px);
        padding: 42px 18px 20px;
        border-radius: 22px;
    }

    .landing-actions {
        margin-top: 34px;
    }

    .shell {
        margin: 14px auto;
    }

    main {
        padding: 18px;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .total-stat-card {
        min-height: 105px;
        padding: 20px;
    }

    .total-stat-card > strong {
        font-size: 36px;
    }

    .district-stat-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .booking-status-options {
        grid-template-columns: 1fr;
    }

    .slots {
        grid-template-columns: repeat(2, 1fr);
    }

    .step:not(:last-child)::after {
        left: 68%;
        width: 64%;
    }

    .intro-title {
        font-size: 25px;
    }

    /* Mobile administrator layout */
    .admin-page {
        background: #eef2f7;
    }

    .admin-shell {
        width: calc(100% - 20px);
        margin: 10px auto;
        border-radius: 16px;
    }

    .admin-shell header {
        padding: 19px 15px;
    }

    .admin-shell header h1 {
        font-size: 21px;
    }

    .admin-main {
        padding: 14px;
    }

    .admin-main .topnav {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .admin-main .topnav .button {
        width: 100%;
        padding: 11px 8px;
        font-size: 13px;
    }

    .admin-main .card {
        padding: 15px;
        border-radius: 13px;
    }

    .admin-main .card h2 {
        font-size: 19px;
    }

    .district-stat-card {
        min-height: 70px;
        padding: 8px 4px;
    }

    .district-stat-card span {
        font-size: 11px;
    }

    .district-stat-card strong {
        font-size: 19px;
    }

    .tablewrap {
        overflow: visible;
        border: 0;
    }

    .reservation-admin-table,
    .reservation-admin-table tbody,
    .reservation-admin-table tr,
    .reservation-admin-table td {
        display: block;
        width: 100%;
    }

    .reservation-admin-table thead {
        display: none;
    }

    .reservation-admin-table tr {
        padding: 12px;
        margin-top: 10px;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 11px;
        box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04);
    }

    .reservation-admin-table td {
        display: grid;
        grid-template-columns: 92px minmax(0, 1fr);
        gap: 10px;
        padding: 7px 0;
        text-align: right;
        white-space: normal;
        border: 0;
    }

    .reservation-admin-table td::before {
        color: #64748b;
        font-size: 12px;
        font-weight: 700;
        text-align: left;
        content: attr(data-label);
    }

    .reservation-admin-table .reservation-actions {
        display: block;
        padding-top: 10px;
        margin-top: 5px;
        border-top: 1px solid #e2e8f0;
    }

    .reservation-admin-table .reservation-actions::before {
        display: none;
    }

    .reservation-admin-table .reservation-actions button {
        width: 100%;
        padding: 10px;
        font-size: 13px;
    }

    .reservation-admin-table .empty-row td {
        display: block;
        text-align: center;
    }

    .reservation-admin-table .empty-row td::before {
        display: none;
    }
}

@media (min-width: 701px) and (max-width: 980px) {
    .district-stat-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
