/* CSS Variables for theme colors */
:root {
    --bg-color: #f5f5f5;
    --text-color: #333;
    --card-bg: white;
    --primary-color: #d0a83a;
    --header-color: #2c3e50;
    --subtext-color: #7f8c8d;
    --legend-bg: #f5f5f5;
    --tab-bg: #ecf0f1;
    --border-color: #bdc3c7;
    --shadow: rgba(0,0,0,0.1);
    --hover-bg: rgba(255,255,255,0.5);
    --nav-bg: white;
}

/* Accessibility - Visually hidden content for screen readers and SEO */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --card-bg: #2d2d2d;
    --primary-color: #f9bd18;
    --header-color: #f9bd18;
    --subtext-color: #b0b0b0;
    --legend-bg: #3d3d3d;
    --tab-bg: #3d3d3d;
    --border-color: #555;
    --shadow: rgba(0,0,0,0.3);
    --hover-bg: rgba(255,255,255,0.1);
    --nav-bg: #2d2d2d;
}

/* Dark mode theme toggle styles */
[data-theme="dark"] .theme-toggle-btn {
    background: #3d3d3d;
    border-color: #555;
}

[data-theme="dark"] .theme-toggle-btn .sun-icon {
    opacity: 0.3;
}

[data-theme="dark"] .theme-toggle-btn .moon-icon {
    opacity: 1;
}

[data-theme="dark"] .theme-toggle-btn::before {
    transform: translateX(28px);
    background: #2d2d2d;
}

/* Navigation Bar Styles */
.navbar {
    background: var(--nav-bg);
    box-shadow: 0 2px 10px var(--shadow);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.nav-row {
    position: absolute;
    width: 100%;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    pointer-events: none;
}

.nav-row > * {
    pointer-events: auto;
}

.nav-logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.logo-img {
    height: 40px;
    width: auto;
    max-width: 100px;
    border-radius: 4px;
    object-fit: contain;
    display: none; /* Hidden by default until logo is set */
}

.nav-title {
    text-align: center;
}

.nav-title h1 {
    color: var(--header-color);
    font-size: 1.8rem;
    margin: 0;
    font-weight: 700;
}

.nav-theme {
    display: flex;
    justify-content: flex-end;
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px 20px;
}

.theme-toggle-btn {
    background: var(--legend-bg);
    border: 2px solid var(--border-color);
    border-radius: 50px;
    width: 60px;
    height: 30px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px;
    font-size: 14px;
}

.theme-toggle-btn:hover {
    border-color: #95a5a6;
}

.theme-toggle-btn .sun-icon,
.theme-toggle-btn .moon-icon {
    transition: opacity 0.3s ease;
    line-height: 1;
}

.theme-toggle-btn .moon-icon {
    opacity: 0.3;
}

.theme-toggle-btn::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: var(--card-bg);
    border-radius: 50%;
    left: 2px;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px var(--shadow);
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    align-items: start;
}

.map-container {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 600px;
    transition: background-color 0.3s ease;
}

#turkey-map {
    width: 100%;
    max-width: 800px;
    height: auto;
    cursor: pointer;
}

.province {
    stroke: #fff;
    stroke-width: 1;
    transition: all 0.3s ease;
    cursor: pointer;
    fill: #ecf0f1; /* Default fallback color before JavaScript applies party colors */
}

.province:hover {
    stroke-width: 2;
    opacity: 0.8;
    transform: scale(1.02);
}

.province.selected {
    stroke: #2c3e50;
    stroke-width: 3;
}

/* Status indicators - colors applied dynamically from statusInfo */
.status-arrested {
    stroke-width: 3;
}

.status-detained {
    stroke-width: 3;
}

.status-trustee {
    stroke-width: 3;
}

.legend {
    margin-top: 20px;
    padding: 15px;
    background: var(--legend-bg);
    border-radius: 8px;
    width: 100%;
    max-width: none;
    transition: background-color 0.3s ease;
}

.legend h3 {
    margin-bottom: 15px;
    color: var(--header-color);
    font-size: 1.1rem;
    text-align: center;
}

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

.legend-item {
    display: flex;
    align-items: center;
    margin: 0;
    min-width: fit-content;
}

.color-box {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    margin-right: 10px;
    border: 1px solid var(--border-color);
}

.details-panel {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 20px;
    transition: background-color 0.3s ease;
    margin-bottom: 20px;
}

.stats-panel {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px var(--shadow);
    transition: background-color 0.3s ease;
}

.details-panel h2 {
    color: var(--header-color);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.details-panel h3 {
    color: var(--text-color);
    margin: 15px 0 8px 0;
    font-size: 1.1rem;
}

.details-panel p {
    color: var(--subtext-color);
    margin-bottom: 10px;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    margin-right: 5px;
}

/* Status badge colors applied dynamically from statusInfo */

.party-info {
    background-color: var(--legend-bg);
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
    transition: background-color 0.3s ease;
}

/* Tab bar styles */
.tab-bar {
    display: flex;
    background: var(--tab-bg);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 20px;
    box-shadow: inset 0 1px 3px var(--shadow);
    transition: background-color 0.3s ease;
}

.tab-button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--subtext-color);
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.tab-button:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
}

.tab-button.active {
    background: var(--card-bg);
    color: var(--primary-color);
    box-shadow: 0 2px 4px var(--shadow);
}

/* Dark mode styles for SVG provinces */
[data-theme="dark"] .province {
    stroke: #555;
}

[data-theme="dark"] .province:hover {
    stroke: #888;
}

[data-theme="dark"] .province.selected {
    stroke: #64b5f6;
}

/* Footer Styles */
.footer {
    background-color: var(--nav-bg);
    border-top: 1px solid var(--border-color);
    padding: 20px 0;
    margin-top: 40px;
    box-shadow: 0 -2px 10px var(--shadow);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 20px;
}

.social-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--card-bg);
    color: var(--text-color);
    text-decoration: none;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px var(--shadow);
}

.social-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--shadow);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.social-link svg {
    width: 24px;
    height: 24px;
    transition: all 0.3s ease;
}

/* Specific hover colors for each social platform */
.social-link:nth-child(1):hover {
    /* GitHub */
    background-color: #333;
    color: white;
    border-color: #333;
}

.social-link:nth-child(2):hover {
    /* Twitter/X */
    background-color: #000;
    color: white;
    border-color: #000;
}

.social-link:nth-child(3):hover {
    /* Instagram */
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
    border-color: #e6683c;
}

.social-link:nth-child(4):hover {
    /* TikTok - similar to Twitter/X */
    background-color: #000;
    color: white;
    border-color: #000;
}

/* Dark mode adjustments for social links */
[data-theme="dark"] .social-link:nth-child(1):hover {
    background-color: #f5f5f5;
    color: #333;
    border-color: #f5f5f5;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .details-panel {
        position: static;
        top: auto;
        margin-bottom: 20px;
    }
    
    .nav-title h1 {
        font-size: 1.5rem;
    }
    
    .container {
        padding: 20px 15px;
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 10px 15px;
        flex-direction: column;
        gap: 10px;
        position: relative;
        align-items: stretch;
    }
    
    .nav-row {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: static;
        transform: none;
        order: -1;
        padding: 0;
        pointer-events: auto;
    }
    
    .nav-logo {
        position: static;
        left: auto;
    }
    
    .nav-theme {
        position: static;
        right: auto;
    }
    
    .nav-title {
        order: 1;
        width: 100%;
        position: static;
        margin-top: 0;
    }
    
    .nav-title h1 {
        font-size: 1.3rem;
        text-align: center;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .map-container {
        padding: 15px;
        min-height: 400px;
    }
    
    .details-panel,
    .stats-panel {
        padding: 20px;
    }
    
    .legend-items {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: 10px;
        justify-items: start;
    }
    
    .legend-item {
        min-width: auto;
        font-size: 0.9rem;
        width: 100%;
        justify-self: start;
    }
    
    .tab-button {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    /* Footer responsive styles */
    .footer {
        padding: 15px 0;
        margin-top: 20px;
    }
    
    .social-links {
        gap: 15px;
    }
    
    .social-link {
        width: 44px;
        height: 44px;
    }
    
    .social-link svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px 10px;
    }
    
    .nav-container {
        padding: 10px;
    }
    
    .nav-row {
        padding: 0;
    }
    
    .nav-title h1 {
        font-size: 1.1rem;
    }
    
    .map-container {
        padding: 10px;
        min-height: 350px;
    }
    
    .details-panel,
    .stats-panel {
        padding: 15px;
    }
    
    .legend {
        padding: 10px;
    }
    
    .legend-items {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 2fr));
        gap: 8px;
        justify-items: start;
    }
    
    .legend-item {
        font-size: 0.85rem;
        width: 100%;
        justify-self: start;
    }
    
    .social-link {
        width: 40px;
        height: 40px;
    }
    
    .social-link svg {
        width: 18px;
        height: 18px;
    }
}
