/* LifeCompanion Custom Styles */
:root {
    --primary: #3B82F6;
    --secondary: #10B981;
    --accent: #8B5CF6;
}

/* Persian Font & RTL Styling */
body {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    direction: rtl;
    text-align: right;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Mobile Touch & Viewport Optimizations */
@media (max-width: 1024px) {
    /* Fast touch response without 300ms tap delay or grey flash */
    button, a, input, select, textarea, [role="button"] {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    /* Prevent accidental horizontal overflow wobble */
    body {
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
}

/* Safe area insets for notched phones */
.pb-safe {
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
}

/* Hide scrollbar for Chrome, Safari, Opera and Firefox */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Alpine.js Cloak to prevent Flash of Unstyled Content (FOUC) */
[x-cloak] {
    display: none !important;
}

/* Dark Mode Base Styles & Root Background */
html.dark {
    color-scheme: dark;
    background-color: #111827; /* Tailwind gray-900 */
}

html.dark body {
    background-color: #111827 !important;
    color: #f3f4f6 !important;
}

/* Smooth transitions */
.transition-smooth {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Custom scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.5);
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(107, 114, 128, 0.8);
}

/* HTMX Indicator Styling */
.htmx-indicator {
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease-in;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: flex !important;
    opacity: 1 !important;
}

/* Page Fade-in Animation */
@keyframes pageFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.page-content-fade {
    animation: pageFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* HTMX Smooth Content Swap Transitions */
.htmx-swapping {
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

.htmx-settling {
    opacity: 1;
    transition: opacity 0.25s ease-in;
}

/* Global Top Progress Bar Animation */
@keyframes indeterminateProgress {
    0% {
        transform: translateX(100%);
    }
    50% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(-100%);
    }
}

.animate-progress-indeterminate {
    animation: indeterminateProgress 1.4s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

/* ==========================================
   Psychological Assessment Wizard Choice Cards
   ========================================== */
.wizard-choice-card {
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.wizard-choice-card:hover {
    border-color: #60a5fa; /* blue-400 */
}

/* Instant active styling when inner radio/checkbox is checked */
.wizard-choice-card:has(input:checked) {
    border-color: #2563eb !important; /* blue-600 */
    background-color: rgba(239, 246, 255, 0.8) !important; /* blue-50 */
    color: #1e3a8a !important; /* blue-900 */
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.12), 0 2px 4px -2px rgba(37, 99, 235, 0.08) !important;
}

html.dark .wizard-choice-card:has(input:checked) {
    border-color: #3b82f6 !important; /* blue-500 */
    background-color: rgba(30, 58, 138, 0.35) !important; /* blue-900/35 */
    color: #dbeafe !important; /* blue-100 */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3) !important;
}

/* Emerald variant for resilience choices */
.wizard-choice-card-emerald {
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.wizard-choice-card-emerald:hover {
    border-color: #34d399; /* emerald-400 */
}

.wizard-choice-card-emerald:has(input:checked) {
    border-color: #059669 !important; /* emerald-600 */
    background-color: rgba(236, 253, 245, 0.8) !important; /* emerald-50 */
    color: #064e3b !important; /* emerald-900 */
    box-shadow: 0 4px 6px -1px rgba(5, 150, 105, 0.12), 0 2px 4px -2px rgba(5, 150, 105, 0.08) !important;
}

html.dark .wizard-choice-card-emerald:has(input:checked) {
    border-color: #10b981 !important; /* emerald-500 */
    background-color: rgba(6, 78, 59, 0.35) !important; /* emerald-950 */
    color: #a7f3d0 !important; /* emerald-200 */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3) !important;
}
