/* Reset and Base Styles */
@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Raleway', sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    padding: 10px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Header Styles */
.main-header {
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid #ddd;
}

/* Page Title */
h1 {
    color: #333;
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 10px;
}

/* Info Panel */
#info-concello {
    background: #ffffff;
    padding: 15px 20px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
    color: #626263;
    /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); */
    transition: all 0.3s ease;
    /* border: 1px solid #ddd; */
}

#info-concello:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Map Container - Mobile First */
.map-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    background: #ffffff;
    padding: 10px;
    /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #ddd; */
    overflow: hidden;
}

/* SVG Map Wrapper */
.map-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.map-wrapper svg {
    max-width: 100%;
    max-height: 70vh;
    height: auto;
    width: auto;
    display: block;
}

/* Concello Styles */
.concello {
    fill: #e3e3e3;
    stroke: #e3e3e3;
    stroke-width: 1.5px;
    transition: all 0.3s ease;
    cursor: pointer;
    pointer-events: none;
}

.concello-active {
    cursor: pointer;
    pointer-events: visible;
    filter: drop-shadow(0 0 8px rgb(179, 181, 187));
}

.concello-active:hover {
    filter: brightness(2) drop-shadow(0 0 8px rgb(31, 39, 75));
}

/* Side Block - Race List */
.side-block {
    width: 100%;
    padding: 25px;
    background: #fafafa;
}

.side-block h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

.side-block ul {
    list-style-type: none;
    padding: 0;
}

.side-block li {
    background: #ffffff;
    padding: 15px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #ddd;
}

.side-block li:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    background: #f9f9f9;
}

.side-block li:last-child {
    margin-bottom: 0;
}

.side-block li strong {
    color: #626263;
    font-size: 1.1rem;
    display: block;
    margin-bottom: 8px;
}

.side-block li small {
    color: #666;
    font-size: 0.9rem;
    display: block;
    line-height: 1.6;
}

/* Race Card Buttons */
.race-buttons {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.race-btn {
    flex: 1;
    padding: 8px 12px;
    text-align: center;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid;
    cursor: pointer;
    display: inline-block;
}

.race-btn-primary {
    background: #626263;
    color: white;
}

.race-btn-primary:hover {
    background: #2c2c2c;
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
}

.race-btn-secondary {
    background: white;
    color: #626263;
    border-color: #626263;
}

.race-btn-secondary:hover {
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
}

/* Tooltip Styles */
#race-tooltip {
    position: fixed;
    background: #b9b9b999;
    padding: 15px 20px;
    font-size: 14px;
    pointer-events: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-width: 280px;
}

#race-tooltip strong {
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
}

#race-tooltip div {
    margin: 4px 0;
    line-height: 1.5;
}

/* Hero Section */
.hero {
    background: #ffffff;
    padding: 40px 20px;
    text-align: center;
    margin-top: 30px;
    /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #ddd; */
}

.hero p {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 20px;
    line-height: 1.6;
}

.button {
    display: inline-block;
    background: #626263;
    color: white;
    padding: 12px 30px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.4);
    border: 1px solid #5568d3;
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.6);
    background: #5568d3;
}

/* Features Section */
.features {
    background: #ffffff;
    padding: 40px 20px;
    margin-top: 30px;
    /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #ddd; */
}

.features h2 {
    color: #626263;
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.8rem;
}

.features ul {
    list-style-type: none;
    max-width: 600px;
    margin: 0 auto;
}

.features li {
    background: #626263;
    color: white;
    padding: 15px 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #5568d3;
}

.features li:hover {
    transform: translateX(10px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    background: #5568d3;
}

/* Footer */
footer {
    background: #ffffff;
    padding: 10px;
    text-align: center;
    color: #626263;
    font-weight: 600;
    margin-top: 10px;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
    border-top: 1px solid #ddd;
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */

/* Small Mobile (up to 480px) */
@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }

    .side-block {
        padding: 20px 15px;
    }

    .side-block h3 {
        font-size: 1.3rem;
    }

    .side-block li {
        padding: 12px;
    }

    .race-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .race-btn {
        width: 100%;
    }

    .hero,
    .features {
        padding: 10px 15px;
    }
}

/* Tablet Breakpoint (768px and up) */
@media (min-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    .map-container {
        padding: 30px;
    }

    .side-block {
        order: 0;
    }

    .side-block ul {
        max-height: 500px;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: #ccc transparent;
    }

    .side-block ul::-webkit-scrollbar {
        width: 8px;
    }

    .side-block ul::-webkit-scrollbar-track {
        background: #f0f0f0;
    }

    .side-block ul::-webkit-scrollbar-thumb {
        background: #ccc;
    }

    .side-block ul::-webkit-scrollbar-thumb:hover {
        background: #999;
    }
}

/* Desktop/Laptop Breakpoint (1024px and up) - LARGER MAP */
@media (min-width: 1024px) {
    main {
        padding: 10px;
    }

    h1 {
        font-size: 2rem;
        margin-bottom: 5px;
    }

    .map-container {
        flex-direction: row;
        align-items: flex-start;
        padding: 10px;
        max-height: calc(100vh - 80px);
    }

    .map-wrapper {
        flex: 1;
        min-width: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    .map-wrapper svg {
        max-height: calc(100vh - 100px);
        max-width: 100%;
        width: auto;
        height: auto;
    }

    .side-block {
        width: 380px;
        flex-shrink: 0;
        order: 0;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }

    .side-block ul {
        max-height: none;
    }

    .hero {
        padding: 60px 40px;
    }

    .features {
        padding: 60px 40px;
    }
}

/* Large Desktop (1440px and up) */
@media (min-width: 1440px) {
    h1 {
        font-size: 2.5rem;
        margin-bottom: 10px;
    }

    .map-container {
        padding: 10px;
    }

    .side-block {
        width: 380px;
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */
@media (hover: none) and (pointer: coarse) {

    /* Improve touch targets */
    .side-block li {
        padding: 18px;
        margin-bottom: 15px;
    }

    .race-btn {
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    .button {
        padding: 15px 35px;
        font-size: 1.1rem;
    }

    /* Touch feedback */
    .concello:active {
        stroke: #626263;
        stroke-width: 3px;
    }

    .side-block li:active {
        transform: scale(0.98);
    }

    .race-btn:active {
        transform: scale(0.95);
    }

    .button:active {
        transform: scale(0.95);
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .concello {
        stroke-width: 2px;
    }

    .side-block li {
        border: 2px solid #626263;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    body {
        background: white;
    }

    .main-header,
    footer,
    .hero,
    .features,
    #race-tooltip {
        display: none;
    }

    .map-container {
        box-shadow: none;
        border: 1px solid #ccc;
        background: white;
    }

    .side-block {
        background: white;
        border: 1px solid #ccc;
    }

    h1 {
        font-size: 2.5rem;
    }

    .map-container {
        padding: 30px;
    }

    .side-block {
        order: 0;
    }

    .side-block ul {
        max-height: 500px;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: #ccc transparent;
    }

    .side-block ul::-webkit-scrollbar {
        width: 8px;
    }

    .side-block ul::-webkit-scrollbar-track {
        background: #f0f0f0;
    }

    .side-block ul::-webkit-scrollbar-thumb {
        background: #ccc;
    }

    .side-block ul::-webkit-scrollbar-thumb:hover {
        background: #999;
    }
}

/* Desktop/Laptop Breakpoint (1024px and up) - LARGER MAP */
@media (min-width: 1024px) {
    main {
        padding: 10px;
    }

    h1 {
        font-size: 2rem;
        margin-bottom: 5px;
    }

    .map-container {
        flex-direction: row;
        align-items: flex-start;
        padding: 10px;
        max-height: calc(100vh - 80px);
    }

    .map-wrapper {
        flex: 1;
        min-width: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    .map-wrapper svg {
        max-height: calc(100vh - 100px);
        max-width: 100%;
        width: auto;
        height: auto;
    }

    .side-block {
        width: 380px;
        flex-shrink: 0;
        order: 0;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }

    .side-block ul {
        max-height: none;
    }

    .hero {
        padding: 60px 40px;
    }

    .features {
        padding: 60px 40px;
    }
}

/* Large Desktop (1440px and up) */
@media (min-width: 1440px) {
    h1 {
        font-size: 2.5rem;
        margin-bottom: 10px;
    }

    .map-container {
        padding: 10px;
    }

    .side-block {
        width: 380px;
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */
@media (hover: none) and (pointer: coarse) {

    /* Improve touch targets */
    .side-block li {
        padding: 18px;
        margin-bottom: 15px;
    }

    .race-btn {
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    .button {
        padding: 15px 35px;
        font-size: 1.1rem;
    }

    /* Touch feedback */
    .concello:active {
        stroke: #626263;
        stroke-width: 3px;
    }

    .side-block li:active {
        transform: scale(0.98);
    }

    .race-btn:active {
        transform: scale(0.95);
    }

    .button:active {
        transform: scale(0.95);
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .concello {
        stroke-width: 2px;
    }

    .side-block li {
        border: 2px solid #626263;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    body {
        background: white;
    }

    .main-header,
    footer,
    .hero,
    .features,
    #race-tooltip {
        display: none;
    }

    .map-container {
        box-shadow: none;
        border: 1px solid #ccc;
        background: white;
    }

    .side-block {
        background: white;
        border: 1px solid #ccc;
    }

    .side-block h3,
    .side-block li strong {
        color: #000;
    }

    .race-buttons {
        display: none;
    }
}

/* Highlight Card Animation */
.highlight-card {
    animation: highlight 2s ease-out;
    border-color: #626263 !important;
}

@keyframes highlight {
    0% {
        background-color: #fff;
    }

    10% {
        background-color: #e6f0ff;
        transform: scale(1.02);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    }

    .side-block ul::-webkit-scrollbar-thumb {
        background: #ccc;
    }

    .side-block ul::-webkit-scrollbar-thumb:hover {
        background: #999;
    }
}

/* Desktop/Laptop Breakpoint (1024px and up) - LARGER MAP */
@media (min-width: 1024px) {
    main {
        padding: 10px;
    }

    h1 {
        font-size: 2rem;
        margin-bottom: 5px;
    }

    .map-container {
        flex-direction: row;
        align-items: flex-start;
        padding: 10px;
        max-height: calc(100vh - 80px);
    }

    .map-wrapper {
        flex: 1;
        min-width: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    .map-wrapper svg {
        max-height: calc(100vh - 100px);
        max-width: 100%;
        width: auto;
        height: auto;
    }

    .side-block {
        width: 380px;
        flex-shrink: 0;
        order: 0;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }

    .side-block ul {
        max-height: none;
    }

    .hero {
        padding: 60px 40px;
    }

    .features {
        padding: 60px 40px;
    }
}

/* Large Desktop (1440px and up) */
@media (min-width: 1440px) {
    h1 {
        font-size: 2.5rem;
        margin-bottom: 10px;
    }

    .map-container {
        padding: 10px;
    }

    .side-block {
        width: 380px;
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */
@media (hover: none) and (pointer: coarse) {

    /* Improve touch targets */
    .side-block li {
        padding: 18px;
        margin-bottom: 15px;
    }

    .race-btn {
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    .button {
        padding: 15px 35px;
        font-size: 1.1rem;
    }

    /* Touch feedback */
    .concello:active {
        stroke: #626263;
        stroke-width: 3px;
    }

    .side-block li:active {
        transform: scale(0.98);
    }

    .race-btn:active {
        transform: scale(0.95);
    }

    .button:active {
        transform: scale(0.95);
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .concello {
        stroke-width: 2px;
    }

    .side-block li {
        border: 2px solid #626263;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    body {
        background: white;
    }

    .main-header,
    footer,
    .hero,
    .features,
    #race-tooltip {
        display: none;
    }

    .map-container {
        box-shadow: none;
        border: 1px solid #ccc;
        background: white;
    }

    .side-block {
        background: white;
        border: 1px solid #ccc;
    }

    .side-block h3,
    .side-block li strong {
        color: #000;
    }

    .race-buttons {
        display: none;
    }
}

/* Highlight Card Animation */
.highlight-card {
    animation: highlight 2s ease-out;
    border-color: #626263 !important;
}

@keyframes highlight {
    0% {
        background-color: #fff;
    }

    10% {
        background-color: #e6f0ff;
        transform: scale(1.02);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    }

    80% {
        background-color: #e6f0ff;
    }

    100% {
        background-color: #fff;
        transform: scale(1);
    }
}

/* More Info Toggle */
.more-info-toggle {
    color: #626263;
    cursor: pointer;
    font-size: 0.9rem;
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
    border-top: 1px dashed #ddd;
    border-bottom: 1px dashed #ddd;
    transition: all 0.3s ease;
}

.more-info-toggle:hover {
    color: #333;
    background: #f9f9f9;
}

.toggle-icon {
    font-size: 0.8rem;
}

/* Race Details */
.race-details {
    background: #f0f4ff;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    animation: fadeIn 0.3s ease;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 3px;
}

.detail-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.detail-label {
    font-weight: 600;
    color: #555;
}

.detail-value {
    color: #333;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Race Tags */
.race-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
}

.race-tag {
    background-color: #e0e0e0;
    color: #333;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    display: inline-block;
}

.leyenda-tag-near {
    background-color: #73AF6F;
    color: #333;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    display: inline-block;
}

.leyenda-tag-medium {
    background-color: #007E6E;
    color: #333;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    display: inline-block;
}

.leyenda-tag-far {
    background-color: #D7C097;
    color: #333;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    display: inline-block;
}