/* 1. RESET & VARIABLES */
:root {
    --bg-page: #d4edff;       
    --bg-card: #ffffff;       
    --text-main: #0f172a;     
    --text-muted: #475569;    
    --accent: #0ea5e9;        
    --whatsapp: #22c55e;      
    --emergency: #ef4444;     
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-page);
    margin: 0;
    padding: 0;
    color: var(--text-main);
    -webkit-tap-highlight-color: transparent;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-page);
    overflow-x: hidden; 
}

/* 2. HERO HEADER */
.hero-header {
    position: relative;
    height: 380px; 
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 28px 24px;
    background-color: #0f172a; 
    background-image: url('/images/slavko_ribarica_dron.png');
    background-size: cover;
    background-position: center 40%;
    overflow: visible;
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

.hero-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(30, 80, 180, 0.15);
    z-index: 0;
}

.hero-top {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: flex-start;
}

.weather-widget {
    display: flex;
    flex-direction: column;
    width: fit-content;
    min-height: 52px; /* Prevent CLS while loading */
    gap: 4px;
    background: transparent;
    padding: 12px 14px 0 14px;
    border-radius: 16px;
    margin-bottom: 0;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    position: relative;
}

/* Keep the glass effect without making .weather-widget a containing block for fixed children */
.weather-widget::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: -1;
}

.weather-main {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
}

.weather-temp-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.weather-details {
    display: flex;
    gap: 10px;
    font-size: 0.75rem;
    opacity: 0.9;
    margin-top: 0;
    flex-wrap: wrap;
}

.weather-detail {
    display: flex;
    align-items: center;
    gap: 3px;
}

/* quality-link styles are defined in section 12 */

.weather-loc {
    font-size: 1.1rem;
    opacity: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 800;
}

.weather-expand-icon {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-left: auto;
}

/* Weather unavailable state */
.weather-unavailable {
    justify-content: space-between;
}

.weather-error {
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.8;
}

/* Expanded weather forecast - overlay mode */
/* When expanded, widget becomes the anchor for dropdown */
.weather-widget.weather-expanded {
    z-index: 100;
}

/* Forecast dropdown - responsive with min() for both desktop and mobile */
.weather-forecast {
    /* In-flow dropdown (no internal scrollbar): scroll the page to see more */
    position: relative;
    margin: 8px auto 0;
    width: min(448px, calc(100% - 32px));

    animation: weatherForecastIn 160ms ease-out both;

    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    max-height: none;
    overflow: visible;
    z-index: 1000;
}

.weather-forecast.weather-forecast-closing {
    animation: weatherForecastOut 140ms ease-in both;
}

@keyframes weatherForecastIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes weatherForecastOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-6px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .weather-forecast,
    .weather-forecast.weather-forecast-closing {
        animation: none;
    }
}

.forecast-day {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

.forecast-day:last-child {
    border-bottom: none;
}

.forecast-day.forecast-today {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    border-bottom: none;
    margin-bottom: 4px;
}

/* Row 1: Day | Icon | Desc | Temps (safe flex sizing, no overlap) */
.forecast-row-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    font-weight: 600;
}

/* Row 2: Rain | Wind | UV | Sun (keep one line, no collisions) */
.forecast-row-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
    gap: 8px;
}

.forecast-name {
    flex: 0 0 70px;
    text-align: left;
    white-space: nowrap;
}

.forecast-icon {
    font-size: 1.1rem;
    flex: 0 0 auto;
}

.forecast-desc {
    flex: 1;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-weight: normal;
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.forecast-temps {
    flex: 0 0 auto;
    min-width: 60px;
    text-align: right;
    display: flex;
    gap: 4px;
    white-space: nowrap;
}

.temp-high {
    font-weight: 700;
}

.temp-low {
    opacity: 0.7;
}

.forecast-sun {
    font-size: 0.7rem;
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.hero-footer {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-top: 20px;
    width: 100%;
    position: relative;
    z-index: 50;
}

.hero-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, 
        rgba(0,0,0,0.3) 0%, 
        transparent 40%, 
        rgba(0,0,0,0.7) 100%);
    z-index: 1;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
    color: white;
}
.hero-content h1 {
    font-size: 34px;
    font-weight: 800;
    margin: 0;
    line-height: 1.1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8), 0 4px 16px rgba(0,0,0,0.6);
}
.hero-content p {
    margin-top: 6px;
    font-size: 16px;
    opacity: 0.9;
    font-weight: 500;
    text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}

.hero-actions {
    display: flex;
    gap: 10px;
    margin-top: 0;
    flex-wrap: wrap;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    background: #ffffff;
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.nav-btn.secondary {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.nav-btn:active {
    transform: scale(0.95);
}

@media (hover: hover) {
    .nav-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 6px 18px rgba(0,0,0,0.22);
    }
}

.main-pad { padding: 24px; padding-bottom: 0; }

/* 3. INFINITE CAROUSEL */
.tabs-wrapper {
    width: 100%;
    overflow: hidden;
    margin-bottom: 20px;
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent), 
                linear-gradient(to bottom, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent), 
                        linear-gradient(to bottom, black 85%, transparent);
    opacity: 0; 
    transition: opacity 0.5s ease;
}
.tabs-wrapper.loaded { opacity: 1; }

.tabs-container {
    display: flex;
    overflow-x: auto; 
    gap: 15px;
    padding: 10px 50% 10px 50%;
    scroll-snap-type: x proximity; 
    -webkit-overflow-scrolling: touch; 
    scrollbar-width: none; 
}
.tabs-container::-webkit-scrollbar { display: none; }

.tab-btn {
    scroll-snap-align: center;
    flex: 0 0 auto; 
    box-sizing: border-box;
    border: 2px solid transparent;
    background: #e2e8f0;
    width: 64px;
    height: 64px;
    border-radius: 20px;
    font-size: 34px; 
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
    filter: grayscale(1);
    -webkit-tap-highlight-color: transparent; 
}

/* ACTIVE STATE */
.tab-btn.active {
    background: #ffffff !important;
    opacity: 1 !important;
    filter: grayscale(0) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: scale(1.15);
    border-color: var(--accent);
    z-index: 10;
}

/* 4. ACCORDION CARDS */
details {
    background: var(--bg-card);
    border-radius: 16px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.04); 
    border: 1px solid rgba(0,0,0,0.02);
}
details:last-of-type {
    margin-bottom: 0;
}
summary {
    padding: 18px 40px 18px 20px;
    font-weight: 700;
    font-size: 16px;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    color: var(--text-main);
    position: relative;
}
summary::-webkit-details-marker { display: none; }
summary::after {
    content: '';
    position: absolute;
    right: 20px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid #cbd5e1;
    border-bottom: 2px solid #cbd5e1;
    transition: transform 0.25s ease;
    transform: translateY(-50%) rotate(-45deg);
}
details[open] summary::after {
    border-color: var(--accent);
    transform: translateY(-70%) rotate(45deg);
}

.info-text {
    /* Height animation is applied to .info-text in JS; keep it padding-free to avoid jumpiness */
    padding: 0;
}
.info-text-inner {
    padding: 0 20px 24px 20px;
    line-height: 1.6;
    color: var(--text-muted);
    font-size: 15px;
}
.info-text-inner b { color: var(--text-main); font-weight: 700; }
.info-text-inner a { color: var(--accent); text-decoration: none; font-weight: 600; border-bottom: 1px dotted var(--accent); }
.emergency-link { color: var(--emergency) !important; border-bottom: 1px dotted var(--emergency) !important; }

/* 5. BOOK BUTTON & DROPDOWN */
.book-container {
    position: relative;
    margin-top: 32px;
    margin-bottom: 32px;
}

.book-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    background: linear-gradient(135deg, #5aaed8 0%, #3a90c2 100%);
    color: white;
    text-decoration: none;
    padding: 18px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(58, 144, 194, 0.3);
    gap: 10px;
    overflow: visible;
    box-sizing: border-box;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.book-btn:active { transform: scale(0.98); }

@media (hover: hover) {
    .book-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 6px 18px rgba(58, 144, 194, 0.4);
    }
}

.book-dropdown {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 8px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 100;
    animation: dropdownFadeIn 0.2s ease;
}

.book-dropdown.open {
    display: block;
}

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

.book-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    border: none;
    width: 100%;
    cursor: pointer;
    transition: filter 0.15s ease;
    box-sizing: border-box;
}

.book-option:hover {
    filter: brightness(1.1);
}

.book-option-booking {
    background: #4090bd;
}

.book-option-airbnb {
    background: #db7478;
}

.book-option-whatsapp {
    background: #4db06c;
}

/* Airbnb collapsible submenu */
.airbnb-group {
    display: flex;
    flex-direction: column;
}

.airbnb-header {
    cursor: pointer;
    position: relative;
}

.airbnb-header::after {
    content: '▼';
    position: absolute;
    right: 20px;
    font-size: 10px;
    transition: transform 0.2s ease;
}

.airbnb-header.expanded::after {
    transform: rotate(180deg);
}

.airbnb-suboptions {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.airbnb-suboptions.open {
    max-height: 200px;
}

.airbnb-suboption {
    display: flex;
    align-items: center;
    padding: 12px 20px 12px 52px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    background: #d38589;
    border: none;
    width: 100%;
    cursor: pointer;
    transition: filter 0.15s ease;
    box-sizing: border-box;
}

.airbnb-suboption:hover {
    filter: brightness(0.95);
}

.book-icon {
    font-size: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
}
.icon {
    font-size: 18px;
    position: relative;
    display: inline-flex;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    justify-content: center;
    align-items: center;
    line-height: 1;
    padding: 0 2px;
    box-sizing: border-box;
    flex: none;
    overflow: visible;
    background: rgba(255, 255, 255, 0.16);
}

.content-area { display: none; }
.content-area.active { display: block; animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Accordion open/close animation is handled in JS (smooth height transition). */

/* 9. FOOTER */
.footer {
    background-color: var(--bg-card);
    border-top: 1px solid #e2e8f0;
    padding: 20px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 0;
}

.footer p {
    margin: 0;
}

/* 10. ACCESSIBILITY */
@media (prefers-reduced-motion: reduce) {
    .content-area.active {
        animation: none !important;
    }

    .nav-btn,
    .book-btn,
    .book-dropdown {
        transition: none !important;
        animation: none !important;
    }
}

.activity-item {
    margin-bottom: 12px;
}

.activity-toggle {
    color: #60a5fa;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    position: relative;
    padding-right: 30px;
}

.distance-line {
    display: block;
    color: #64748b;
    font-size: 0.85em;
    margin-top: 2px;
    margin-left: 24px;
}

.activity-toggle .distance-info {
    color: #64748b;
    font-size: 0.85em;
    font-weight: 400;
    margin-left: auto;
    padding-right: 20px;
    white-space: nowrap;
}

.activity-toggle::after {
    content: '';
    position: absolute;
    right: 30px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2.5px solid currentColor;
    border-bottom: 2.5px solid currentColor;
    opacity: 0.7;
    transition: transform 0.25s ease;
    transform: translateY(-50%) rotate(-45deg);
}

.activity-toggle.expanded::after {
    transform: translateY(-70%) rotate(45deg);
}

.activity-toggle:hover {
    color: #93c5fd;
}

.activity-details {
    margin: 16px 0 8px 0;
    padding: 16px;
    background: rgba(255,255,255,0.08);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    position: relative;
    text-align: center;
    
    /* Animation setup */
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.activity-details.open {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.activity-details::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid rgba(255,255,255,0.08);
}

.activity-details p {
    margin: 0 0 12px 0;
    padding: 0 12px;
    line-height: 1.6;
}

.activity-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.activity-gallery img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.activity-gallery img:hover {
    transform: scale(1.02);
}

/* Lightbox for enlarged images */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: pointer;
    padding: 20px;
    box-sizing: border-box;
}

.lightbox-overlay img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
    line-height: 1;
}

.lightbox-close:hover {
    color: #ccc;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    padding: 16px;
    user-select: none;
    z-index: 10000;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    opacity: 1;
}

.lightbox-prev {
    left: 10px;
}

.lightbox-next {
    right: 10px;
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
}

@media (max-width: 600px) {
    .lightbox-prev,
    .lightbox-next {
        font-size: 30px;
        padding: 10px;
    }
    
    .lightbox-prev {
        left: 5px;
    }
    
    .lightbox-next {
        right: 5px;
    }
}

@media (max-width: 600px) {
    .activity-gallery {
        grid-template-columns: 1fr;
    }
    
    .activity-gallery img {
        height: 120px;
    }
}

.plitvice-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
}

.plitvice-gallery img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

@media (max-width: 600px) {
    .plitvice-gallery {
        grid-template-columns: 1fr;
    }
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

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

.google-data-loading {
    color: #9ca3af;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 0;
    width: 100%;
}

/* 11. PRIVACY DIALOG */
#privacyDialog {
    padding: 20px;
    border-radius: 12px;
    border: none;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

#privacyDialog h3 {
    margin-top: 0;
}

#privacyDialog ul {
    margin: 8px 0;
    padding-left: 20px;
}

#privacyDialog .privacy-note {
    font-size: 0.85em;
    color: #666;
}

#privacyDialog button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
}

#privacyLink {
    color: inherit;
    text-decoration: underline;
}

#turnstile-container {
    display: none;
}

/* 12. GOOGLE PLACES STATUS COLORS (CSP-compliant) */
.status-open {
    color: #10b981;
    font-weight: 600;
}

.status-closed {
    color: #ef4444;
    font-weight: 600;
}

.status-closes-soon {
    color: #f59e0b;
    font-weight: 600;
}

.status-temporarily-closed {
    color: #9333ea; /* purple for temporarily closed */
    font-weight: 600;
}

.place-link {
    color: #3b82f6;
    text-decoration: none;
}

.place-link:hover {
    text-decoration: underline;
}

.error-quota {
    color: #b45309;
    font-style: italic;
}

.error-load {
    color: #6b7280;
    font-style: italic;
    cursor: pointer;
}

.error-load:hover {
    text-decoration: underline;
}

/* Water quality link - looks like text, reveals as link on hover */
/* Mobile: slightly different color to hint it's tappable */
/* Desktop: changes color on hover, no underline */
.quality-link {
    color: #0891b2; /* subtle cyan tint to hint it's tappable */
    text-decoration: none;
    transition: color 0.2s ease;
    cursor: pointer;
}

.quality-link:hover {
    color: #0284c7; /* brighter blue on hover */
}

.quality-link:active {
    color: #0369a1; /* darker on tap/click */
}

/* 13. FONT SIZE UTILITY CLASSES (CSP-compliant) */
.font-size-12 { font-size: 12px; }
.font-size-13 { font-size: 13px; }
.font-size-14 { font-size: 14px; }
.font-size-15 { font-size: 15px; }
.font-size-16 { font-size: 16px; }
.font-size-18 { font-size: 18px; }
.font-size-20 { font-size: 20px; }
.font-size-22 { font-size: 22px; }
.font-size-24 { font-size: 24px; }
