/* Custom CSS for The Conflict Navigator */

/* Brand colors CSS variables for easy maintenance */
:root {
    --brand-blue: #5A7D9A;
    --brand-green: #27AE60;
    --brand-teal: #16A085;
    --brand-orange: #F39C12;
    --brand-red: #E67E22;
    --brand-purple: #8E44AD;
    --brand-cream: #F7F4EF;
    --brand-dark: #3D3D3D;
}

/* Mobile-specific fixes for scrolling */
* {
    -webkit-overflow-scrolling: touch;
}

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    body {
        min-height: -webkit-fill-available;
    }
}

/* Focus and accessibility improvements */
*:focus {
    outline: 2px solid var(--brand-blue);
    outline-offset: 2px;
}

/* Screen reader only class */
.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) {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Custom animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Smooth transitions for screen changes */
.screen-transition {
    animation: slideInUp 0.6s ease-out;
}

/* Enhanced button styles */
.btn-primary {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(90, 125, 154, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Answer option styles */
.answer-option {
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    min-height: 80px;
    display: flex;
    align-items: center;
}

.answer-option:hover {
    border-color: var(--brand-blue);
    background-color: var(--brand-cream);
    transform: translateX(5px);
}

.answer-option:focus-within {
    border-color: var(--brand-blue);
    background-color: var(--brand-cream);
    box-shadow: 0 0 0 3px rgba(90, 125, 154, 0.1);
}

.answer-option.selected {
    border-color: var(--brand-blue);
    background-color: var(--brand-cream);
    box-shadow: 0 4px 12px rgba(90, 125, 154, 0.2);
}

/* Radio button custom styling */
.custom-radio {
    position: relative;
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.custom-radio:checked {
    border-color: var(--brand-blue);
    background-color: var(--brand-blue);
}

.custom-radio:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: white;
    transform: translate(-50%, -50%);
}

.custom-radio:focus {
    outline: 2px solid var(--brand-blue);
    outline-offset: 2px;
}

/* Progress bar enhancements */
.progress-container {
    position: relative;
    overflow: hidden;
}

/* Progress text styling */
#progress-text {
    color: #FFFFFF !important;
}

.progress-bar {
    background-color: #F39C12 !important;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Result style cards */
.style-card {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.style-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: left 0.6s ease;
}

.style-card:hover::before {
    left: 100%;
}

/* Enhanced list styles */
.enhanced-list li {
    position: relative;
    padding-left: 1.5rem;
}

.enhanced-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--brand-green);
    font-weight: bold;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    body {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    #main-content {
        min-height: calc(100vh - 120px);
        padding-bottom: 2rem;
    }
    
    #welcome-screen,
    #assessment-screen > div,
    #results-screen > div {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        min-height: auto !important;
        margin: 0 !important;
    }
    
    .answer-option {
        padding: 1rem;
        font-size: 1rem;
    }
    
    .answer-option:hover {
        transform: none;
    }
    
    .btn-primary:hover {
        transform: none;
    }
    
    /* Larger touch targets for mobile */
    button, .answer-option {
        min-height: 48px;
    }
    
    /* Remove fixed heights on mobile */
    section {
        height: auto !important;
        min-height: auto !important;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    header {
        padding: 0.5rem 0;
    }
    
    h1 {
        font-size: 1.125rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
    
    .text-5xl {
        font-size: 2.5rem !important;
    }
    
    .text-2xl {
        font-size: 1.25rem !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .answer-option {
        border-width: 3px;
    }
    
    .custom-radio {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Dark mode support (respects system preference) */
@media (prefers-color-scheme: dark) {
    /* This would be implemented if dark mode was required */
    /* Currently maintaining light mode for better accessibility */
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .bg-white {
        box-shadow: none !important;
    }
}

/* Loading state styles */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--brand-blue);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Tooltip styles */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem;
    background: #374151;
    color: white;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
}

/* Error state styles */
.error-state {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

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

/* Success state styles */
.success-state {
    border-color: #10b981 !important;
    background-color: #f0fdf4 !important;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

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

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

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