/* ========================================
   CreditoClaroUSA - Custom Styles
   Teal Theme - Spanish Version
======================================== */

/* ========== CSS Variables ========== */
:root {
    --primary-50: #f0fdfa;
    --primary-100: #ccfbf1;
    --primary-200: #99f6e4;
    --primary-300: #5eead4;
    --primary-400: #2dd4bf;
    --primary-500: #14b8a6;
    --primary-600: #0d9488;
    --primary-700: #0f766e;
    --primary-800: #115e59;
    --primary-900: #134e4a;
    --accent-400: #2dd4bf;
    --accent-500: #14b8a6;
    --accent-600: #0d9488;
    --transition-base: 200ms ease;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

/* ========== Base Styles ========== */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    overflow-x: hidden;
}

/* Focus styles for accessibility */
*:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* Screen reader only utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only.focus\:not-sr-only:focus {
    position: absolute;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ========== Header Styles ========== */
#header {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#header.scrolled {
    box-shadow: var(--shadow-medium);
}

/* ========== Multi-Step Form ========== */
.form-step {
    display: none;
    animation: stepFadeIn 0.3s ease;
}

.form-step.active {
    display: block;
}

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

/* ========== Form Styles ========== */
.form-input,
.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff;
}

.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: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.form-input.error,
.form-select.error {
    border-color: #ef4444;
}

.error-msg {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.error-msg.show {
    display: block;
}

/* ========== Checkbox Styles ========== */
.checkbox-custom {
    appearance: none;
    -webkit-appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #d1d5db;
    border-radius: 0.25rem;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-custom:checked {
    background-color: var(--primary-500);
    border-color: var(--primary-500);
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
}

.checkbox-custom:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

/* ========== Button Loading State ========== */
.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    top: 50%;
    left: 50%;
    margin-left: -0.625rem;
    margin-top: -0.625rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spinner 0.8s ease infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* ========== FAQ Accordion ========== */
.faq-item {
    transition: all 0.2s ease;
}

.faq-trigger {
    cursor: pointer;
}

.faq-trigger[aria-expanded="true"] .faq-icon {
    transform: rotate(180deg);
}

.faq-icon {
    transition: transform 0.3s ease;
}

.faq-content {
    overflow: hidden;
}

.faq-content.open {
    animation: accordionOpen 0.3s ease;
}

@keyframes accordionOpen {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

/* ========== Mobile Menu ========== */
#mobile-menu {
    transition: all 0.3s ease;
    max-height: 0;
    overflow: hidden;
}

#mobile-menu.open {
    max-height: 400px;
}

.mobile-nav-link {
    transition: all 0.2s ease;
}

/* ========== Mobile Sticky CTA ========== */
#mobile-cta {
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

#mobile-cta.visible {
    transform: translateY(0);
}

body.mobile-cta-visible {
    padding-bottom: 80px;
}

/* ========== Animations ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-shake {
    animation: shake 0.5s ease;
}

/* ========== Utility Classes ========== */
.text-balance {
    text-wrap: balance;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== Hide reCAPTCHA Badge ========== */
.grecaptcha-badge {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ========== Responsive Adjustments ========== */
@media (max-width: 640px) {
    .form-input,
    .form-select {
        font-size: 16px;
    }

    input[type="date"] {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        min-width: 0;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    input[type="date"]::-webkit-calendar-picker-indicator {
        cursor: pointer;
        opacity: 0.6;
    }
}

/* ========== Print Styles ========== */
@media print {
    #header,
    #mobile-cta,
    .no-print {
        display: none !important;
    }

    body {
        padding-top: 0 !important;
    }
}

/* ========== Focus Ring Enhancement ========== */
.keyboard-navigation *:focus {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* ========== Custom Scrollbar ========== */
@media (min-width: 1024px) {
    ::-webkit-scrollbar {
        width: 10px;
    }

    ::-webkit-scrollbar-track {
        background: #f1f5f9;
    }

    ::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 5px;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }
}

/* ========== Selection Color ========== */
::selection {
    background-color: var(--primary-500);
    color: white;
}

::-moz-selection {
    background-color: var(--primary-500);
    color: white;
}

/* ========== Reduce Motion ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* ========== Shimmer Effect ========== */
.shimmer {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
