/* Import Manrope font */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700;800&display=swap');

/* CSS Variables */
:root {
    --background: #FEFCF8;
    --typography: #2C2C2C;
    --subtle-bg: #F5F2ED;
    --excellent: #27ae60;
    --good: #2ecc71;
    --fair: #f1c40f;
    --poor: #e74c3c;
    --ocean-blue: #3498db;
    --wave-teal: #16a085;
    --white: #ffffff;
    --border-gray: #e9ecef;
    --text-gray: #6c757d;
    --font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --space-xs: 8px;
    --space-sm: 16px;
    --space-md: 24px;
    --space-lg: 32px;
    --space-xl: 48px;
    --space-xxl: 64px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --transition-normal: 0.3s ease;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;
}

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

body {
    font-family: var(--font-family);
    background: var(--background);
    color: var(--typography);
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* Header */
.header {
    background-image: url('./assets/images/hero-surf-portugal.jpg');
    background-size: cover;
    background-position: center bottom;
    min-height: 60vh;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    position: relative;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(254, 252, 248, 0.2);
}

.header-content {
    position: relative;
    z-index: 2;
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    align-self: center;
    justify-self: start;
    text-align: left;
    max-width: 500px;
    margin-left: var(--space-lg);
    margin-top: var(--space-lg);
}

h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: var(--font-weight-extrabold);
    color: var(--typography);
    margin-bottom: var(--space-md);
    line-height: 1.1;
}

h2 {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    font-weight: var(--font-weight-medium);
    color: var(--typography);
    margin-bottom: var(--space-lg);
    line-height: 1.4;
}

h3 {
    font-size: 1.5rem;
    font-weight: var(--font-weight-semibold);
    color: var(--typography);
    margin-bottom: var(--space-sm);
}

/* Main content */
.main-content {
    padding: var(--space-xl) 0;
}

/* Controls section */
.controls-section {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-gray);
}

.controls-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.controls-header p {
    font-size: 1.1rem;
    color: var(--typography);
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.control-group {
    display: flex;
    flex-direction: column;
}

.control-group label {
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-sm);
    color: var(--typography);
    font-size: 1.1rem;
}

.control-group select {
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--border-gray);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-family: var(--font-family);
    background: var(--white);
    color: var(--typography);
    transition: all var(--transition-normal);
    cursor: pointer;
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.control-group {
    display: flex;
    flex-direction: column;
}

/* Fix mobile dropdown option overflow */
@media (max-width: 768px) {
    .control-group select {
        font-size: 0.9rem;
        padding-right: 2rem;
        background-size: 1.2em 1.2em;
    }
    
    /* Ensure dropdown options don't overflow on mobile */
    .control-group select option {
        font-size: 0.9rem;
        padding: 0.5rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
}

.control-group select:focus {
    outline: none;
    border-color: var(--wave-teal);
    box-shadow: 0 0 0 3px rgba(22, 160, 133, 0.1);
}

.control-group select:hover {
    border-color: var(--wave-teal);
}

/* Map section */
.map-section {
    background: var(--white);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    margin-bottom: var(--space-xl);
    border: 1px solid var(--border-gray);
}

.map-header {
    background: var(--white);
    padding: var(--space-md) var(--space-xl);
    border-bottom: 1px solid var(--border-gray);
    text-align: center;
}

.map-header h3 {
    color: var(--typography);
    margin-bottom: var(--space-sm);
}

.map-header p {
    color: var(--typography);
    margin: 0;
}

.map-container {
    position: relative;
    height: 600px;
    background: var(--white);
}

#map {
    width: 100%;
    height: 100%;
}

/* Legend */
.legend {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: var(--white);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

.legend h4 {
    font-size: 1rem;
    margin-bottom: var(--space-sm);
    color: var(--typography);
    text-align: center;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.9rem;
    font-weight: var(--font-weight-medium);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.legend-color.excellent { background: var(--excellent); }
.legend-color.good { background: var(--good); }
.legend-color.fair { background: var(--fair); }
.legend-color.poor { background: var(--poor); }

/* Popup styling */
.popup-content {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #2C2C2C;
}

.popup-content h4 {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #2C2C2C;
    margin: 0 0 var(--space-sm) 0;
    font-weight: var(--font-weight-semibold);
}

.popup-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #2C2C2C;
}

.popup-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.popup-footer {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #2C2C2C;
    margin: var(--space-sm) 0 0 0;
    font-size: 0.9rem;
}

/* Footer */
.footer {
    background: var(--typography);
    color: var(--white);
    text-align: center;
    padding: var(--space-xl) var(--space-md);
    margin-top: var(--space-xl);
}

.footer p {
    opacity: 0.8;
    margin: 0;
}

/* Responsive */
/* Tablet and mobile adjustments */
@media (max-width: 900px) {
    .controls-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
}

@media (max-width: 768px) {
    .controls-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .control-group select {
        padding: var(--space-sm);
        font-size: 0.95rem;
        min-width: 0; /* Allow shrinking */
        width: 100%; /* Full width of container */
    }

    .header {
        min-height: 50vh;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: var(--space-xl) var(--space-sm);
        background-position: center center; /* Center positioning works better on mobile */
    }
    
    .header-content {
        grid-column: unset;
        grid-row: unset;
        align-self: unset;
        justify-self: unset;
        text-align: center;
        margin-left: 0;
        margin-top: 0;
        max-width: 100%;
    }

    .map-container {
        height: 400px;
    }

    .legend {
        position: static;
        margin-top: var(--space-md);
    }

    .legend-items {
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--space-md);
    }
}

@media (max-width: 480px) {
    .header {
        min-height: 45vh;
    }
}

/* ===================================================================
   REGION DETAIL BOXES STYLING
   =================================================================== */

.region-details-section {
    margin-top: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.region-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.region-header h2 {
    font-size: 2rem;
    font-weight: var(--font-weight-bold);
    color: var(--typography);
    margin-bottom: var(--space-xs);
}

#region-subtitle {
    font-size: 1.1rem;
    color: var(--text-gray);
    margin: 0;
}

/* Three-box grid layout */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

/* Individual detail boxes */
.detail-box {
    background: var(--background);
    border: 1px solid var(--border-gray);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    transition: all var(--transition-normal);
}

.detail-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--wave-teal);
}

.detail-box h3 {
    font-size: 1.2rem;
    font-weight: var(--font-weight-semibold);
    color: var(--typography);
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border-gray);
}

/* Metrics list styling */
.metrics-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.metric-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) 0;
}

.metric-label {
    font-weight: var(--font-weight-medium);
    color: var(--typography);
    font-size: 0.95rem;
}

.metric-value {
    font-weight: var(--font-weight-semibold);
    color: var(--ocean-blue);
    font-size: 1rem;
}

/* Wetsuit recommendation styling - applied via JavaScript for reliability */
.wetsuit-divider {
    margin: 12px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
}

/* Placeholder text styling */
.placeholder-text {
    color: var(--text-gray);
    font-size: 1rem;
    margin: 0;
    padding: var(--space-sm) 0;
    text-align: center;
    font-style: italic;
}

/* ===================================================================
   SUITABILITY BOX SPECIFIC STYLING
   =================================================================== */

.current-level-rating {
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-gray);
}

.rating-display {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.rating-text {
    font-weight: var(--font-weight-semibold);
    font-size: 1.1rem;
    color: var(--typography);
}

.rating-description {
    font-size: 0.9rem;
    color: var(--text-gray);
    margin: 0;
}

.all-levels h4 {
    font-size: 1rem;
    font-weight: var(--font-weight-semibold);
    color: var(--typography);
    margin-bottom: var(--space-sm);
}

.level-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.level-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) 0;
}

.level-name {
    font-weight: var(--font-weight-medium);
    color: var(--typography);
    font-size: 0.95rem;
}

.level-rating {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.rating-label {
    font-weight: var(--font-weight-semibold);
    font-size: 0.9rem;
    color: var(--typography);
}

/* Wind arrow icon styling */
.wind-arrow {
    width: 16px;
    height: 16px;
    margin-left: var(--space-xs);
    vertical-align: middle;
    transition: transform 0.3s ease;
    display: inline-block;
}

/* Colored dots for ratings */
.rating-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    background-color: var(--border-gray); /* Default gray */
}

/* Dot colors based on suitability */
.rating-dot.excellent {
    background-color: var(--excellent);
}

.rating-dot.good {
    background-color: var(--good);
}

.rating-dot.fair {
    background-color: var(--fair);
}

.rating-dot.poor {
    background-color: var(--poor);
}

/* ===================================================================
   BEACHES SECTION STYLING
   =================================================================== */

.beaches-section {
    margin-top: var(--space-lg);
}

.beaches-box {
    background: var(--background);
    border: 1px solid var(--border-gray);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
}

.beaches-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border-gray);
}

.beaches-header h3 {
    margin: 0;
    border: none;
    padding: 0;
}

.beaches-count {
    font-size: 0.9rem;
    color: var(--text-gray);
    font-weight: var(--font-weight-medium);
}

.beaches-list {
    line-height: 1.6;
}

.no-beaches {
    color: var(--text-gray);
    font-style: italic;
    margin: 0;
    text-align: center;
    padding: var(--space-md) 0;
}

/* Beach list styling (for when populated) */
.beach-item {
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--border-gray);
    color: var(--typography);
}

.beach-item:last-child {
    border-bottom: none;
}

.beach-name {
    font-weight: var(--font-weight-semibold);
    color: var(--typography);
}

.beach-description {
    font-size: 0.9rem;
    color: var(--text-gray);
    margin-top: var(--space-xs);
}

/* Future expansion areas */
.additional-info {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-gray);
}

.info-section {
    margin-bottom: var(--space-md);
}

.info-section h4 {
    font-size: 1rem;
    font-weight: var(--font-weight-semibold);
    color: var(--typography);
    margin-bottom: var(--space-sm);
}

/* ===================================================================
   RESPONSIVE DESIGN FOR DETAIL BOXES
   =================================================================== */

@media (max-width: 768px) {
    .details-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .detail-box {
        padding: var(--space-sm);
    }

    .detail-box h3 {
        font-size: 1.1rem;
    }

    .metric-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: var(--space-xs);
    }

    .metric-label {
        font-size: 0.85rem;
    }

    .metric-value {
        font-size: 0.9rem;
        font-weight: var(--font-weight-bold);
    }

    .level-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: var(--space-xs);
    }

    .level-name {
        font-size: 0.85rem;
    }

    .rating-label {
        font-size: 0.8rem;
    }

    .beaches-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
    }
}

@media (max-width: 480px) {
    .region-details-section {
        margin-top: var(--space-lg);
    }

    .region-header h2 {
        font-size: 1.5rem;
    }

    .detail-box {
        padding: var(--space-sm);
    }
}