/* ============================================
   REGION BROWSE PAGE - ORGANIZED CSS
   ============================================ */

/* === HEADER SECTION === */
.browse-data-hdr-container {
    margin: 0 auto;
    width: 98%;
    min-height: 120px;
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 8px;
}

.browse-data-hdr-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.browse-data-hdr-grid {
    display: grid;
    grid-template-columns: 5fr 2fr;
    width: 100%;
    gap: 20px;
    align-items: center;
    padding: 6px 18px;
}

/* === HEADER LEFT SIDE === */
.browse-data-hdr-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.browse-data-hdr {
    font-size: 1.8rem;
    font-weight: 600;
    color: white;
    font-family: "IBM Plex Sans", sans-serif;
    margin-bottom: 5px;
}

.breadcrumb {
    margin-left: 4px;
    text-align: left;
    color: white !important;
    font-size: 14px;
    font-family: "IBM Plex Sans", sans-serif;
    font-weight: 400;
}

.breadcrumb a {
    color: white !important;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb i {
    font-size: 13px;
}

.breadcrumb i.bi-folder2-open {
    margin-right: 8px;
}

.breadcrumb i.bi-chevron-right {
    margin: 0 6px;
}

/* === HEADER RIGHT SIDE - TAB BUTTONS === */
.browse-data-hdr-right {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
}

.region-categories-header {
    font-family: "Inter", sans-serif;
    font-weight: 600;
    color: #F2F2F2;
    margin-bottom: 6px;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.region-categories-items {
    gap: 4px;
    display: flex;
    flex-direction: row;
    background-color: #D1D5DC;
    padding: 6px;
    border-radius: 8px;
}

.region-categories-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    background-color: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: "Inter", sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
}

.region-categories-btn:hover {
    color: #2563eb;
}

.region-categories-btn.active {
    background: white;
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

.region-categories-btn svg,
.region-categories-btn img {
    width: 16px;
    height: 16px;
    fill: #6b7280;
    vertical-align: middle;
}

.region-categories-btn.active svg,
.region-categories-btn.active img {
    fill: #2563eb;
}

/* === MAIN CONTENT WRAPPER === */
.region-categories-content-wrapper {
    width: 95%;
    margin: 20px auto 40px auto;
    font-family: "IBM Plex Sans", sans-serif;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.region-categories-content {
    display: none;
}

.region-categories-content.active {
    display: block;
}

/* === MAP LAYOUT === */
.map-layout-container {
    display: grid;
    gap: 2rem;
    padding: 1rem 0;
}

.phil-layout {
    grid-template-columns: 2fr 3fr;
}

.world-layout {
    grid-template-columns: 3fr 2fr;
}

.map-section,
.grid-section,
.list-section {
    display: flex;
    flex-direction: column;
}

/* === PHILIPPINE MAP === */
#phil-map-container {
    width: 100%;
    height: 500px;
    background-color: transparent;
    z-index: 1 !important;
}

#phil-map-container:focus,
#phil-map-container * {
    outline: none !important;
}

/* === WORLD GLOBE MAP === */
#world-map-container {
    width: 100%;
    height: 600px;
    background-color: transparent;
}

#world-map-container:focus,
#world-map-container * {
    outline: none !important;
}

.leaflet-container {
    outline: none !important;
}

.leaflet-container:focus {
    outline: none !important;
}

/* === PHILIPPINE REGIONS GRID === */
.region-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.region-card {
    position: relative;
    display: block;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.region-image-wrapper {
    width: 100%;
    height: 150px;
    overflow: hidden;
    border-radius: 8px;
}

.region-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: grayscale(100%) brightness(1.1) contrast(1.15);
    transition: filter 0.4s ease, transform 0.4s ease;
}

.region-overlay {
    position: absolute;
    inset: 0;
    /* This creates a much shorter, smoother shadow only at the bottom */
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.8) 0%,    /* Darkest at the very bottom */
        rgba(0, 0, 0, 0.4) 30%,   /* Fades quickly */
        transparent 60%           /* Completely clear for the top half */
    );
    display: flex;
    align-items: flex-end;
    padding: 1.25rem;
    border-radius: 8px;
    transition: all 0.4s ease;
}

.region-text {
    color: #fff;
    /* This "hugs" the letters so they pop even against light colors */
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    z-index: 2;
}

.region-card:hover .region-text {
    transform: translateY(-5px); /* Text floats up slightly */
    transition: transform 0.3s ease;
}

.region-display-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.3px;
}

.region-full-name {
    font-size: 0.9rem;
    color: #fff;
    opacity: 0.95;
    margin: 0.25rem 0 0 0;
    font-weight: 400;
}

/* Region Card Hover Effects */
.region-card:hover .region-image {
    filter: grayscale(0%) brightness(1) contrast(1); /* Clean color */
    transform: scale(1.08); /* Slightly smoother zoom */
}

.region-card:hover {
    transform: translateY(-8px); /* Card physically lifts */
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

.region-card:hover .region-overlay {
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.6) 0%,
        transparent 40%
    );
}

/* === COUNTRIES LIST SECTION === */
.format-option {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    align-items: center;
    padding-bottom: 10px;
}

.format-btn {
    padding: 8px 16px;
    font-family: "Inter", sans-serif;
    font-weight: 400;
    font-size: 14px;
    background-color: #FAFAFA;
    border: 1px solid #E5E7EB;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    color: #6B7280;
    border-radius: 4px;
    white-space: nowrap;
}

.format-btn:hover {
    background-color: #F3F4F6;
}

.format-btn.active {
    background-color: #F8F8FF;
    border-color: #2563EB;
    color: #111111;
}

.countries-content {
    padding: 6px 12px;
    border: 1px solid #F3F4F6;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* === ALPHABET BAR === */
.alphabet-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 15px 0;
}

.alphabet-bar .letter {
    display: inline-block;
    width: 40px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    border: 1px solid #ccc;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    border-radius: 0;
}

.alphabet-bar .letter.active {
    background: white;
    color: black;
    border-color: black;
}

.alphabet-bar .letter.active:hover {
    background: #d3d3d3;
}

.alphabet-bar .letter.active.selected {
    background: black;
    color: white;
    border-color: black;
}

.alphabet-bar .letter.disabled {
    color: #aaa;
    border-color: #eee;
    cursor: not-allowed;
}

/* === COUNTRY LIST === */
.country-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.letter-group {
    margin-bottom: 15px;
}

.letter-header {
    font-weight: 600;
    font-size: 1.5rem;
    color: #000;
}

.letter-group ul {
    list-style: none;
    padding-left: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Auto columns */
    gap: 8px 20px;
}

.letter-group li {
    padding: 2px 0;
    color: blue;
    font-weight: 400;
}

.letter-group li a {
    text-decoration: none;
    color: blue;
    transition: text-decoration 0.2s;
}

.letter-group li a:hover {
    text-decoration: underline;
}

/* === UTILITIES === */
.hidden {
    display: none !important;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .phil-layout,
    .world-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .browse-data-hdr-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .browse-data-hdr-left,
    .browse-data-hdr-right {
        align-items: center;
    }
}