:root {
    --primary-color: #1a3847;
    --secondary-color: #489FB5;
    --accent1-color: #82C0CC;
    --accent2-color: #EDE7E3;
    --sand-color: #c9a66b;

    --heading-font: 'Montserrat', sans-serif;
    --paragraph-font: 'Lato', sans-serif;
}

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

body {
    font-family: var(--paragraph-font);
    background-color: var(--accent2-color);
    color: #333;
}

/* --- HEADER PRINCIPAL --- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    background-color: var(--primary-color);
    color: white;
    padding: 0 15px 0 0;
    /* Slightly tighter right padding */
    border-bottom: 6px solid var(--sand-color);
    position: relative;
}

.logo-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    min-width: 0;
    /* Allows text inside flex container to shrink properly */
}

.logo-cliffs {
    height: 65px;
    display: block;
}

.logo-text {
    font-family: var(--heading-font);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding-right: 5px;
    line-height: 1.2;
    padding-bottom: 6px;
}

.logo-alt {
    color: var(--accent1-color);
}

.logo-sub {
    font-size: 0.85rem;
    font-weight: 400;
    opacity: 0.8;
}

/* --- SELECTOR DE LÍNGUA (PT | EN) --- */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--heading-font);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.6);
    z-index: 5;
    align-self: center;
    padding-bottom: 6px;
    flex-shrink: 0;
    /* 🚨 CRITICAL: Prevents PT | EN from ever being squished or cut off */
}

.lang-btn {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 2px 4px;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.lang-btn.active {
    color: #ffffff;
    border-bottom: 2px solid var(--accent1-color);
}

.lang-btn:hover {
    color: #ffffff;
}

.divider {
    opacity: 0.4;
    margin: 0 2px;
    user-select: none;
}

/* --- NAVEGAÇÃO E FILTROS --- */
.filter-nav {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
    padding: 10px 15px;
}

.filter-nav::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.filter-scroll-wrapper {
    display: inline-flex;
    gap: 8px;
}

.filter-nav ul {
    display: flex;
    gap: 10px;
    list-style: none;
    overflow-x: auto;
    padding-bottom: 5px;
}

.filter-btn {
    background-color: #dbe1e5;
    border: 1px solid transparent;
    color: var(--primary-color);
    padding: 8px 18px;
    border-radius: 20px;
    font-family: var(--heading-font);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease-in-out;
    flex-shrink: 0;
    scroll-snap-align: start;
}

/* Estado ao passar o rato (Hover) */
.filter-btn:hover {
    background-color: var(--primary-color);
    color: #ffffff;
}

/* Estado quando o filtro está Selecionado/Ativo (Estilo do 'Explorar') */
.filter-btn.active {
    background-color: #0284c7 !important;
    /* Azul vibrante igual ao 'Explorar' */
    color: #ffffff !important;
    /* Texto branco de alto contraste */
    border-color: #0284c7 !important;
    font-weight: 700;
}

/* --- HERO SECTION --- */
.hero-section {
    position: relative;
    padding: 60px 20px;
    color: white;
    text-align: center;
    background-size: cover;
    background-position: center;
}

.hero-glass-card {
    background: rgba(19, 51, 66, 0.7);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 30px 24px;
    border-radius: 16px;
    max-width: 580px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.hero-tag {
    font-family: var(--heading-font);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--accent1-color);
    text-transform: uppercase;
}

.hero-title {
    font-family: var(--heading-font);
    font-size: 2.2rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
}

.hero-description {
    font-family: var(--paragraph-font);
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    margin-bottom: 2px;
}

.hero-meta-row {
    font-family: var(--paragraph-font);
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.meta-divider {
    opacity: 0.3;
    font-size: 1.2rem;
}

.hero-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.hero-btn {
    background-color: #1a748b;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 28px;
    font-family: var(--heading-font);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    transition: background-color 0.2s, transform 0.2s;
}

.hero-btn:hover {
    background-color: var(--accent1-color);
    transform: translateY(-1px);
}

/* --- GRELHA DE PRAIAS --- */
.beaches-section {
    padding: 20px;
}

.beaches-section h2 {
    font-family: var(--heading-font);
    margin-bottom: 20px;
}

.grid-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.beach-card {
    position: relative;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: transform 0.2s;
}

.beach-card:hover {
    transform: translateY(-3px);
}

.beach-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    object-position: center center;
}

.status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.stat-label {
    text-transform: uppercase;
}

.hint-safe {
    background-color: #2ec4b6;
}

.hint-caution {
    background-color: #ff9f1c;
}

.hint-danger {
    background-color: #e71d36;
}

.card-meta-layout {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.card-info {
    padding: 15px;
}

.card-temp {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555555;
}

.card-info h3 {
    font-family: var(--heading-font);
}

/* --- MODAL --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.modal-card {
    position: relative;
    width: 90%;
    max-width: 750px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    z-index: 11;
    background-color: var(--primary-color);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    color: white;
    font-size: 1.8rem;
    width: 36px;
    height: 36px;
    line-height: 32px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    transition: background 0.2s;
    text-align: center;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}

.modal-card-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
}

.modal-landscape-img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

.modal-glass-overlay {
    background: rgba(19, 51, 66, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding: 24px;
    color: white;
    overflow-y: auto;
    flex-grow: 1;
    -webkit-overflow-scrolling: touch;
}

.modal-header-text {
    text-align: center;
    margin-bottom: 18px;
}

.modal-header-text h2 {
    font-family: var(--heading-font);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.modal-subtitle {
    font-family: var(--paragraph-font);
    font-size: 0.9rem;
    color: var(--accent1-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- LIVE STATUS BADGE --- */
.live-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--heading-font);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    margin-top: 10px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    width: fit-content;
    transition: all 0.3s ease;
}

.live-status-badge.stale {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.live-status-badge.stale .badge-dot {
    background-color: #ffc107;
    box-shadow: none;
}

.badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.live-status-badge.loading {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.live-status-badge.live {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.4);
}

.live-status-badge.live .badge-dot {
    background: #2ecc71;
    box-shadow: 0 0 8px #2ecc71;
}

.live-status-badge.offline {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.live-status-badge.offline .badge-dot {
    background: #95a5a6;
}

/* --- MÉTRICAS E DETALHES DO MODAL --- */
.modal-metrics-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px 12px;
    margin: 18px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 14px 0;
}

.metric-item {
    flex: 1 1 28%;
    max-width: 32%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.metric-item span {
    font-family: var(--heading-font);
    font-size: 0.92rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}

.metric-item small {
    font-family: var(--paragraph-font);
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.glass-verdict-box {
    border-radius: 8px;
    padding: 12px 16px;
    margin: 20px 0;
    text-align: center;
}

.glass-verdict-box h4 {
    font-family: var(--heading-font);
    font-size: 1rem;
    margin-bottom: 2px;
}

.glass-verdict-box p {
    font-family: var(--paragraph-font);
    font-size: 0.9rem;
    opacity: 0.9;
}

.verdict-safe {
    background: rgba(46, 204, 113, 0.15);
    border: 1px solid rgba(46, 204, 113, 0.3);
    color: #2ecc71;
}

.verdict-caution {
    background: rgba(241, 196, 15, 0.15);
    border: 1px solid rgba(241, 196, 15, 0.3);
    color: #f1c40f;
}

.verdict-danger {
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #e74c3c;
}

.modal-description {
    font-family: var(--paragraph-font);
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    margin: 20px 0 15px 0;
    text-align: left;
}

.modal-amenities-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.amenity-tag {
    font-family: var(--paragraph-font);
    font-size: 0.85rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 6px 14px;
    border-radius: 20px;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    transition: background 0.2s;
}

.amenity-tag:hover {
    background: rgba(255, 255, 255, 0.15);
}

.directions-btn {
    display: block;
    width: 100%;
    background-color: white;
    color: var(--primary-color);
    border: none;
    border-radius: 25px;
    padding: 14px 0;
    font-family: var(--heading-font);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, background-color 0.2s;
}

.directions-btn:hover {
    background-color: var(--accent2-color);
    transform: translateY(-1px);
}

.extra-details-container {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.extra-detail-row {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 8px;
}

.extra-detail-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.extra-detail-label {
    font-family: var(--heading-font);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent1-color);
    margin-bottom: 2px;
}

.extra-detail-value {
    font-family: var(--paragraph-font);
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.3;
}



/* --- WEBCAM BLOCK --- */
/* --- WEBCAM BUTTON --- */
.modal-webcam-block {
    margin: 18px 0;
    text-align: center;
}

.webcam-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    color: #ffffff;
    font-family: var(--heading-font);
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.webcam-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.webcam-btn .ext-icon {
    font-size: 1.1rem;
    opacity: 0.8;
}

.modal-webcam-block h4 {
    font-family: var(--heading-font);
    font-size: 0.9rem;
    color: var(--accent1-color);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.webcam-responsive-frame {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.webcam-responsive-frame iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.webcam-direct-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #ffffff;
    font-family: var(--heading-font);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.2s;
}

.webcam-direct-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* --- TOAST NOTIFICATION --- */
.toast-notification {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(15, 23, 42, 0.9);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    pointer-events: none;
    text-align: center;
    white-space: normal; 
    max-width: 88vw; 
    width: max-content;
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}


/* --- RESPONSIVIDADE --- */

@media (max-width: 480px) {
    .logo-text {
        font-size: 0.95rem;
        /* Slightly smaller on small screens to guarantee 2-line fit */
        line-height: 1.15;
    }

    .logo-container {
        gap: 6px;
    }
}

@media (min-width: 550px) {
    .modal-metrics-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .extra-detail-row {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .extra-detail-label {
        margin-bottom: 0;
    }
}

@media (min-width: 768px) {
    .main-header {
        padding-right: 30px;
    }

    .logo-container {
        gap: 15px;
    }

    .logo-text {
        font-size: 1.4rem;
        padding-right: 15px;
        letter-spacing: 1px;
    }

    .logo-sub {
        font-size: 0.9rem;
    }

    .grid-container {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }

    .modal-card-container {
        max-height: 85vh;
    }

    .modal-landscape-img {
        max-height: 320px;
    }
}

@media (max-height: 600px) {
    #details-modal:not(.hidden) {
        display: flex !important;
        align-items: flex-start;
        overflow-y: auto;
        padding: 20px 15px;
    }

    #details-modal:not(.hidden) .modal-card-container {
        margin: 0 auto !important;
        position: relative !important;
        top: 0 !important;
        transform: none !important;
        height: auto !important;
        max-height: none !important;
    }

    #details-modal:not(.hidden) .modal-landscape-img {
        max-height: 140px;
        object-fit: cover;
    }

    .modal-metrics-grid {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
    }

    .metric-item {
        max-width: none;
        flex: none;
    }
}