/* AIFG Global Styles */

/* Common Card Styles */
.film-card, .people-card, .tribe-card, .collection-card {
    transition: all 0.3s ease;
    border-radius: 8px;
    overflow: hidden;
    margin: 0 auto;
    padding: 1.3rem;
}

.film-card:hover, .people-card:hover, .tribe-card:hover, .collection-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* AIFG Color Scheme */
:root {
    --aifg-primary: #8B4513; /* Saddle Brown - earth tone */
    --aifg-secondary: #CD853F; /* Peru - warm earth */
    --aifg-accent: #D2691E; /* Chocolate */
    --aifg-success: #228B22; /* Forest Green */
    --aifg-info: #4682B4; /* Steel Blue */
    --aifg-warning: #DAA520; /* Golden Rod */
    --aifg-light: #F5F5DC; /* Beige */
    --aifg-dark: #2F1B14; /* Dark Brown */
    --aifg-text: #333333;
    --aifg-bg: #FEFEFE; 
}


/* Override default theme colors with AIFG branding */
/* .entry-title a,
.page-title,
.film-title a,
.people-name a,
.tribe-name a {
    color: var(--aifg-primary) !important;
} */

/* .button, .btn, .wp-block-button__link {
    background-color: var(--aifg-primary) !important;
    border-color: var(--aifg-primary) !important;
}

.button:hover, .btn:hover, .wp-block-button__link:hover {
    background-color: var(--aifg-dark) !important;
    border-color: var(--aifg-dark) !important;
} */

/* Navigation Styling */
.main-navigation a {
    color: var(--aifg-text);
}

.main-navigation a:hover {
    color: var(--aifg-primary);
}

/* Film Grid Responsive */
.films-grid {
    display: grid;
    gap: 25px;
    margin: 0 auto;
    padding: 3rem;
}

@media (min-width: 768px) {
    .films-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .films-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .films-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Filter Form Styling */
.filter-form, .archive-filter-form {
    background: var(--aifg-light);
    border: 1px solid var(--aifg-secondary);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.filter-form select, .archive-filter-form select {
    border: 1px solid var(--aifg-secondary);
    border-radius: 4px;
    padding: 8px 12px;
}

/* Taxonomy Page Headers */
.taxonomy-header, .people-archive-header, .tribe-archive-header {
    background: linear-gradient(135deg, var(--aifg-light) 0%, rgba(205, 133, 63, 0.1) 100%);
    border: 1px solid var(--aifg-secondary);
}

/* Breadcrumb Styling */
.breadcrumb {
    font-size: 0.9em;
    margin: 15px 0;
}

.breadcrumb a {
    color: var(--aifg-primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Meta Information */
.film-meta, .people-meta, .tribe-meta {
    color: #666;
    font-size: 0.9em;
    line-height: 1.6;
}

.meta-label, .tax-label {
    font-weight: bold;
    color: var(--aifg-dark);
}

/* Pagination */
.pagination, .archive-pagination, .taxonomy-pagination {
    text-align: center;
    margin: 40px 0;
}

.page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 2px;
    text-decoration: none;
    border: 1px solid var(--aifg-secondary);
    color: var(--aifg-primary);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.page-numbers:hover,
.page-numbers.current {
    background: var(--aifg-primary);
    color: white;
    border-color: var(--aifg-primary);
}

/* Interactive Map Styling */
.map-container {
    background: linear-gradient(135deg, var(--aifg-light) 0%, rgba(139, 69, 19, 0.05) 100%);
    border: 2px solid var(--aifg-secondary);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.map-placeholder {
    text-align: center;
    color: var(--aifg-text);
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.map-info h3, .map-info h4 {
    color: var(--aifg-primary);
    margin-bottom: 15px;
}

/* Interactive Map */
.aifg-interactive-map {
    width: 100%;
    height: auto;
    max-width: 100%;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: white;
}

/* Map SVG styling */
.aifg-interactive-map svg {
    width: 100%;
    height: auto;
    max-width: 100%;
}

/* Responsive map scaling */
@media (max-width: 768px) {
    .aifg-interactive-map {
        max-width: 95%;
    }
    
    .map-container {
        padding: 15px;
        margin: 15px 0;
    }
}

@media (max-width: 480px) {
    .aifg-interactive-map {
        max-width: 100%;
    }
    
    .map-container {
        padding: 10px;
        border-radius: 8px;
    }
}

/* Map region hover effects */
.tribal-region {
    cursor: pointer;
    transition: all 0.3s ease;
}

.tribal-region:hover {
    opacity: 1 !important;
    stroke-width: 2 !important;
    filter: brightness(1.1);
}

.tribal-region:focus {
    outline: 2px solid var(--aifg-primary);
    outline-offset: 2px;
}

/* Map loading state */
.map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: var(--aifg-text);
}

.map-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid var(--aifg-light);
    border-top: 4px solid var(--aifg-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tribal info tooltip */
.tribal-tooltip {
    position: absolute;
    background: rgba(47, 27, 20, 0.95);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.tribal-tooltip.visible {
    opacity: 1;
}

.tribal-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border: 5px solid transparent;
    border-top-color: rgba(47, 27, 20, 0.95);
}

/* Map controls */
.map-controls {
    margin: 15px 0;
    text-align: center;
}

.map-search {
    max-width: 300px;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--aifg-secondary);
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 10px;
}

.map-search:focus {
    outline: none;
    border-color: var(--aifg-primary);
    box-shadow: 0 0 0 2px rgba(139, 69, 19, 0.2);
}

.map-filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.map-filter-btn {
    padding: 6px 12px;
    border: 1px solid var(--aifg-secondary);
    background: white;
    color: var(--aifg-text);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.map-filter-btn:hover,
.map-filter-btn.active {
    background: var(--aifg-primary);
    color: white;
    border-color: var(--aifg-primary);
}

/* Map legend */
.map-legend {
    margin: 15px 0;
    padding: 15px;
    background: rgba(245, 245, 220, 0.5);
    border-radius: 8px;
    border: 1px solid var(--aifg-secondary);
}

.map-legend h5 {
    margin: 0 0 10px 0;
    color: var(--aifg-dark);
    font-size: 14px;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid #333;
}

/* Map statistics */
.map-stats {
    margin: 15px 0;
    font-size: 14px;
    color: var(--aifg-text);
}

.map-stats strong {
    color: var(--aifg-primary);
}

/* Accessibility improvements */
.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;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .tribal-region {
        stroke-width: 2 !important;
    }
    
    .map-container {
        border-width: 3px;
    }
    
    .tribal-tooltip {
        background: black;
        border: 2px solid white;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .tribal-region,
    .map-loading::after,
    .tribal-tooltip {
        animation: none;
        transition: none;
    }
}

/* Related Content Sections */
.related-films-section,
.related-terms-section {
    border-top: 2px solid var(--aifg-secondary);
    margin-top: 40px;
    padding-top: 30px;
}

.related-films-section h3,
.related-terms-section h3 {
    color: var(--aifg-primary);
}

/* Accessibility Improvements */
.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;
}

/* Focus States */
a:focus,
button:focus,
select:focus,
input:focus {
    outline: 2px solid var(--aifg-primary);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .filter-form,
    .archive-filter-form,
    .pagination,
    .related-terms-section {
        display: none;
    }
    
    .film-card,
    .people-card,
    .tribe-card {
        break-inside: avoid;
        margin-bottom: 20px;
    }
}

/* Dark Mode Support (if theme supports it) */
@media (prefers-color-scheme: dark) {
    :root {
        --aifg-bg: #1a1a1a;
        --aifg-text: #e0e0e0;
        --aifg-light: #2d2d2d;
    }
    
    .film-card,
    .people-card,
    .tribe-card,
    .collection-card {
        background: var(--aifg-light);
        border-color: #444;
    }
}

/* Custom WordPress Block Styling */
.wp-block-group {
    margin: 30px 0;
}

.wp-block-columns {
    gap: 30px;
}

/* AIFG Specific Helper Classes */
.aifg-highlight {
    background: var(--aifg-warning);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: bold;
}

.aifg-badge {
    display: inline-block;
    background: var(--aifg-info);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
}

.aifg-text-center {
    text-align: center;
}

.aifg-text-right {
    text-align: right;
}

.aifg-mb-0 { margin-bottom: 0; }
.aifg-mb-1 { margin-bottom: 10px; }
.aifg-mb-2 { margin-bottom: 20px; }
.aifg-mb-3 { margin-bottom: 30px; }

.aifg-mt-0 { margin-top: 0; }
.aifg-mt-1 { margin-top: 10px; }
.aifg-mt-2 { margin-top: 20px; }
.aifg-mt-3 { margin-top: 30px; }

/* Leaflet Map Styles */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.aifg-interactive-map {
    position: relative;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.aifg-interactive-map .leaflet-container {
    border-radius: 8px;
}

/* Map loading and error states */
.map-placeholder,
.map-fallback,
.map-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    background: #f8f9fa;
    color: #666;
    text-align: center;
    padding: 40px 20px;
}

.map-placeholder h4,
.map-fallback h3,
.map-error h3 {
    color: var(--aifg-primary);
    margin-bottom: 15px;
}

.loading-spinner {
    margin: 20px auto;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--aifg-primary);
    border-radius: 50%;
    animation: spin 2s linear infinite;
}

/* Map controls styling */
.map-controls {
    margin-bottom: 20px;
}

.map-search {
    width: 100%;
    max-width: 400px;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.map-search:focus {
    outline: none;
    border-color: var(--aifg-primary);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

/* Map legend and info */
.map-legend,
.map-stats {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.map-legend h5 {
    color: var(--aifg-primary);
    margin-bottom: 15px;
    font-size: 16px;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .aifg-interactive-map {
        height: 400px !important;
    }
    
    .legend-items {
        flex-direction: column;
        gap: 10px;
    }
    
    .map-controls {
        margin-bottom: 15px;
    }
    
    .map-search {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}