:root {
    /* Light Theme (Default) */
    --bg: #ffffff;
    --card-bg: #ffffff;
    --field-bg: #ffffff;
    --border-color: #e5e7ec;
    --text-main: #1f252d;
    --text-muted: #6b7380;
    --primary: #d92b3a;
    --primary-glow: rgba(217, 43, 58, 0.4);
    --shadow-main: 0 18px 48px rgba(31, 37, 45, 0.08);
    --glass-blur: 0px;
}

[data-theme="dark"] {
    --bg: #030712;
    --card-bg: rgba(17, 24, 39, 0.8);
    --field-bg: rgba(255, 255, 255, 0.03);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --primary: #ef4444;
    --primary-glow: rgba(239, 68, 68, 0.5);
    --shadow-main: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
    --glass-blur: 16px;
}

* {
    box-sizing: border-box;
    transition:
        background-color 0.3s ease,
        border-color 0.3s ease,
        color 0.3s ease,
        box-shadow 0.3s ease;
}

body {
    margin: 0;
    padding: 60px 20px;
    font-family:
        "Outfit",
        "Inter",
        "Segoe UI",
        system-ui,
        -apple-system,
        sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    line-height: 1.6;
    /* Prevent layout shift when scrollbar appears */
    scrollbar-gutter: stable both-edges;
    overflow-y: scroll;
}

[data-theme="dark"] body {
    background-image:
        radial-gradient(
            circle at 15% 25%,
            rgba(239, 68, 68, 0.05) 0%,
            transparent 50%
        ),
        radial-gradient(
            circle at 95% 75%,
            rgba(239, 68, 68, 0.08) 0%,
            transparent 50%
        );
}

/* --- SCROLLBAR --- */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}

main.page {
    width: min(1000px, 100%);
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    z-index: 1;
    padding: 0 20px;
    box-sizing: border-box;
}

/* --- HERO SECTION --- */
.hero {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    box-shadow:
        var(--shadow-main),
        0 0 20px var(--primary-glow);
}

.hero__text {
    text-align: center;
    flex: 1;
}

.hero__text h1 {
    margin: 8px 0;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    font-weight: 800;
    color: var(--text-main);
}

[data-theme="dark"] .hero__text h1 {
    background: linear-gradient(to right, #fff, var(--primary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.eyebrow {
    color: var(--primary);
    font-weight: 800;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.hero__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.hero__logos {
    display: flex;
    gap: 12px;
    align-items: center;
}

.hero__logo {
    width: 80px;
    height: 80px;
    background: #ffffff; /* Default light */
    padding: 12px;
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .hero__logo {
    background: #000000 !important; /* Black background for dark mode as requested */
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.hero__logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.hero__brand-name {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-main);
}

/* --- THEME TOGGLE (Sticky Button) --- */
.theme-switch {
    position: fixed;
    top: 30px;
    inset-inline-start: 30px;
    z-index: 1000;
}

.theme-switch button {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    width: 50px;
    height: 50px;
    border-radius: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: var(--shadow-main);
    color: var(--text-main);
}

.theme-switch button:hover {
    transform: scale(1.1) rotate(10deg);
    border-color: var(--primary);
}

/* --- CARD WITH ANIMATED BORDER (Video 2 Inspiration) --- */
.card-wrapper {
    position: relative;
    padding: 2px;
    border-radius: 26px;
    overflow: hidden;
    background: transparent;
}

.card-wrapper::before {
    content: "";
    position: absolute;
    width: 200%;
    height: 200%;
    background: conic-gradient(transparent, var(--primary), transparent 30%);
    animation: rotateBorder 4s linear infinite;
    top: -50%;
    left: -50%;
}

@keyframes rotateBorder {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.card {
    position: relative;
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--shadow-main);
    z-index: 1;
}

/* --- FORM ELEMENTS --- */
fieldset {
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 24px;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.02);
}

legend {
    padding: 0 16px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    text-shadow: 0 0 10px var(--primary-glow);
}

.grid {
    display: grid;
    gap: 20px;
}

.grid.two {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid.three {
    grid-template-columns: repeat(3, 1fr);
}

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

@media (max-width: 640px) {
    .grid.three {
        grid-template-columns: 1fr;
    }
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field span {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    margin-right: 4px;
}

/* Date input wrapper with calendar button */
.date-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.date-input-wrapper input {
    flex: 1;
}

.calendar-btn {
    background: var(--field-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    color: var(--text-main);
    transition: all 0.3s ease;
}

.calendar-btn:hover {
    border-color: var(--primary);
    background: var(--primary);
    transform: scale(1.05);
    filter: brightness(1.1);
}

.calendar-btn:active {
    transform: scale(0.95);
}

input,
select,
textarea {
    background: var(--field-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 12px 16px;
    color: var(--text-main);
    font-size: 1rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
    transform: translateY(-2px);
}

/* Select options behavior */
select option {
    background: var(--bg);
    color: var(--text-main);
}

.note {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Error Banner for Application Status */
.error-banner {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- GLOWING BUTTON --- */
.glow-button {
    display: inline-block;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 16px 40px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px var(--primary-glow);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.glow-button:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 0 30px var(--primary),
        0 0 50px var(--primary-glow);
}

.glow-button:disabled {
    background: var(--primary);
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

/* --- FORM FOOTER --- */
.form-footer {
    display: flex;
    justify-content: center;
    margin-top: 32px;
}

/* --- TERMS SECTION --- */
.terms-section {
    background: rgba(255, 255, 255, 0.03);
    padding: 24px;
    border-radius: 18px;
    border: 1px solid var(--border-color);
}

/* --- TOAST --- */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #10b981;
    color: white;
    padding: 16px 32px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.error {
    background: #ef4444;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    body {
        border-width: 0;
        padding: 20px 15px;
    }
    .hero {
        flex-direction: column;
        text-align: center;
    }
    .card {
        padding: 24px;
    }
    .grid.two {
        grid-template-columns: 1fr;
    }
    .theme-switch {
        top: 15px;
        inset-inline-start: 15px;
    }
}

/* --- READONLY FIELDS --- */
.readonly-field {
    background-color: var(--field-bg) !important;
    cursor: not-allowed;
    opacity: 0.7;
    filter: grayscale(1) brightness(0.9);
    pointer-events: none !important;
}

.readonly-field input,
.readonly-field select {
    pointer-events: none !important;
}

.readonly-field:focus {
    transform: none !important;
    box-shadow: none !important;
    border-color: var(--border-color) !important;
}

/* --- MOBILE RESPONSIVE --- */
@media (max-width: 768px) {
    body {
        padding: 20px 10px;
    }

    .hero {
        flex-direction: column;
        text-align: center;
        padding: 24px 16px;
        gap: 16px;
    }

    .hero__text {
        order: 2;
        text-align: center;
    }

    .hero__brand {
        order: 1;
    }

    .eyebrow {
        font-size: 1.1rem;
        white-space: normal;
        line-height: 1.4;
        font-weight: 800;
    }

    .hero__text h1 {
        font-size: 1.3rem;
    }

    .hero__text .lead,
    .hero__text p:not(.eyebrow) {
        font-size: 0.85rem;
    }

    .hero__logo {
        width: 60px;
        height: 60px;
    }

    .hero__brand-name {
        font-size: 0.9rem;
    }

    .card {
        padding: 20px 16px;
    }

    main.page {
        padding: 0 10px;
    }

    .theme-switch {
        top: 15px;
        inset-inline-start: 15px;
    }

    .theme-switch button {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .site-footer .footer-content {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .footer-address span {
        font-size: 0.85rem;
        white-space: normal;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .eyebrow {
        font-size: 1rem;
    }

    .hero__text h1 {
        font-size: 1.1rem;
    }

    .hero__text .lead,
    .hero__text p:not(.eyebrow) {
        font-size: 0.8rem;
    }

    .hero__logo {
        width: 50px;
        height: 50px;
    }
}
