:root {
    --primary: #C02C38;
    --primary-light: #d64450;
    --primary-dark: #a02530;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    overflow-x: hidden;
}

.header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header .container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    gap: 20px;
    align-items: center;
}

.header-link {
    text-decoration: none;
    color: var(--gray-700);
    font-weight: 600;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
}

.header-link:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.admin-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gray-100);
    color: var(--gray-600);
    transition: all 0.2s;
    text-decoration: none;
}

.admin-button:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

.progress-badge {
    display: flex;
    align-items: baseline;
    gap: 4px;
    padding: 8px 16px;
    background: var(--gray-100);
    border-radius: 20px;
    font-weight: 600;
}

.progress-count {
    font-size: 24px;
    color: var(--primary);
}

.progress-separator {
    font-size: 18px;
    color: var(--gray-400);
}

.progress-total {
    font-size: 18px;
    color: var(--gray-600);
}

.progress-label {
    font-size: 13px;
    color: var(--gray-600);
    margin-left: 4px;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 450px;
    height: calc(100vh - 70px);
    max-width: 1600px;
    margin: 0 auto;
}

.map-container {
    position: relative;
    padding: 30px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.map-wrapper {
    flex: 1;
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    min-height: 500px;
}

#mapWrapper {
    width: 100%;
    height: 100%;
}

.leaflet-container {
    font-family: inherit;
}

.leaflet-control-attribution {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.8);
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    color: var(--gray-600);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.legend {
    display: flex;
    gap: 30px;
    background: var(--white);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
}

.legend-color {
    width: 30px;
    height: 20px;
    border-radius: 4px;
    border: 1.5px solid var(--white);
    box-shadow: var(--shadow-sm);
}

.legend-color.completed {
    background: var(--primary);
}

.legend-color.pending {
    background: #d3d3d3;
}

.search-container {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid var(--gray-300);
    border-radius: 12px;
    font-size: 15px;
    background: var(--white);
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 50;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--gray-50);
}

.search-result-name {
    font-weight: 500;
    color: var(--gray-900);
}

.search-result-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.search-result-badge.completed {
    background: #d1fae5;
    color: #065f46;
}

.search-result-badge.pending {
    background: #fee2e2;
    color: #991b1b;
}

.search-no-results {
    padding: 30px 20px;
    text-align: center;
    color: var(--gray-500);
}

.video-panel {
    background: var(--white);
    border-left: 1px solid var(--gray-200);
    overflow-y: auto;
    position: relative;
}

.close-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--gray-100);
    color: var(--gray-700);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.close-panel:hover {
    background: var(--gray-200);
    transform: scale(1.05);
}

.panel-content {
    padding: 30px;
}

.panel-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 20px;
    color: var(--gray-500);
}

.panel-placeholder svg {
    margin-bottom: 20px;
    opacity: 0.3;
}

.panel-placeholder h3 {
    font-size: 20px;
    color: var(--gray-700);
    margin-bottom: 10px;
}

.panel-placeholder p {
    font-size: 14px;
}

.county-header {
    margin-bottom: 30px;
}

.county-name {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.video-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 15px;
}

.video-description {
    font-size: 15px;
    color: var(--gray-700);
    line-height: 1.7;
    margin-bottom: 25px;
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    margin-bottom: 25px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.nebula-only-notice {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 25px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1) 0%, rgba(0, 153, 255, 0.1) 100%);
    border: 2px solid rgba(0, 153, 255, 0.3);
    border-radius: 12px;
}

.nebula-only-notice svg {
    margin-bottom: 15px;
}

.nebula-only-notice h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.nebula-only-notice p {
    font-size: 14px;
    color: var(--gray-600);
}

.video-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.youtube-link,
.nebula-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 28px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 200px;
    justify-content: center;
}

.youtube-link {
    background: #FF0000;
    color: white;
    box-shadow: 0 2px 8px rgba(255, 0, 0, 0.3);
}

.youtube-link:hover {
    background: #cc0000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.4);
}

.nebula-link {
    background: linear-gradient(135deg, #00D4FF 0%, #0099FF 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 153, 255, 0.3);
}

.nebula-link:hover {
    background: linear-gradient(135deg, #00BFEA 0%, #0088EA 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 153, 255, 0.4);
}

.youtube-link svg,
.nebula-link svg {
    width: 24px;
    height: 24px;
}

.coming-soon {
    text-align: center;
    padding: 60px 20px;
}

.coming-soon-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
}

.coming-soon h3 {
    font-size: 22px;
    color: var(--gray-800);
    margin-bottom: 10px;
}

.coming-soon p {
    font-size: 15px;
    color: var(--gray-600);
}

.tooltip {
    position: fixed;
    background: var(--gray-900);
    color: var(--white);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.tooltip.active {
    opacity: 0.95;
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .video-panel {
        border-left: none;
        border-top: 1px solid var(--gray-200);
        min-height: 500px;
    }
    
    .map-container {
        min-height: 70vh;
    }
}

@media (max-width: 768px) {
    .header .container {
        padding: 0 20px;
        height: 60px;
    }
    
    .logo {
        font-size: 18px;
    }
    
    .progress-badge {
        padding: 6px 12px;
    }
    
    .progress-count {
        font-size: 20px;
    }
    
    .progress-separator,
    .progress-total {
        font-size: 16px;
    }
    
    .progress-label {
        display: none;
    }
    
    .map-container {
        padding: 20px;
    }
    
    .map-wrapper {
        padding: 20px;
    }
    
    .legend {
        flex-direction: column;
        gap: 15px;
    }
    
    .panel-content {
        padding: 20px;
    }
    
    .county-name {
        font-size: 24px;
    }
    
    .video-title {
        font-size: 18px;
    }
    
    .main-content {
        height: auto;
    }
    
    .video-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 200;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }
    
    .video-panel.active {
        transform: translateY(0);
    }
    
    .video-panel:not(.has-content) {
        display: none;
    }
}

@media (max-width: 480px) {
    .search-input {
        font-size: 14px;
        padding: 12px 16px;
    }
    
    .youtube-link {
        width: 100%;
        justify-content: center;
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-in;
}

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

/* Popup Notification Styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.popup-overlay.popup-show {
    opacity: 1;
}

.popup-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    padding: 32px;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.popup-overlay.popup-show .popup-container {
    transform: scale(1);
}

.popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--gray-500);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.popup-close:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.popup-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 16px 0;
}

.popup-message {
    color: var(--gray-700);
    line-height: 1.7;
    font-size: 16px;
}

@media (max-width: 600px) {
    .popup-container {
        padding: 24px;
    }
    
    .popup-title {
        font-size: 20px;
    }
    
    .popup-message {
        font-size: 15px;
    }
}

/* Footer Styles */
.footer {
    background: var(--gray-900);
    color: var(--gray-300);
    padding: 40px 20px 20px;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.footer-section {
    padding: 10px;
}

.footer-section h4 {
    color: var(--white);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-section p {
    line-height: 1.7;
    font-size: 14px;
    margin-bottom: 12px;
}

.disclaimer {
    color: var(--gray-400);
    font-size: 14px;
}

.disclaimer strong {
    color: var(--white);
}

.footer-section a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-section a:hover {
    color: #8b9cff;
    text-decoration: underline;
}

.footer-links {
    text-align: center;
    color: var(--gray-400);
    font-size: 14px;
}

.footer-links a {
    color: var(--gray-400);
}

.footer-links a.admin-link {
    color: var(--gray-500);
    font-size: 12px;
}

.footer-links a.admin-link:hover {
    color: var(--gray-300);
}

.copyright {
    text-align: center;
    color: var(--gray-500);
    font-size: 13px;
    margin-top: 8px;
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .footer-section {
        padding: 5px;
    }
    
    .footer-section h4 {
        font-size: 14px;
    }
    
    .footer-section p {
        font-size: 13px;
    }
}

/* Markdown Content Styles */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--white);
}

.markdown-content h1 {
    font-size: 28px;
    border-bottom: 2px solid var(--gray-700);
    padding-bottom: 8px;
}

.markdown-content h2 {
    font-size: 24px;
    border-bottom: 1px solid var(--gray-800);
    padding-bottom: 6px;
}

.markdown-content h3 {
    font-size: 20px;
}

.markdown-content strong {
    color: var(--white);
    font-weight: 700;
}

.markdown-content em {
    font-style: italic;
}

.markdown-content a {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px dotted var(--primary);
    transition: all 0.2s;
}

.markdown-content a:hover {
    color: #8b9cff;
    border-bottom-style: solid;
}

.markdown-content code {
    background: var(--gray-800);
    color: #a9dc76;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
}

.markdown-content pre {
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    margin: 16px 0;
}

.markdown-content pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    color: #d3d3d3;
}

.markdown-content ul {
    list-style: disc;
    margin-left: 24px;
    margin-bottom: 16px;
}

.markdown-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.markdown-content p {
    margin-bottom: 12px;
}
