/* Apple Roofing Scheduling — global styles
   Phase 4: Navy/Gold/Cream design tokens applied throughout booking flow. */

/* ─── Design Tokens — Apple Roofing brand (from appleroof.com) ─────────────── */
:root {
    /* Core brand */
    --color-charcoal:       #414042;   /* nav / header / footer bg */
    --color-charcoal-light: #5A5A5C;   /* hover state */
    --color-red:            #E21D38;   /* primary CTA buttons */
    --color-red-dark:       #C01830;   /* button hover */
    --color-green:          #8DC63F;   /* secondary / success accent */
    --color-light-gray:     #D1D3D4;   /* section/divider background */
    --color-off-white:      #F5F5F5;   /* page background */
    --color-muted:          #6B6B6D;   /* secondary text */
    --color-text:           #333333;   /* body copy */

    /* Aliases used throughout */
    --color-navy:        var(--color-charcoal);
    --color-navy-light:  var(--color-charcoal-light);
    --color-gold:        var(--color-red);
    --color-gold-light:  #fff;
    --color-cream:       var(--color-off-white);
    --color-cream-dark:  var(--color-light-gray);
    --color-success:     var(--color-green);
}

html, body {
    font-family: 'DM Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    height: 100%;
}

h1 {
    color: var(--color-navy);
}

.content {
    padding-left: 1rem;
    padding-right: 1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
    font-size: 0.85rem;
}

/* ─── Admin Layout ────────────────────────────────────────────────────────── */

.admin-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.admin-sidebar {
    width: 220px;
    min-width: 220px;
    background: #1a1a2e;
    color: #ccc;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.admin-sidebar-brand {
    padding: 18px 16px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: var(--color-navy);
    letter-spacing: 0.02em;
}

.admin-sidebar-brand span {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.85;
}

.admin-sidebar nav {
    flex: 1;
    padding: 12px 0;
}

.admin-sidebar nav a {
    display: block;
    padding: 9px 20px;
    color: #ccc;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.admin-sidebar nav a:hover,
.admin-sidebar nav a.active {
    background: #2a2a4a;
    color: #fff;
}

.admin-sidebar nav .nav-section {
    padding: 14px 20px 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #666;
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-topbar {
    height: 52px;
    background: var(--color-navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 24px;
    gap: 16px;
    flex-shrink: 0;
}

.admin-topbar .user-info {
    font-size: 0.875rem;
}

.admin-topbar a,
.admin-topbar button {
    color: #fff;
    text-decoration: none;
    font-size: 0.875rem;
    background: none;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 4px;
    padding: 4px 12px;
    cursor: pointer;
}

.admin-topbar a:hover,
.admin-topbar button:hover {
    background: rgba(255,255,255,0.15);
}

.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    background: #f5f5f7;
}

/* ─── Admin Page Utilities ─────────────────────────────────────────────────── */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--color-navy);
}

.card {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 20px 24px;
    margin-bottom: 20px;
}

.card h2 {
    font-size: 1rem;
    color: #444;
    margin: 0 0 6px;
}

.card .stat {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-navy);
}

/* ─── Dashboard Summary Cards ──────────────────────────────────────────────── */

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 18px 20px;
}

.summary-card h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #888;
    margin: 0 0 8px;
}

.summary-card .stat {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-navy);
}

.summary-card.warning .stat {
    color: #b45309;
}

/* ─── Data Tables ──────────────────────────────────────────────────────────── */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}

.admin-table th {
    background: #f0f0f5;
    padding: 10px 14px;
    text-align: left;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #555;
    border-bottom: 1px solid #e0e0e8;
}

.admin-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f5;
    font-size: 0.9rem;
    color: #333;
    vertical-align: middle;
}

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

.admin-table tr:hover td {
    background: #fafafa;
    cursor: pointer;
}

.admin-table tr.muted td {
    color: #aaa;
}

/* ─── Forms ────────────────────────────────────────────────────────────────── */

.admin-form {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 28px 32px;
    max-width: 640px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
    box-sizing: border-box;
    color: #333;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-gold);
    box-shadow: 0 0 0 2px rgba(200,169,110,0.18);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* ─── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    text-align: center;
    transition: opacity 0.15s;
}

.btn:hover {
    opacity: 0.85;
}

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

.btn-secondary {
    background: #e0e0e8;
    color: #333;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

.btn-danger {
    background: #e53935;
    color: #fff;
}

.btn-success {
    background: #26b050;
    color: #fff;
}

.btn-link {
    background: none;
    color: var(--color-navy);
    padding: 0;
    font-weight: 400;
    text-decoration: underline;
    cursor: pointer;
    border: none;
    font-size: inherit;
}

/* ─── Alerts ───────────────────────────────────────────────────────────────── */

.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 0.875rem;
}

.alert-error {
    background: #fff5f5;
    border: 1px solid #ffcccc;
    color: #991b1b;
}

.alert-success {
    background: #f0fff4;
    border: 1px solid #c6f6d5;
    color: #276749;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

/* ─── Capacity Grid ────────────────────────────────────────────────────────── */

.capacity-grid {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: auto;
}

.capacity-grid table {
    width: 100%;
    border-collapse: collapse;
}

.capacity-grid th, .capacity-grid td {
    padding: 10px 16px;
    border: 1px solid #e0e0e8;
    text-align: center;
    font-size: 0.875rem;
}

.capacity-grid th {
    background: #f0f0f5;
    font-weight: 600;
    color: #555;
}

.capacity-grid td:first-child {
    text-align: left;
    font-weight: 600;
    color: #333;
}

.capacity-grid input[type="number"] {
    width: 70px;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
    font-size: 0.9rem;
}

/* ─── Filters Bar ──────────────────────────────────────────────────────────── */

.filter-bar {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 16px 20px;
    margin-bottom: 16px;
}

.filter-bar .filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-bar label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-bar input,
.filter-bar select {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.875rem;
}

/* ─── Toggle Switch ────────────────────────────────────────────────────────── */

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc;
    border-radius: 22px;
    transition: 0.2s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
}

input:checked + .toggle-slider {
    background: #26b050;
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* ─── Badge ────────────────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-green { background: #d1fae5; color: #065f46; }
.badge-red   { background: #fee2e2; color: #991b1b; }
.badge-gray  { background: #f3f4f6; color: #6b7280; }
.badge-amber { background: #fef3c7; color: #92400e; }

/* ============================================================
   BOOKING FLOW — mobile-first, public-facing
   Navy / Gold / Cream design system
   ============================================================ */

/* Shell */
.booking-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--color-cream);
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Header */
.booking-header {
    background: var(--color-navy);
    color: #fff;
    padding: 16px 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.booking-header-inner {
    max-width: 640px;
    margin: 0 auto;
}
.booking-brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.booking-brand-name {
    font-family: 'DM Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: .02em;
    color: #fff;
}
.booking-brand-tagline {
    font-size: 0.8rem;
    opacity: .85;
    color: var(--color-light-gray);
}

/* Main content */
.booking-main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 24px 16px;
}
.booking-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(15,30,46,.10);
    padding: 28px 24px;
    width: 100%;
    max-width: 580px;
    border-top: 4px solid var(--color-gold);
}

/* Footer */
.booking-footer {
    text-align: center;
    padding: 16px;
    font-size: 0.8rem;
    color: var(--color-muted);
}
.booking-footer a {
    color: var(--color-gold);
    text-decoration: none;
    font-weight: 600;
}

/* Step heading */
.booking-step-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-charcoal);
    margin: 0 0 6px;
}
.booking-step-subtitle {
    font-size: 0.9rem;
    color: var(--color-muted);
    margin: 0 0 24px;
}

/* Form inputs */
.booking-field {
    margin-bottom: 18px;
}
.booking-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-navy);
    margin-bottom: 6px;
}
.booking-field input,
.booking-field select {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    color: var(--color-text);
    background: #fff;
}
.booking-field input:focus,
.booking-field select:focus {
    outline: none;
    border-color: var(--color-gold);
    box-shadow: 0 0 0 3px rgba(200,169,110,.20);
}
.booking-field .field-error {
    font-size: 0.78rem;
    color: #dc2626;
    margin-top: 4px;
}
.booking-field .field-hint {
    font-size: 0.78rem;
    color: var(--color-muted);
    margin-top: 4px;
}

/* Actions row */
.booking-actions {
    margin-top: 8px;
}

/* Primary button */
.btn-booking-primary {
    display: block;
    width: 100%;
    padding: 14px;
    background: var(--color-navy);
    color: var(--color-gold-light);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    letter-spacing: .01em;
}
.btn-booking-primary:hover { background: var(--color-navy-light); }
.btn-booking-primary:disabled { background: #e5e7eb; color: #9ca3af; cursor: default; }

/* Secondary / back link */
.btn-booking-back {
    background: none;
    border: none;
    color: var(--color-muted);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    margin-top: 14px;
    display: inline-block;
}

/* Calendar grid */
.booking-calendar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
@media (min-width: 480px) {
    .booking-calendar { grid-template-columns: repeat(3, 1fr); }
}
.booking-day {
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    user-select: none;
}
.booking-day:hover:not(.booking-day--disabled) {
    border-color: var(--color-gold);
    background: var(--color-cream);
}
.booking-day--selected {
    border-color: var(--color-navy);
    background: var(--color-navy);
    color: #fff;
}
.booking-day--selected .day-avail { color: rgba(255,255,255,.75); }
.booking-day--disabled {
    opacity: .45;
    cursor: default;
}
.day-name { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.day-date { font-size: 1.4rem; font-weight: 700; line-height: 1.1; margin: 4px 0; }
.day-avail { font-size: 0.72rem; color: var(--color-muted); }

/* Time block cards */
.booking-blocks {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}
.booking-block {
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.booking-block:hover:not(.booking-block--disabled) {
    border-color: var(--color-gold);
    background: var(--color-cream);
}
.booking-block--selected {
    border-color: var(--color-navy);
    background: var(--color-navy);
    color: #fff;
}
.booking-block--selected .block-slots { color: rgba(255,255,255,.75); }
.booking-block--disabled {
    opacity: .45;
    cursor: default;
}
.block-label { font-size: 1rem; font-weight: 600; }
.block-time { font-size: 0.8rem; opacity: .75; }
.block-slots { font-size: 0.8rem; color: var(--color-muted); font-weight: 500; }

/* ─── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-box {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

/* Confirmation */
.booking-confirmation-icon {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 12px;
}
.booking-ref {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-red);
    text-align: center;
    letter-spacing: 2px;
    margin-bottom: 20px;
}
.booking-summary-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 24px;
}
.booking-summary-item label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--color-muted);
    display: block;
    margin-bottom: 2px;
}
.booking-summary-item span {
    font-size: 0.95rem;
    color: var(--color-text);
    font-weight: 500;
}
.booking-reschedule-note {
    background: var(--color-cream);
    border-left: 3px solid var(--color-gold);
    padding: 12px 14px;
    border-radius: 0 8px 8px 0;
    font-size: 0.85rem;
    color: var(--color-navy);
    margin-top: 4px;
}

/* Out-of-zone info box */
.booking-outofzone-notice {
    background: #fef9c3;
    border: 1.5px solid #fde047;
    border-radius: 8px;
    padding: 16px;
    font-size: 0.9rem;
    color: #713f12;
    margin-bottom: 24px;
}

/* Error / alert */
.booking-alert {
    background: #fee2e2;
    border: 1.5px solid #fca5a5;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 0.88rem;
    color: #991b1b;
    margin-bottom: 16px;
}

/* Loading spinner */
@keyframes booking-spin {
    to { transform: rotate(360deg); }
}
.booking-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 0;
    gap: 12px;
    color: var(--color-muted);
    font-size: 0.9rem;
}
.booking-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--color-cream-dark);
    border-top-color: var(--color-gold);
    border-radius: 50%;
    animation: booking-spin 0.7s linear infinite;
}

/* Divider */
.booking-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 20px 0;
}

/* ─── Confirm-Info page specific ────────────────────────────────────────────── */

.confirm-claim-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--color-navy);
    color: var(--color-gold-light);
    border-radius: 20px;
    padding: 6px 16px;
    margin-bottom: 18px;
    font-size: 0.85rem;
}
.confirm-claim-label {
    font-weight: 400;
    opacity: .8;
}
.confirm-claim-number {
    font-weight: 700;
    letter-spacing: .04em;
}

.confirm-address-block {
    background: var(--color-cream);
    border: 1px solid var(--color-cream-dark);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 22px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.confirm-address-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--color-muted);
}
.confirm-address-value {
    font-size: 0.95rem;
    color: var(--color-navy);
    font-weight: 500;
}

.confirm-zone-warning {
    background: #fffbeb;
    border: 1.5px solid #fde68a;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 18px;
    font-size: 0.88rem;
    color: #92400e;
}
.confirm-zone-warning p {
    margin: 0 0 12px;
}

@media (min-width: 540px) {
    .booking-card { padding: 36px 40px; }
    .booking-summary-grid { grid-template-columns: 1fr 1fr; }
}
