/* ==========================================================================
   Base Styles and Variables (Turtle Brand Colors)
   ========================================================================== */
:root {
    --bg-primary: #F2EFE9;
    --card-bg: rgba(255, 255, 255, 0.45);
    --card-border: rgba(27, 48, 34, 0.08);
    --text-primary: #1B3022;
    --text-secondary: #4A6355;
    --text-muted: #7A9383;
    --primary-gradient: linear-gradient(135deg, #1B3022 0%, #2A4A35 100%);
    --accent-glow: rgba(27, 48, 34, 0.06);
    --error-color: #dc2626;
    --success-color: #166534;
    --font-sans: 'Montserrat', sans-serif;
    --font-serif: 'Cormorant Garamond', serif;
    --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    background-image: url('https://turtlenfast.com/assets/parchment.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background glowing orbs (adjusted to light/warm tone) */
.bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(150px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.35;
}

.glow-1 {
    top: -10%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.6) 0%, rgba(27, 48, 34, 0.02) 70%);
}

.glow-2 {
    bottom: -10%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.6) 0%, rgba(27, 48, 34, 0.02) 70%);
}

/* ==========================================================================
   App Container & Layout
   ========================================================================== */
.app-container {
    width: 100%;
    max-width: 640px;
    padding: 2rem;
    z-index: 10;
    position: relative;
}

/* Logo Header */
.logo-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    width: 100%;
}

.app-logo {
    width: 100px;
    height: auto;
    mix-blend-mode: multiply;
    filter: drop-shadow(0 2px 8px rgba(27, 48, 34, 0.05));
    transition: transform var(--transition-smooth);
}

.app-logo:hover {
    transform: scale(1.05);
}

/* Progress Bar */
.progress-container {
    margin-bottom: 2.5rem;
}

.progress-bar-wrapper {
    background: rgba(27, 48, 34, 0.05);
    height: 6px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(27, 48, 34, 0.02);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #1B3022 0%, #3D6B4F 100%);
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-text {
    display: none;
}

/* ==========================================================================
   Step Cards & Transition Animations
   ========================================================================== */
#leadForm {
    position: relative;
    min-height: 420px;
}

.step-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 20px;
    padding: 3rem 2.5rem;
    box-shadow: 0 15px 35px rgba(27, 48, 34, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    display: none;
    flex-direction: column;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.step-card.active {
    display: flex;
    position: relative;
    animation: slideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.step-card.slide-out-next {
    animation: slideOutNext 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.step-card.slide-out-back {
    animation: slideOutBack 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.step-card.slide-in-back {
    display: flex;
    position: relative;
    animation: slideInBack 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideOutNext {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-30px) scale(0.98);
    }
}

@keyframes slideInBack {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideOutBack {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }
}

/* Card Header */
.step-header {
    margin-bottom: 2.5rem;
}

.step-num {
    display: none;
}

.step-card h2 {
    font-family: var(--font-serif);
    font-size: 1.95rem;
    font-weight: 500;
    line-height: 1.25;
    color: var(--text-primary);
}

.step-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* ==========================================================================
   Floating Labels Inputs
   ========================================================================== */
.input-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
    width: 100%;
}

.input-wrapper input {
    width: 100%;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 1.25rem 1rem;
    font-size: 1.15rem;
    font-family: inherit;
    color: var(--text-primary);
    transition: var(--transition-smooth);
    outline: none;
}

.input-wrapper label {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    transition: var(--transition-smooth);
    font-size: 1.05rem;
}

/* Input Focus / Filled State */
.input-wrapper input:focus,
.input-wrapper input:not(:placeholder-shown) {
    border-color: #1B3022;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 0 15px rgba(27, 48, 34, 0.08);
    padding-top: 1.6rem;
    padding-bottom: 0.9rem;
}

.input-wrapper input:focus ~ label,
.input-wrapper input:not(:placeholder-shown) ~ label {
    top: 25%;
    font-size: 0.75rem;
    color: #2A4A35;
    font-weight: 600;
}

/* Hide default placeholder when not focused */
.input-wrapper input::placeholder {
    color: transparent;
    transition: color 0.3s;
}

.input-wrapper input:focus::placeholder {
    color: var(--text-muted);
}

/* Validation styles */
.input-wrapper.invalid input {
    border-color: var(--error-color) !important;
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.08) !important;
}

.input-wrapper.invalid label {
    color: var(--error-color) !important;
}

.error-msg {
    display: none;
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

.input-wrapper.invalid .error-msg {
    display: block;
}

/* Prefix specific inputs (e.g. @instagram) */
.prefix-input {
    display: flex;
    align-items: center;
}

.prefix-input .prefix {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    font-size: 1.15rem;
    font-weight: 500;
    pointer-events: none;
}

/* ==========================================================================
   Buttons and Navigation
   ========================================================================== */
.navigation-wrapper {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
    width: 100%;
}

.btn {
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 1rem 2rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    outline: none;
}

.btn-next, .btn-submit, .btn-restart {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(27, 48, 34, 0.15);
}

.btn-next:hover, .btn-submit:hover, .btn-restart:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(27, 48, 34, 0.25);
}

.btn-next:active, .btn-submit:active, .btn-restart:active {
    transform: translateY(0);
}

.btn-back {
    background: rgba(27, 48, 34, 0.03);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
}

.btn-back:hover {
    background: rgba(27, 48, 34, 0.08);
    color: var(--text-primary);
    border-color: rgba(27, 48, 34, 0.2);
}

/* ==========================================================================
   Niche Option Grid
   ========================================================================== */
.niche-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    width: 100%;
}

@media (max-width: 480px) {
    .niche-selector {
        grid-template-columns: 1fr;
    }
}

.niche-btn {
    background: rgba(255, 255, 255, 0.35);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    outline: none;
    text-align: left;
}

.niche-btn i {
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: var(--transition-smooth);
    width: 24px;
    text-align: center;
}

.niche-btn:hover {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(27, 48, 34, 0.25);
    color: var(--text-primary);
}

.niche-btn:hover i {
    color: #1B3022;
}

.niche-btn.selected {
    background: rgba(27, 48, 34, 0.06);
    border-color: #1B3022;
    color: var(--text-primary);
    box-shadow: 0 0 12px rgba(27, 48, 34, 0.06);
}

.niche-btn.selected i {
    color: #2A4A35;
}

/* ==========================================================================
   Terms and Conditions
   ========================================================================== */
.terms-card {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

.terms-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-height: 160px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Scrollbar styling for terms */
.terms-text::-webkit-scrollbar {
    width: 6px;
}
.terms-text::-webkit-scrollbar-track {
    background: rgba(27, 48, 34, 0.02);
    border-radius: 10px;
}
.terms-text::-webkit-scrollbar-thumb {
    background: rgba(27, 48, 34, 0.1);
    border-radius: 10px;
}

.checkbox-wrapper {
    display: flex;
    align-items: flex-start;
}

.custom-checkbox {
    display: flex;
    position: relative;
    padding-left: 2rem;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
    color: var(--text-primary);
    line-height: 1.4;
    font-weight: 500;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 2px;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    transition: var(--transition-smooth);
}

.custom-checkbox:hover input ~ .checkmark {
    border-color: rgba(27, 48, 34, 0.25);
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: #1B3022;
    border-color: #1B3022;
    box-shadow: 0 0 10px rgba(27, 48, 34, 0.1);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
}

.custom-checkbox .checkmark:after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ==========================================================================
   CEP Search Loading
   ========================================================================== */
.cep-loading {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: -0.5rem;
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease;
}

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

/* ==========================================================================
   Thank You / Success Card
   ========================================================================== */
.thank-you-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 20px;
    padding: 4rem 2.5rem;
    box-shadow: 0 15px 35px rgba(27, 48, 34, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    position: relative;
    overflow: hidden;
}

#confettiCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.success-icon-wrapper {
    margin-bottom: 2rem;
    position: relative;
    z-index: 2;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: rgba(22, 101, 52, 0.05);
    border: 2px solid var(--success-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: var(--success-color);
    box-shadow: 0 0 30px rgba(22, 101, 52, 0.15);
    animation: scaleInCheck 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes scaleInCheck {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.thank-you-card h1 {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--text-primary);
    z-index: 2;
}

.thank-you-card p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.5;
    z-index: 2;
}

.thank-you-card .sub-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    z-index: 2;
}

.btn-restart {
    z-index: 2;
}

/* ==========================================================================
   Mobile Responsiveness (Screens under 600px)
   ========================================================================== */
@media (max-width: 600px) {
    body {
        align-items: flex-start;
        padding: 1.5rem 0.5rem;
    }

    .app-container {
        padding: 0.5rem;
        max-width: 100%;
    }

    .logo-wrapper {
        margin-bottom: 1.5rem;
    }

    .app-logo {
        width: 80px;
    }

    .progress-container {
        margin-bottom: 1.75rem;
    }

    .step-card {
        padding: 2rem 1.25rem;
        border-radius: 16px;
        box-shadow: 0 10px 25px rgba(27, 48, 34, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    }

    .step-header {
        margin-bottom: 1.75rem;
    }

    .step-card h2 {
        font-size: 1.5rem;
        line-height: 1.35;
    }

    .step-desc {
        font-size: 0.85rem;
        margin-top: 0.4rem;
    }

    .input-wrapper {
        margin-bottom: 1.25rem;
    }

    .input-wrapper input {
        padding: 1.1rem 0.85rem;
        font-size: 1rem;
        border-radius: 8px;
    }

    .input-wrapper label {
        left: 0.85rem;
        font-size: 0.95rem;
    }

    .input-wrapper input:focus,
    .input-wrapper input:not(:placeholder-shown) {
        padding-top: 1.4rem;
        padding-bottom: 0.75rem;
    }

    .input-wrapper input:focus ~ label,
    .input-wrapper input:not(:placeholder-shown) ~ label {
        top: 25%;
        font-size: 0.7rem;
    }

    .prefix-input input {
        padding-left: 2rem !important;
    }

    .prefix-input label {
        left: 2rem !important;
    }

    .prefix-input .prefix {
        left: 0.85rem;
        font-size: 1rem;
    }

    .error-msg {
        font-size: 0.8rem;
        margin-top: 0.4rem;
    }

    /* Stack buttons vertically for mobile friendliness and prevent truncation */
    .navigation-wrapper {
        flex-direction: column-reverse;
        gap: 0.75rem;
        margin-top: 1rem;
    }

    .btn {
        width: 100%;
        padding: 0.9rem 1.5rem;
        font-size: 0.75rem;
        border-radius: 8px;
        justify-content: center;
    }

    .niche-selector {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .niche-btn {
        padding: 0.85rem;
        font-size: 0.9rem;
        border-radius: 8px;
    }

    .niche-btn i {
        font-size: 1.1rem;
    }

    .terms-card {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 8px;
    }

    .terms-text {
        font-size: 0.8rem;
        max-height: 120px;
        margin-bottom: 1rem;
    }

    .custom-checkbox {
        font-size: 0.8rem;
        padding-left: 1.75rem;
    }

    .checkmark {
        height: 18px;
        width: 18px;
        border-radius: 5px;
    }

    .custom-checkbox .checkmark:after {
        left: 5px;
        top: 1px;
        width: 4px;
        height: 8px;
    }

    /* Thank You / Success Card mobile tweaks */
    .thank-you-card {
        padding: 3rem 1.25rem;
        border-radius: 16px;
    }

    .thank-you-card h1 {
        font-size: 1.8rem;
        margin-bottom: 0.75rem;
    }

    .thank-you-card p {
        font-size: 0.95rem;
        margin-bottom: 0.4rem;
    }

    .thank-you-card .sub-text {
        font-size: 0.85rem;
        margin-bottom: 2rem;
    }

    .success-icon {
        width: 70px;
        height: 70px;
        font-size: 1.8rem;
    }
}
