/**
 * World On Iran - Custom Styles
 */

/* Base styles */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/* RTL Support */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .border-l-4 {
    border-left-width: 0;
    border-right-width: 4px;
}

/* Font smoothing */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

.dark ::-webkit-scrollbar-track {
    background: #374151;
}

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

.dark ::-webkit-scrollbar-thumb {
    background: #6b7280;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, #239F40, #34D399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Card hover effect */
.card-hover {
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* Pulse animation for live indicator */
@keyframes pulse-green {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse-green {
    animation: pulse-green 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Iran flag gradient */
.iran-gradient {
    background: linear-gradient(180deg, #239F40 0%, #239F40 33%, #FFFFFF 33%, #FFFFFF 66%, #DA0000 66%, #DA0000 100%);
}

/* Line clamp utilities */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-4 {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Focus styles */
button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid #239F40;
    outline-offset: 2px;
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #E5E7EB;
    border-top-color: #239F40;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Prose styles for about page */
.prose p {
    margin-bottom: 1rem;
    line-height: 1.75;
}

.prose-lg p {
    font-size: 1.125rem;
}

/* Dark mode prose */
.dark .prose {
    color: #D1D5DB;
}

/* Mobile menu animation */
[x-cloak] {
    display: none !important;
}

/* Backdrop blur fallback */
@supports not (backdrop-filter: blur(12px)) {
    .backdrop-blur-lg {
        background-color: rgba(255, 255, 255, 0.95);
    }

    .dark .backdrop-blur-lg {
        background-color: rgba(31, 41, 55, 0.95);
    }
}

/* Print styles */
@media print {
    nav, footer, .no-print {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .dark body {
        background: white !important;
        color: black !important;
    }
}

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

/* High contrast mode */
@media (prefers-contrast: high) {
    .country {
        stroke-width: 1px;
    }

    button, a {
        border: 2px solid currentColor;
    }
}

/* Farsi number conversion for RTL */
[dir="rtl"] .number {
    font-feature-settings: "numr" 1;
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #239F40;
    color: white;
    padding: 8px 16px;
    z-index: 100;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Flag images */
img[src*="/flags/"] {
    object-fit: cover;
    background-color: #f3f4f6;
}

.dark img[src*="/flags/"] {
    background-color: #374151;
}

/* Responsive grid adjustments */
@media (max-width: 640px) {
    .grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Compare page column handling */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1024px) {
    .grid-cols-3, .grid-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .grid-cols-2, .grid-cols-3, .grid-cols-4 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}

/* Share button hover effects */
button[class*="bg-white/20"]:hover {
    transform: scale(1.02);
}

/* Classification badge animations */
.classification-badge {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Statement card quote styling */
blockquote {
    position: relative;
}
