/* ============================================================
   CalReserveAgent — "Golden State" Theme
   California beaches, sunsets, mountains, RV life
   ============================================================ */

:root {
    /* Pacific & Sky */
    --pacific-deep:     #0c3547;
    --pacific:          #14536e;
    --pacific-mid:      #1a6b8a;
    --pacific-light:    #3a9fbf;
    --sky-light:        #b8dce8;
    --sky-wash:         #e4f1f6;

    /* Sunset & Golden */
    --sunset-gold:      #e8932f;
    --sunset-amber:     #f0a848;
    --sunset-peach:     #f4c17a;
    --sunset-red:       #d4622a;

    /* Sand & Earth */
    --sand:             #faf5eb;
    --sand-warm:        #f0e8d8;
    --sand-dark:        #d9cfba;
    --driftwood:        #8b7d6b;
    --earth:            #6b5a48;
    --redwood:          #5c3324;

    /* Greens */
    --sage:             #7a9a6d;
    --coastal-green:    #3d7a5a;

    /* Neutrals */
    --charcoal:         #2a2d2e;
    --slate:            #4a4f52;
    --fog:              #9a9590;
    --mist:             #c8c2b8;

    /* Semantic */
    --success:          #3d7a5a;
    --success-light:    #e6f2eb;
    --warning:          #e8932f;
    --warning-light:    #fef4e6;
    --danger:           #c0392b;
    --danger-light:     #fce8e6;
    --info:             #1a6b8a;
    --info-light:       #e4f1f6;

    /* Typography */
    --font-display:     'Outfit', sans-serif;
    --font-body:        'Nunito', sans-serif;

    /* Spacing */
    --radius-sm:        6px;
    --radius-md:        10px;
    --radius-lg:        16px;

    /* Shadows */
    --shadow-sm:        0 1px 3px rgba(12, 53, 71, 0.08);
    --shadow-md:        0 4px 12px rgba(12, 53, 71, 0.1);
    --shadow-lg:        0 8px 30px rgba(12, 53, 71, 0.12);
    --shadow-glow:      0 0 20px rgba(232, 147, 47, 0.15);
}

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

html {
    scroll-behavior: smooth;
}

html, body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--charcoal);
    background: var(--sand);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

#app {
    min-height: 100vh;
}

/* ---- Loading Screen ---- */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(175deg, var(--pacific-deep) 0%, var(--pacific) 40%, var(--sunset-gold) 85%, var(--sunset-peach) 100%);
}

.loading-icon {
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

.loading-text {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 1.25rem;
    letter-spacing: 0.04em;
    opacity: 0;
    animation: fadeIn 0.5s 0.6s ease forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* ---- Error UI ---- */
#blazor-error-ui {
    font-family: var(--font-body);
    background: var(--warning-light);
    border-top: 3px solid var(--sunset-gold);
    bottom: 0;
    box-shadow: var(--shadow-md);
    display: none;
    left: 0;
    padding: 0.75rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 9999;
    color: var(--charcoal);
}

#blazor-error-ui .reload {
    color: var(--pacific-mid);
    font-weight: 600;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 0.6rem;
    color: var(--fog);
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--pacific-deep);
    line-height: 1.25;
    margin: 0 0 0.75rem 0;
    outline: none;
}

h1 {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.45rem;
    font-weight: 700;
}

h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--pacific);
}

h4, h5, h6 {
    font-size: 1rem;
    font-weight: 600;
}

p {
    margin: 0 0 1rem 0;
}

a {
    color: var(--pacific-mid);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--sunset-gold);
}

code {
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.85em;
    background: var(--sand-warm);
    color: var(--pacific-deep);
    padding: 0.15em 0.45em;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

hr {
    border: none;
    border-top: 2px solid var(--sand-warm);
    margin: 2rem 0;
}

strong {
    font-weight: 700;
}

/* ---- Buttons ---- */
.btn {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    line-height: 1.4;
    letter-spacing: 0.01em;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--sunset-gold), var(--sunset-red));
    color: #fff;
    border-color: transparent;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--sunset-amber), var(--sunset-gold));
    color: #fff;
}

.btn-secondary {
    background: var(--sand-warm);
    color: var(--slate);
    border-color: var(--sand-dark);
}

.btn-secondary:hover {
    background: var(--sand-dark);
    color: var(--charcoal);
}

.btn-success {
    background: var(--coastal-green);
    color: #fff;
}

.btn-success:hover {
    background: var(--sage);
    color: #fff;
}

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

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

.btn-outline-secondary {
    background: transparent;
    color: var(--driftwood);
    border-color: var(--mist);
}

.btn-outline-secondary:hover {
    background: var(--sand-warm);
    color: var(--charcoal);
}

.btn-outline-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}

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

.btn-sm {
    font-size: 0.8rem;
    padding: 0.3rem 0.85rem;
}

/* ---- Tables ---- */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.table thead th {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--driftwood);
    background: var(--sand-warm);
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--sand-dark);
    text-align: left;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--sand-warm);
    font-size: 0.9rem;
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: var(--sand);
}

.table-sm thead th {
    padding: 0.5rem 0.65rem;
    font-size: 0.75rem;
}

.table-sm tbody td {
    padding: 0.4rem 0.65rem;
    font-size: 0.82rem;
}

.table-bordered {
    border: 1px solid var(--sand-dark);
}

.table-bordered th,
.table-bordered td {
    border: 1px solid var(--sand-warm);
}

/* ---- Badges ---- */
.badge {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25em 0.65em;
    border-radius: 50px;
    display: inline-block;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-primary {
    background: var(--info-light);
    color: var(--pacific);
}

.badge-success {
    background: var(--success-light);
    color: var(--coastal-green);
}

.badge-warning {
    background: var(--warning-light);
    color: #b37318;
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-secondary {
    background: var(--sand-warm);
    color: var(--driftwood);
}

.badge-info {
    background: var(--info-light);
    color: var(--pacific-mid);
}

.badge-dark {
    background: var(--charcoal);
    color: #fff;
}

.badge-light {
    background: var(--sand-warm);
    color: var(--fog);
}

/* ---- Alerts ---- */
.alert {
    font-size: 0.9rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.alert-info {
    background: var(--info-light);
    border-color: var(--sky-light);
    color: var(--pacific);
}

.alert-success {
    background: var(--success-light);
    border-color: #b8d8c7;
    color: #2a5c40;
}

.alert-warning {
    background: var(--warning-light);
    border-color: var(--sunset-peach);
    color: #8a5c10;
}

.alert-danger {
    background: var(--danger-light);
    border-color: #edb8b4;
    color: #8a2218;
}

.alert-link {
    font-weight: 700;
    color: inherit;
    text-decoration: underline;
}

/* ---- Forms ---- */
.form-label {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--slate);
    display: block;
    margin-bottom: 0.35rem;
}

.form-control,
.form-select {
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 0.55rem 0.85rem;
    border: 2px solid var(--sand-dark);
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--charcoal);
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
    line-height: 1.4;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--pacific-light);
    box-shadow: 0 0 0 3px rgba(58, 159, 191, 0.15);
}

.form-control:disabled,
.form-control[readonly] {
    background: var(--sand);
    color: var(--driftwood);
    cursor: not-allowed;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-text {
    font-size: 0.8rem;
    color: var(--fog);
    margin-top: 0.25rem;
}

input[type="radio"],
input[type="checkbox"] {
    accent-color: var(--sunset-gold);
}

/* ---- Cards ---- */
.card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--sand-warm);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-body {
    padding: 1.5rem;
}

.card-header {
    font-family: var(--font-display);
    font-weight: 600;
    padding: 1rem 1.5rem;
    background: var(--sand);
    border-bottom: 1px solid var(--sand-warm);
}

/* ---- Description list (detail pages) ---- */
dl.row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1.5rem;
    margin: 0 0 1.5rem 0;
}

dl.row dt {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--driftwood);
    padding: 0.35rem 0;
    white-space: nowrap;
}

dl.row dd {
    padding: 0.35rem 0;
    margin: 0;
    font-size: 0.92rem;
    color: var(--charcoal);
}

/* ---- Utility classes ---- */
.text-muted {
    color: var(--fog) !important;
}

.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.me-1 { margin-right: 0.25rem; }
.me-2 { margin-right: 0.5rem; }
.ms-3 { margin-left: 1rem; }
.px-4 { padding-left: 1.5rem; padding-right: 1.5rem; }

.row {
    display: flex;
    flex-wrap: wrap;
}

.col-sm-3 { flex: 0 0 25%; }
.col-sm-9 { flex: 0 0 75%; }

/* ---- Availability Grid overrides ---- */
.availability-grid .table {
    font-size: 0.82rem;
}

.availability-grid .badge {
    font-size: 0.65rem;
    padding: 0.2em 0.5em;
}

/* ---- Draggable list ---- */
.draggable-item {
    background: #fff;
    border: 1px solid var(--sand-dark);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.35rem;
    cursor: grab;
    transition: box-shadow 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.draggable-item:hover {
    border-color: var(--pacific-light);
    box-shadow: var(--shadow-sm);
}

.draggable-item:active {
    cursor: grabbing;
}

.draggable-item.dragging {
    opacity: 0.5;
    border-color: var(--sunset-gold);
    box-shadow: var(--shadow-glow);
}

/* ---- Campground selector dropdown ---- */
.search-results {
    background: #fff;
    border: 1px solid var(--sand-dark);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 280px;
    overflow-y: auto;
    margin-top: 0.25rem;
}

.search-results .result-item {
    padding: 0.6rem 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--sand);
}

.search-results .result-item:hover {
    background: var(--info-light);
}

.search-results .result-item:last-child {
    border-bottom: none;
}

/* ---- Wizard steps ---- */
.wizard-steps {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
    position: relative;
}

.wizard-step {
    flex: 1;
    text-align: center;
    padding: 0.75rem 0.5rem;
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--mist);
    position: relative;
    background: var(--sand-warm);
    border-bottom: 3px solid var(--sand-dark);
    transition: all 0.25s ease;
}

.wizard-step.active {
    color: var(--pacific-deep);
    background: #fff;
    border-bottom-color: var(--sunset-gold);
}

.wizard-step.completed {
    color: var(--coastal-green);
    background: var(--success-light);
    border-bottom-color: var(--coastal-green);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--sand);
}

::-webkit-scrollbar-thumb {
    background: var(--mist);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--driftwood);
}

/* ---- Selection ---- */
::selection {
    background: var(--sunset-peach);
    color: var(--charcoal);
}

/* ---- Animations ---- */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ─── Lock countdown ───────────────────────────────────────────────── */

.lock-countdown {
    font-size: 0.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--info-text, #1a6b8a);
    margin-top: 0.25rem;
}

.lock-countdown-urgent {
    color: var(--danger-text, #c0392b);
    animation: pulse 1s ease-in-out infinite;
}

.lock-countdown-expired {
    color: var(--danger-text, #c0392b);
    font-weight: 700;
}

.lock-site-name {
    font-size: 0.75rem;
    color: var(--fog);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Subtle page-enter animation */
.content > * {
    animation: slideUp 0.35s ease-out;
}

/* ---- Date Range Calendar ---- */
.drc {
    background: white;
    border: 1px solid var(--sand-dark);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: inline-block;
    user-select: none;
}

.drc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 0.5rem;
}

.drc-month-label {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    color: var(--pacific-deep);
    flex: 1;
    text-align: center;
}

.drc-nav {
    background: none;
    border: 1px solid var(--sand-dark);
    border-radius: var(--radius-sm);
    width: 2rem;
    height: 2rem;
    font-size: 1.25rem;
    color: var(--pacific-mid);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.drc-nav:hover {
    background: var(--sky-wash);
    border-color: var(--pacific-light);
    color: var(--pacific-deep);
}

.drc-months {
    display: flex;
    gap: 1.5rem;
}

.drc-month {
    flex: 1;
    min-width: 0;
}

.drc-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fog);
    margin-bottom: 0.35rem;
    padding: 0 0.15rem;
}

.drc-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.drc-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--charcoal);
    cursor: pointer;
    transition: all 0.12s ease;
    padding: 0;
    min-width: 2.2rem;
    min-height: 2.2rem;
}

.drc-day:hover:not(.drc-past):not(.drc-empty):not(.drc-start):not(.drc-end) {
    background: var(--sky-wash);
    color: var(--pacific-deep);
}

.drc-empty {
    cursor: default;
}

.drc-past {
    color: var(--mist);
    cursor: not-allowed;
}

.drc-today {
    font-weight: 800;
    color: var(--sunset-gold);
}

.drc-start,
.drc-end {
    background: var(--pacific-mid);
    color: white;
    font-weight: 700;
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 4px rgba(20, 83, 110, 0.3);
}

.drc-start:hover,
.drc-end:hover {
    background: var(--pacific-deep);
    color: white;
}

.drc-in-range {
    background: var(--sky-wash);
    color: var(--pacific-deep);
    border-radius: 2px;
}

.drc-preview {
    background: var(--sky-wash);
    color: var(--pacific-mid);
    border-radius: 2px;
    opacity: 0.7;
}

.drc-summary {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--sand-dark);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--pacific);
    text-align: center;
}

.drc-hint {
    color: var(--fog);
    font-weight: 400;
}

@media (max-width: 600px) {
    .drc-months {
        flex-direction: column;
        gap: 1rem;
    }
    .drc {
        padding: 1rem;
    }
}
