@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;800&display=swap');

:root {
    --blue-main: rgb(58, 123, 202);

    --text-color: rgb(48, 48, 48);
    --text-color-blue: rgb(70, 150, 240);
    
    --emphasis-color: rgba(20, 170, 90, 0.25);
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;

    /* Box shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Grid overlay */
    --grid-highlight: rgba(255, 235, 59, 0.7);
    --grid-darken: rgba(0, 0, 0, 0.3);
    --overlay-bg: rgba(0, 0, 0, 0.7);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    
    
    /* Typography */
    --font-size: 1rem;
    --font-size-small: 0.875rem;
    --font-size-large: 1.125rem;
    --font-family: 'Nunito', 'Segoe UI', 'Roboto', sans-serif;
}

/* Base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    line-height: 1.3;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
}

h3 {
    color: var(--text-color-blue);
}

.overlay-content h3 {
    color: white;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header styles */
header {
    text-align: center;
    margin-bottom: 1rem;
    padding: 2rem 0;
    background: var(--blue-main);
    color: white;
    box-shadow: var(--shadow-md);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Search section (placeholder styling) */
.search-section {
    margin-bottom: 0.5rem;
}

.search-container {
    position: relative;
    /* min-width: 440px; */
    max-width: 80vw;
    margin: 0 auto;
}

#pokemon-search {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: var(--transition-fast);
    background-color: var(--surface-color);
}

#pokemon-search:focus {
    outline: none;
    border-color: var(--blue-main);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#pokemon-search:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Search input row with dropdown */
.search-input-row {
    display: flex;
    gap: 0.5rem;
}

#pokemon-search {
    flex: 1;
    width: auto;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: var(--transition-fast);
    background-color: var(--surface-color);
}

#language-selector {
    min-width: 180px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    background-color: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition-fast);
}

#language-selector:focus {
    outline: none;
    border-color: var(--blue-main);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#language-selector:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--background-color);
}

/* List */
ul li {
    text-align: left;
}

/* Filter section styles */
.filters-section {
    margin: 0 auto 0.5rem auto;
    max-width: 80vw;
    /* min-width: 440px; */
    padding: 0.5rem 2rem;
    background-color: var(--surface-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group h3 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-secondary);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.875rem;
    font-weight: 500;
    min-height: 44px; /* Accessibility: minimum touch target */
    flex: 1;
}

.filter-btn:hover {
    border-color: var(--blue-main);
    color: var(--blue-main);
    background-color: rgba(59, 130, 246, 0.05);
}

.filter-btn.active {
    background-color: var(--blue-main);
    border-color: var(--blue-main);
    color: white;
}

.filter-btn.active:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.filter-btn.unavailable {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: var(--background-color);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.filter-btn.unavailable:hover {
    border-color: var(--border-color);
    color: var(--text-secondary);
    background-color: var(--background-color);
}

/* Map section styles */
.map-section {
    margin-bottom: 0.5rem;
}

.map-container {
    position: relative;
    max-width: 80%;
    /* max-height: 80vw; */
    /* min-width: 440px; */
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.map-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.map-wrapper.active {
    opacity: 1;
    visibility: visible;
}

.region-map {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Grid overlay styles */
.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    pointer-events: none;
    z-index: 2;
}

.grid-cell {
    /* border: 1px solid rgba(255, 255, 255, 0.1); */
    transition: background-color var(--transition-fast);
}

.grid-cell.highlighted {
    background-color: var(--grid-highlight);
    /* border-color: rgba(255, 235, 59, 0.9); */
}

/* Area Zero specific grid styling - inverted behavior */
.grid-cell.darkened {
    background-color: var(--overlay-bg);
    box-shadow: 0 0 0 2px var(--overlay-bg) inset;
    /* border-color: rgba(0, 0, 0, 0.2); */
}

.grid-cell.area-zero-highlighted {
    background-color: transparent;
    box-shadow: 0 0 0 4px var(--grid-highlight) inset;
    /* border-color: rgba(255, 235, 59, 0.9); */
}

/* Not available overlay */
.not-available-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 1;
    visibility: visible;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

.not-available-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.overlay-content {
    text-align: center;
    color: white;
    padding: 2rem;
}

.overlay-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.overlay-content p {
    font-size: 1rem;
    opacity: 0.9;
    line-height: 1.5;
}

/* Text overlay for raids and other methods */
.text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 1;
    visibility: visible;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

.text-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.text-content {
    text-align: center;
    color: white;
    padding: 2rem;
    max-width: 80%;
}

.text-content .text-item {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 1rem;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.text-content .text-item:last-child {
    margin-bottom: 0;
}

/* Notes section */
.notes-section {
    padding: 0.5rem 1.5rem;
    background-color: var(--surface-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    max-width: 80vw;
    /* min-width: 440px; */
    margin: 0 auto 0.5rem auto;
}

.notes-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
}

.notes-content {
    color: var(--text-secondary);
    line-height: 1.6;
}

.notes-placeholder {
    font-style: italic;
    opacity: 0.7;
}

.notes-item {
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.notes-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* Focus styles for accessibility */
.filter-btn:focus {
    outline: 2px solid var(--blue-main);
    outline-offset: 2px;
}

.filter-btn:focus:not(:focus-visible) {
    outline: none;
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--surface-color);
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.search-results.hidden {
    display: none;
}

.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-fast);
    color: var(--text-color);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item.highlighted {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--blue-main);
}

.search-result-item:focus {
    outline: 2px solid var(--blue-main);
    outline-offset: -2px;
    background-color: rgba(59, 130, 246, 0.1);
}

/* Loading state for search */
.search-loading {
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
}

/* Screen reader only class */
.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;
}

/* Search container focus styles */
.search-container:focus-within #pokemon-search {
    border-color: var(--blue-main);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* No results styling */
.search-result-item.no-results {
    color: var(--text-secondary);
    font-style: italic;
    cursor: default !important;
    opacity: 0.7;
}

.search-result-item.no-results:hover {
    background-color: transparent;
    color: var(--text-secondary);
}

/* Loading state styling */
.loading-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.loading-message h3 {
    margin-bottom: 0.5rem;
}

/* ———————————————————— MISC CONTENT ———————————————————— */

.emphasis-block {
    max-width: 80vw;
    /* min-width: 440px; */
    padding: 0.5rem 2rem;
    margin: 0 auto 1.5rem auto;
    background-color: var(--emphasis-color);
    box-shadow: var(--shadow-sm);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-color);
}

/* ———————————————————— FOOTER CONTENT ———————————————————— */

.site-footer {
    background-color: var(--blue-main);
    color: white;
    padding: var(--spacing-md);
    text-align: center;
}

/* ———————————————————— MEDIA MODIFIERS ———————————————————— */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .grid-cell.highlighted {
        background-color: yellow;
        border-color: black;
    }
    
    .grid-cell.darkened {
        background-color: black;
        border-color: white;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* Responsive adjustments */
@media (max-width: 768px) {

    .filters-section {
        padding: 1rem;
    }

    .overlay-content,
    .text-content {
        padding: 1rem;
    }

    .text-content .text-item {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.5rem;
    }

    header {
        padding: 1.5rem 0;
        margin-bottom: 1.5rem;
    }

    header h1 {
        font-size: 2rem;
    }

    /* Swap to full-width to maximize the limited screen space for mobile */
    .map-container, .emphasis-block, .filters-section, .notes-section, .search-container {
        width: 100%;
        max-width: 100%;
    }

    .search-input-row {
        flex-direction: column;
    }

    #language-selector {
        min-width: auto;
    }

    .filter-buttons {
        flex-direction: column;
    }

    .filter-btn {
        width: 100%;
        justify-content: center;
    }
}
