/**
 * Countries Grid Component Styles
 * Modern, responsive design with dark theme and RTL support
 */

/* Countries Section */
.countries {
    background: var(--bg);
    padding: 80px 0;
    position: relative;
}

.countries .section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3rem;
    line-height: 1.2;
}

.countries .section-subtitle {
    text-align: center;
    font-size: 1.125rem;
    color: var(--muted);
    margin-bottom: 4rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Countries Grid */
.countries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Country Card */
.country-card {
    display: block;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 24px;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    transition: all 0.15s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.country-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--accent);
}

.country-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Flag Container */
.country-flag {
    width: 64px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.country-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Content */
.country-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.country-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.3;
}

.country-subtitle {
    font-size: 0.875rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.4;
}

/* Arrow Icon */
.country-arrow {
    position: absolute;
    top: 0;
    right: 0;
    color: var(--accent);
    opacity: 0.7;
    transition: all 0.15s ease;
}

.country-card:hover .country-arrow {
    opacity: 1;
    transform: translateX(2px);
}

/* RTL Support for Arabic pages */
[dir="rtl"] .country-arrow {
    right: auto;
    left: 0;
    transform: scaleX(-1);
}

[dir="rtl"] .country-card:hover .country-arrow {
    transform: scaleX(-1) translateX(2px);
}

[dir="rtl"] .country-content {
    text-align: right;
}

/* Responsive Design */
@media (max-width: 768px) {
    .countries {
        padding: 60px 0;
    }
    
    .countries .section-title {
        font-size: 2rem;
        margin-bottom: 2rem;
    }
    
    .countries .section-subtitle {
        font-size: 1rem;
        margin-bottom: 3rem;
    }
    
    .countries-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 16px;
    }
    
    .country-card {
        padding: 20px;
    }
    
    .country-title {
        font-size: 1.125rem;
    }
}

@media (max-width: 480px) {
    .countries-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .country-card {
        padding: 16px;
    }
    
    .country-flag {
        width: 56px;
        height: 42px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .country-card {
        border-width: 2px;
    }
    
    .country-card:hover {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .country-card {
        transition: none;
    }
    
    .country-card:hover {
        transform: none;
    }
    
    .country-arrow {
        transition: none;
    }
    
    .country-card:hover .country-arrow {
        transform: none;
    }
    
    [dir="rtl"] .country-card:hover .country-arrow {
        transform: scaleX(-1);
    }
}

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

.countries-grid.loading .country-card {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* Print styles */
@media print {
    .countries {
        background: white;
        color: black;
    }
    
    .country-card {
        background: white;
        border: 1px solid #ccc;
        box-shadow: none;
        break-inside: avoid;
    }
    
    .country-arrow {
        display: none;
    }
}
