/* ===============================
   GLOBAL RESET & BASE STYLES
   =============================== */

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

:root {
    --bg: #f3f5fb;
    --bg-elevated: rgba(255,255,255,0.85);
    --primary: #1a73e8;
    --primary-dark: #0b57d0;
    --accent: #34a853;
    --text-main: #1f2933;
    --text-muted: #6b7280;
    --border-subtle: rgba(15,23,42,0.08);
    --radius-lg: 14px;
    --radius-md: 8px;
    --shadow-soft: 0 8px 24px rgba(15,23,42,0.12);
    --shadow-hover: 0 12px 30px rgba(15,23,42,0.18);
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", Arial, sans-serif;
    background: radial-gradient(circle at top left, #e0ebff 0, #f5f7fb 40%, #eef2ff 100%);
    color: var(--text-main);
    line-height: 1.5;
}

/* ===============================
   LAYOUT
   =============================== */

#view {
    padding: 28px 20px 40px;
    max-width: 980px;
    margin: 0 auto;
    animation: fadeIn 0.35s ease;
}

/* ===============================
   HEADER & NAVIGATION
   =============================== */

header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(14px);
    background: linear-gradient(120deg, rgba(26,115,232,0.9), rgba(11,87,208,0.9));
    border-bottom: 1px solid rgba(255,255,255,0.18);
    color: white;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 650;
    letter-spacing: 0.02em;
}

nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 999px;
    opacity: 0.9;
    transition: background 0.22s ease, opacity 0.18s ease, transform 0.18s ease;
}

nav a:hover {
    background: rgba(255,255,255,0.18);
    opacity: 1;
    transform: translateY(-1px);
}

/* ===============================
   BUTTONS
   =============================== */

button {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 6px 16px rgba(26,115,232,0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(26,115,232,0.45);
    filter: brightness(1.03);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(26,115,232,0.35);
}

button.secondary {
    background: rgba(255,255,255,0.9);
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(15,23,42,0.12);
}

button.secondary:hover {
    box-shadow: 0 8px 18px rgba(15,23,42,0.18);
}

/* ===============================
   INPUTS & FLOATING LABELS
   =============================== */

.input-group {
    position: relative;
    margin-bottom: 22px;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 16px 12px 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    font-size: 15px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.input-group input::placeholder {
    color: transparent;
}

.input-group label {
    position: absolute;
    top: 14px;
    left: 12px;
    font-size: 14px;
    color: var(--text-muted);
    pointer-events: none;
    transition: all 0.18s ease;
    background: transparent;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(26,115,232,0.35);
    background: rgba(255,255,255,1);
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label,
.input-group select:focus + label,
.input-group select:not([value=""]) + label,
.input-group textarea:focus + label,
.input-group textarea:not(:placeholder-shown) + label {
    top: -8px;
    left: 10px;
    font-size: 11px;
    padding: 0 4px;
    background: white;
    color: var(--primary-dark);
    border-radius: 999px;
}

/* Fallback labels for non-floating usage */
label {
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
    color: var(--text-main);
}

/* ===============================
   CARD COMPONENTS
   =============================== */

.card,
.quote-card,
.lead-card {
    background: var(--bg-elevated);
    backdrop-filter: blur(16px);
    padding: 22px 22px 20px;
    margin-bottom: 22px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255,255,255,0.7);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover,
.quote-card:hover,
.lead-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(26,115,232,0.25);
}

.quote-card {
    border-left: 5px solid var(--primary);
}

.lead-card {
    border-left: 5px solid var(--accent);
}

.quote-card h3,
.lead-card h3 {
    margin-top: 0;
    font-size: 18px;
    font-weight: 650;
}

/* ===============================
   TYPOGRAPHY & VIEW-SPECIFIC
   =============================== */

.home {
    text-align: center;
    padding-top: 40px;
}

.home h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.home p {
    font-size: 18px;
    margin-bottom: 26px;
    color: var(--text-muted);
}

.intake h2,
.processing h2,
.quotes h2,
.roofer-dashboard h2,
.admin h2 {
    font-size: 24px;
    margin-bottom: 14px;
}

.processing {
    text-align: center;
    padding-top: 40px;
}

.processing p {
    color: var(--text-muted);
}

/* ===============================
   QUOTES & ROOFER DASHBOARD
   =============================== */

.quotes h2 {
    font-size: 26px;
    margin-bottom: 20px;
}

#roofer-leads {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

/* ===============================
   ADMIN PANEL
   =============================== */

#admin-data {
    background: rgba(15,23,42,0.95);
    color: #e5e7eb;
    padding: 18px;
    border-radius: var(--radius-lg);
    white-space: pre-wrap;
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    box-shadow: var(--shadow-soft);
}

/* ===============================
   ANIMATIONS
   =============================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===============================
   RESPONSIVE DESIGN
   =============================== */

@media (max-width: 720px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    nav {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    #view {
        padding: 20px 14px 32px;
    }
}

/* ===============================
   DARK MODE
   =============================== */

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #050712;
        --bg-elevated: rgba(15,23,42,0.92);
        --text-main: #e5e7eb;
        --text-muted: #9ca3af;
        --border-subtle: rgba(148,163,184,0.35);
        --shadow-soft: 0 10px 30px rgba(0,0,0,0.7);
        --shadow-hover: 0 14px 40px rgba(0,0,0,0.85);
    }

    body {
        background: radial-gradient(circle at top left, #020617 0, #020617 40%, #020617 100%);
        color: var(--text-main);
    }

    header {
        background: linear-gradient(120deg, rgba(15,23,42,0.96), rgba(15,23,42,0.96));
        border-bottom-color: rgba(148,163,184,0.35);
    }

    .card,
    .quote-card,
    .lead-card {
        background: rgba(15,23,42,0.96);
        border-color: rgba(148,163,184,0.35);
    }

    .input-group input,
    .input-group select,
    .input-group textarea {
        background: rgba(15,23,42,0.96);
        color: var(--text-main);
        border-color: var(--border-subtle);
    }

    .input-group input:focus,
    .input-group select:focus,
    .input-group textarea:focus {
        background: rgba(15,23,42,1);
    }

    .input-group label {
        background: transparent;
    }

    .input-group input:focus + label,
    .input-group input:not(:placeholder-shown) + label,
    .input-group select:focus + label,
    .input-group select:not([value=""]) + label,
    .input-group textarea:focus + label,
    .input-group textarea:not(:placeholder-shown) + label {
        background: #020617;
    }

    #admin-data {
        background: #020617;
        border: 1px solid rgba(148,163,184,0.4);
    }
}
