/* CSS Variables */
:root {
    --primary-color: #1e5631;
    --primary-dark: #143d22;
    --secondary-color: #d4af37;
    --accent-color: #c41e3a;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #fff;
    --bg-light: #f8f9fa;
    --bg-dark: #1a1a2e;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s ease;
}

/* Reset and Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

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

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: 1em;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* Header */
.header {
    background: var(--bg-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.logo span {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin: 0;
}

.nav-menu {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-menu > li {
    position: relative;
}

.nav-menu > li > a {
    font-weight: 500;
    padding: 10px 0;
    display: block;
    color: var(--text-color);
}

.nav-menu > li > a:hover,
.nav-menu > li > a.active {
    color: var(--primary-color);
}

/* Dropdown */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-color);
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 100;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li a {
    display: block;
    padding: 10px 20px;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

.dropdown-menu li:last-child a {
    border-bottom: none;
}

.dropdown-menu li a:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

/* Mobile Navigation */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.nav-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--text-color);
    border-radius: 2px;
    transition: var(--transition);
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--bg-color);
        flex-direction: column;
        gap: 0;
        padding: 20px;
        box-shadow: var(--shadow);
        transform: translateX(-100%);
        transition: var(--transition);
    }

    .nav-menu.active {
        transform: translateX(0);
    }

    .nav-menu > li {
        width: 100%;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-menu > li > a {
        padding: 15px 0;
    }

    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        display: none;
        padding-left: 20px;
    }

    .dropdown.active .dropdown-menu {
        display: block;
    }
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #2d7a4a 0%, var(--primary-color) 100%);
    color: white;
    padding: 40px 0;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #ffffff;
}

.hero p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto;
}

/* Map Section */
.map-section {
    padding: 30px 0;
}

.main-map {
    height: 500px;
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1;
}

.subpage-map {
    height: 450px;
}

.map-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.map-btn {
    padding: 10px 20px;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

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

/* Sections */
.regions-section,
.cities-section,
.thematic-section,
.info-section,
.content-section {
    padding: 60px 0;
}

.regions-section {
    background: var(--bg-light);
}

.thematic-section {
    background: var(--bg-light);
}

section h2 {
    text-align: center;
    margin-bottom: 40px;
    color: var(--text-color);
}

/* Region Cards */
.regions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.region-card {
    background: var(--bg-color);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
    display: block;
    color: var(--text-color);
}

.region-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    color: var(--text-color);
}

.region-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.region-card h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.region-card p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin: 0;
}

/* City Cards */
.cities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.city-card {
    background: var(--bg-color);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
    display: block;
    color: var(--text-color);
    border: 2px solid transparent;
}

.city-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
}

.city-card h3 {
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 1.2rem;
}

.city-card p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin: 0;
}

/* Thematic Cards */
.thematic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.thematic-card {
    background: var(--bg-color);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: block;
    color: var(--text-color);
    border-left: 4px solid var(--primary-color);
}

.thematic-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-lg);
}

.thematic-card h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.thematic-card p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin: 0;
}

/* Info Section */
.info-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

.info-text h3 {
    margin-top: 20px;
    color: var(--primary-color);
}

.info-text ul {
    margin-top: 15px;
}

.info-text li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-sidebar {
    background: var(--bg-light);
    padding: 25px;
    border-radius: var(--radius-lg);
    height: fit-content;
}

.info-sidebar h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.popular-links li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.popular-links li:last-child {
    border-bottom: none;
}

.popular-links a {
    color: var(--text-color);
}

.popular-links a:hover {
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .info-content {
        grid-template-columns: 1fr;
    }
}

/* Content Section (for subpages) */
.content-section .content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

.content-section h2 {
    text-align: left;
}

.content-main h3 {
    color: var(--primary-color);
    margin-top: 25px;
    margin-bottom: 15px;
}

.content-main ul {
    margin: 15px 0;
    padding-left: 20px;
}

.content-main li {
    margin-bottom: 10px;
    position: relative;
}

.content-main li::before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: -15px;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.sidebar-card {
    background: var(--bg-light);
    padding: 25px;
    border-radius: var(--radius-lg);
}

.sidebar-card h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.sidebar-card ul li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-card ul li:last-child {
    border-bottom: none;
}

.sidebar-card a {
    color: var(--text-color);
}

.sidebar-card a:hover {
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .content-section .content-grid {
        grid-template-columns: 1fr;
    }
}

/* Quick Facts */
.quick-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 25px 0;
}

.fact-item {
    background: var(--bg-light);
    padding: 15px;
    border-radius: var(--radius);
    text-align: center;
}

.fact-item strong {
    display: block;
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.fact-item span {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* POI List */
.poi-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.poi-item {
    background: var(--bg-color);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 3px solid var(--primary-color);
}

.poi-item h4 {
    color: var(--primary-color);
    margin-bottom: 8px;
}

.poi-item p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 0;
}

/* Breadcrumb */
.breadcrumb {
    padding: 15px 0;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    gap: 10px;
}

.breadcrumb li:not(:last-child)::after {
    content: "/";
    color: var(--text-light);
}

.breadcrumb a {
    color: var(--text-light);
}

.breadcrumb a:hover {
    color: var(--primary-color);
}

.breadcrumb span {
    color: var(--text-color);
    font-weight: 500;
}

/* Footer */
.footer {
    background: var(--bg-dark);
    color: white;
    padding: 60px 0 30px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h4 {
    color: var(--secondary-color);
    margin-bottom: 20px;
}

.footer-col p {
    color: rgba(255,255,255,0.7);
    font-size: 0.95rem;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col ul a {
    color: rgba(255,255,255,0.7);
}

.footer-col ul a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-bottom p {
    color: rgba(255,255,255,0.5);
    font-size: 0.9rem;
}

.footer-bottom a {
    color: rgba(255,255,255,0.7);
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius);
}

.leaflet-popup-content {
    margin: 15px;
}

.leaflet-popup-content h4 {
    color: var(--primary-color);
    margin-bottom: 5px;
}

.leaflet-popup-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-light);
}

.leaflet-popup-content a {
    display: inline-block;
    margin-top: 10px;
    color: var(--primary-color);
    font-weight: 500;
}

/* Custom Marker Icons */
.marker-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.8rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .main-map {
        height: 350px;
    }

    .regions-grid,
    .thematic-grid {
        grid-template-columns: 1fr;
    }

    .cities-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    section {
        padding: 40px 0;
    }

    h2 {
        font-size: 1.6rem;
    }
}

@media (max-width: 480px) {
    .cities-grid {
        grid-template-columns: 1fr;
    }

    .map-controls {
        flex-direction: column;
    }

    .map-btn {
        width: 100%;
    }
}

/* Skip to Content */
.skip-to-content {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 12px 24px;
    border-radius: 0 0 var(--radius) var(--radius);
    z-index: 10000;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-to-content:focus {
    top: 0;
    color: white;
}

/* Focus Visible Styles */
*:focus-visible {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
}

a:focus-visible {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
    border-radius: 2px;
}

.map-btn:focus-visible {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.3);
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
}

/* Map Loading Spinner */
.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 500;
    text-align: center;
    pointer-events: none;
}

.map-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 10px;
}

.map-loading span {
    font-size: 0.9rem;
    color: var(--text-light);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.map-section .container {
    position: relative;
}

/* Section Reveal Animations */
.reveal-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-section.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Card Stagger Animation */
.reveal-section.revealed .region-card,
.reveal-section.revealed .city-card,
.reveal-section.revealed .thematic-card {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

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

.reveal-section.revealed .region-card:nth-child(1),
.reveal-section.revealed .city-card:nth-child(1),
.reveal-section.revealed .thematic-card:nth-child(1) { animation-delay: 0.05s; }
.reveal-section.revealed .region-card:nth-child(2),
.reveal-section.revealed .city-card:nth-child(2),
.reveal-section.revealed .thematic-card:nth-child(2) { animation-delay: 0.1s; }
.reveal-section.revealed .region-card:nth-child(3),
.reveal-section.revealed .city-card:nth-child(3),
.reveal-section.revealed .thematic-card:nth-child(3) { animation-delay: 0.15s; }
.reveal-section.revealed .region-card:nth-child(4),
.reveal-section.revealed .city-card:nth-child(4),
.reveal-section.revealed .thematic-card:nth-child(4) { animation-delay: 0.2s; }
.reveal-section.revealed .region-card:nth-child(5),
.reveal-section.revealed .city-card:nth-child(5),
.reveal-section.revealed .thematic-card:nth-child(5) { animation-delay: 0.25s; }
.reveal-section.revealed .region-card:nth-child(6),
.reveal-section.revealed .city-card:nth-child(6),
.reveal-section.revealed .thematic-card:nth-child(6) { animation-delay: 0.3s; }
.reveal-section.revealed .region-card:nth-child(7),
.reveal-section.revealed .city-card:nth-child(7),
.reveal-section.revealed .thematic-card:nth-child(7) { animation-delay: 0.35s; }
.reveal-section.revealed .region-card:nth-child(8),
.reveal-section.revealed .city-card:nth-child(8),
.reveal-section.revealed .thematic-card:nth-child(8) { animation-delay: 0.4s; }

/* Railway Legend */
.railway-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    padding: 12px 18px;
    background: var(--bg-light);
    border-radius: var(--radius);
    align-items: center;
}

.legend-title {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.legend-line {
    display: inline-block;
    width: 24px;
    height: 4px;
    border-radius: 2px;
}

/* Omio Booking Cards */
.omio-booking-card {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--secondary-color);
    border-radius: var(--radius);
    padding: 18px 22px;
    margin: 20px 0 30px;
}

.omio-booking-card p {
    margin-bottom: 12px;
    font-size: 0.95rem;
    color: var(--text-color);
}

.omio-booking-card-highlight {
    background: linear-gradient(135deg, #f0fdf4 0%, #f8f9fa 100%);
    border-left-color: var(--primary-color);
}

.booking-btn {
    display: inline-block;
    padding: 10px 22px;
    background: var(--primary-color);
    color: white !important;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    text-decoration: none;
}

.booking-btn:hover {
    background: var(--primary-dark);
    color: white !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.booking-btn-full {
    display: block;
    text-align: center;
    margin-top: 15px;
}

/* Omio Sidebar Card */
.omio-sidebar-card {
    background: linear-gradient(135deg, #f0fdf4 0%, var(--bg-light) 100%);
    border: 1px solid var(--primary-color);
}

.sidebar-booking-intro {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

.booking-links li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.booking-links li:last-child {
    border-bottom: none;
}

.booking-links a {
    color: var(--primary-color);
    font-weight: 500;
}

.booking-links a:hover {
    color: var(--primary-dark);
}

@media (max-width: 768px) {
    .railway-legend {
        flex-direction: column;
        gap: 8px;
    }
}

/* Geolocation Button */
.geo-btn {
    padding: 10px 20px;
    background: var(--accent-color);
    color: white;
    border: 2px solid var(--accent-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.geo-btn:hover {
    background: #a01830;
    border-color: #a01830;
}

.geo-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }

    .reveal-section {
        opacity: 1;
        transform: none;
    }

    .back-to-top {
        transition: none;
    }
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .map-section,
    .map-controls {
        display: none;
    }

    body {
        font-size: 12pt;
    }

    a {
        color: black;
    }

    .region-card,
    .city-card,
    .thematic-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
