/* ===== CSS Variables (Light Theme - matching Lovable app) ===== */
:root {
    --background: hsl(30, 10%, 97%);
    --foreground: hsl(30, 10%, 10%);
    --card: hsl(0, 0%, 100%);
    --card-foreground: hsl(30, 10%, 10%);
    --primary: hsl(38, 60%, 45%);
    --primary-foreground: hsl(0, 0%, 100%);
    --secondary: hsl(30, 15%, 92%);
    --secondary-foreground: hsl(30, 10%, 15%);
    --muted: hsl(30, 10%, 94%);
    --muted-foreground: hsl(30, 8%, 46%);
    --accent: hsl(38, 50%, 50%);
    --accent-foreground: hsl(0, 0%, 100%);
    --destructive: hsl(0, 84.2%, 60.2%);
    --destructive-foreground: hsl(210, 40%, 98%);
    --border: hsl(30, 15%, 88%);
    --input: hsl(30, 15%, 88%);
    --ring: hsl(38, 60%, 45%);
    --radius: 0.5rem;
    --font-heading: "Cormorant Garamond", serif;
    --font-body: "Lato", sans-serif;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Layout ===== */
.min-h-screen {
    min-height: 100vh;
    background-color: var(--background);
}

.header {
    padding: 1.5rem 0;
    display: flex;
    justify-content: center;
}

@media (min-width: 640px) {
    .header {
        padding: 2rem 0;
    }
}

.logo {
    height: 5rem;
    width: auto;
    object-fit: contain;
}

@media (min-width: 640px) {
    .logo {
        height: 7rem;
    }
}

.main-container {
    max-width: 28rem;
    margin: 0 auto;
    padding: 0 1rem 2.5rem;
}

/* ===== Subtitle Carousel ===== */
.subtitle-carousel {
    margin-bottom: 2rem;
    position: relative;
    min-height: 3.5rem;
    overflow: hidden;
    text-align: center;
}

.subtitle-text {
    position: absolute;
    width: 100%;
    left: 0;
    top: 0;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--primary);
    line-height: 1.25;
    padding: 0 0.5rem;
}

@media (min-width: 640px) {
    .subtitle-text {
        font-size: 1.875rem;
    }
    .subtitle-carousel {
        min-height: 2.75rem;
    }
}

.subtitle-text.active {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Form Card ===== */
.form-card {
    background: var(--card);
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    padding: 1.75rem 1.25rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.025);
}

@media (min-width: 640px) {
    .form-card {
        padding: 2.5rem 2rem;
    }
}

/* ===== Form Sections ===== */
.form-section {
    margin-bottom: 2rem;
}

.form-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--foreground);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    margin-bottom: 1.25rem;
}

.section-subtitle {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin-bottom: 0.75rem;
}

/* ===== Form Groups ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-family: var(--font-body);
    font-weight: 500;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.form-input {
    display: block;
    width: 100%;
    height: 3rem;
    padding: 0.5rem 0.875rem;
    font-size: 1rem;
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.5;
    color: var(--foreground);
    background-color: transparent;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    appearance: none;
    -webkit-appearance: none;
}

.form-input::placeholder {
    color: var(--muted-foreground);
    opacity: 0.6;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px hsla(38, 60%, 45%, 0.2);
}

.form-input.has-error {
    border-color: var(--destructive);
}

.form-input.has-error:focus {
    box-shadow: 0 0 0 2px hsla(0, 84.2%, 60.2%, 0.2);
}

/* Select styling */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1em 1em;
    padding-right: 2.5rem;
    cursor: pointer;
}

.form-select option[disabled] {
    color: var(--muted-foreground);
}

/* Two column row */
.form-row.two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* ===== Error Messages ===== */
.error-message {
    font-size: 0.75rem;
    color: var(--destructive);
    margin-top: 0.25rem;
    min-height: 0;
    overflow: hidden;
    transition: all 0.2s ease;
}

.error-message:empty {
    display: none;
}

/* ===== Toggle Buttons (Sí / No) ===== */
.toggle-buttons {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.toggle-btn {
    flex: 1;
    height: 3rem;
    font-size: 1rem;
    font-family: var(--font-body);
    font-weight: 500;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--foreground);
}

.toggle-btn:hover {
    background: var(--secondary);
}

.toggle-btn.active {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

/* ===== Vivienda Adicional Fields ===== */
.vivienda-adicional-fields {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    max-height: 0;
}

.vivienda-adicional-fields.visible {
    opacity: 1;
    max-height: 600px;
    margin-top: 0.5rem;
}

/* ===== Checkbox ===== */
.privacy-section {
    padding-top: 0.5rem;
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.form-checkbox {
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.15rem;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
    appearance: auto;
    -webkit-appearance: auto;
    border-radius: 0.25rem;
}

.checkbox-label {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--muted-foreground);
    cursor: pointer;
}

.privacy-link {
    color: var(--primary);
    text-decoration: underline;
}

.privacy-link:hover {
    opacity: 0.8;
}

/* ===== Submit Button ===== */
.submit-btn {
    display: block;
    width: 100%;
    height: 3.5rem;
    margin-top: 1.5rem;
    font-size: 1rem;
    font-family: var(--font-body);
    font-weight: 600;
    letter-spacing: 0.025em;
    color: var(--primary-foreground);
    background-color: var(--primary);
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.1s ease;
}

.submit-btn:hover {
    opacity: 0.9;
}

.submit-btn:active {
    transform: scale(0.99);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== Success Section ===== */
.success-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 1.5rem;
    text-align: center;
}

.success-content {
    animation: fadeInScale 0.5s ease forwards;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.success-icon {
    width: 4rem;
    height: 4rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.success-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 1rem;
}

@media (min-width: 640px) {
    .success-title {
        font-size: 1.875rem;
    }
}

.success-text {
    color: var(--muted-foreground);
    font-size: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 640px) {
    .success-text {
        font-size: 1.125rem;
    }
}

.success-redirect {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

/* ===== Server error message ===== */
.server-error {
    background: hsla(0, 84.2%, 60.2%, 0.1);
    border: 1px solid var(--destructive);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: var(--destructive);
    text-align: center;
}
