/* Datasets Page Styles */

html {
    scroll-behavior: smooth;
}

.datasets-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ========================================
   SECTION 1: INTERACTIVE MAP
   ======================================== */

.map-section {
    margin-bottom: 60px;
}

.map-header {
    text-align: center;
    margin-bottom: 30px;
}

.map-header h1 {
    font-size: 2.5rem;
    color: #1e293b;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.map-header h1 i {
    color: var(--color-primary);
}

.map-description {
    font-size: 1.1rem;
    color: #666;
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto;
}

.map-container {
    max-width: 90%;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 2px solid #e0e0e0;
}

#map {
    height: 500px;
    width: 100%;
    z-index: 1;
}

/* Map Popup Styling */
.map-popup {
    max-height: 350px;
    overflow-y: auto;
}

.map-popup h4 {
    margin: 0 0 15px 0;
    color: var(--color-primary);
    font-size: 1.2rem;
    border-bottom: 2px solid #468EA6;
    padding-bottom: 8px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

/* Metadata Container */
.popup-metadata {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

/* Individual Field Styling */
.popup-field {
    margin: 6px 0;
    padding: 4px 0;
    color: #555;
    line-height: 1.6;
    font-size: 0.9rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.popup-field strong {
    color: #333;
    font-weight: 600;
    display: inline-block;
    min-width: 120px;
}

/* N/A Value Styling */
.popup-field.na-value {
    color: #999;
    font-style: italic;
}

.popup-field.na-value strong {
    color: #666;
}

/* Action Buttons Container */
.popup-actions {
    margin-top: 12px;
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.popup-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    background-color: var(--color-primary);
    color: white !important;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
}

.popup-link:hover {
    background-color: #1C375F;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(70, 142, 166, 0.3);
}

.popup-link i {
    font-size: 0.85rem;
}

.request-notice {
    margin: 4px 0;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-left: 3px solid #ff922b;
    color: #666;
    font-size: 0.9rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.request-notice i {
    color: #ff922b;
}

/* Custom Leaflet Popup Styling */
.custom-popup .leaflet-popup-content-wrapper {
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.custom-popup .leaflet-popup-content {
    margin: 18px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    max-width: 100%;
}

/* Scrollbar styling for popup */
.map-popup::-webkit-scrollbar {
    width: 6px;
}

.map-popup::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.map-popup::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.map-popup::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ========================================
   SECTION 2: GLOBAL DATASETS CARDS
   ======================================== */

.global-datasets-section {
    margin-bottom: 60px;
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-header h2 {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 15px;
}

.section-description {
    font-size: 1.1rem;
    color: #666;
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto;
}

/* Datasets Grid */
.datasets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
}

/* Dataset Card */
.dataset-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.dataset-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: var(--color-primary);
}

.dataset-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Dataset Thumbnail */
.dataset-thumbnail {
    width: 100%;
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
}

.dataset-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.dataset-title {
    font-size: 1.4rem;
    color: #333;
    margin: 0 0 15px 0;
    font-weight: 600;
    line-height: 1.3;
}

/* Dataset Tags */
.dataset-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.tag {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
}

.tag-global {
    background-color: #845ef7;
}

.tag-national {
    background-color: #4c8bf5;
}

.tag-polygon {
    background-color: #20c997;
}

.tag-point {
    background-color: #ff922b;
}

.tag-dl {
    background-color: #ee5a6f;
}

.tag-ml {
    background-color: #ff6b6b;
}

/* Dataset Description */
.dataset-description {
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
    flex-grow: 1;
}

/* Dataset Details */
.dataset-details {
    background-color: #f8f9fa;
    border-left: 3px solid var(--color-primary);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.dataset-details p {
    margin: 8px 0;
    color: #555;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dataset-details i {
    color: var(--color-primary);
    width: 18px;
}

.dataset-details strong {
    color: #333;
}

/* Dataset Actions */
.dataset-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
    flex: 1;
}

.btn-primary:hover {
    background-color: var(--color-primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 39, 76, 0.3);
}

.btn-secondary {
    background-color: #f0f0f0;
    color: #333;
    flex: 1;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

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

/* ========================================
   SECTION 3: CONTRIBUTION CONTAINER
   ======================================== */

.contribution-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 60px;
}

/* DATA CONTRIBUTION WORKFLOW */

.workflow-section {
    padding: 35px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.workflow-section h2 {
    text-align: center;
    font-size: 1.75rem;
    color: #333;
    margin: 0 0 30px 0;
    font-weight: 600;
}

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

.workflow-step {
    display: flex;
    align-items: start;
    gap: 18px;
    padding-bottom: 25px;
    border-bottom: 1px solid #e0e0e0;
}

.workflow-step:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.step-icon {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
}

.step-content h3 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    color: #333;
    font-weight: 600;
}

.step-content p {
    margin: 0;
    font-size: 0.95rem;
    color: #666;
    line-height: 1.6;
}

.step-reminder {
    margin-top: 12px !important;
    padding: 10px 12px;
    background-color: #f8f9fa;
    border-left: 3px solid var(--color-primary);
    border-radius: 4px;
    font-size: 0.9rem !important;
}

.step-reminder strong {
    color: #333;
}

.step-reminder a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.step-reminder a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

/* THE POWER OF CONTRIBUTION */

.contribute-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px 35px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
}

.contribute-section h2 {
    font-size: 1.75rem;
    color: #333;
    margin: 0 0 20px 0;
    font-weight: 600;
}

.contribute-section p {
    font-size: 1rem;
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
}

.btn-contribute {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 35px;
    background-color: var(--color-accent);
    color: var(--color-primary);
    text-decoration: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    transition: all 0.3s ease;
}

.btn-contribute:hover {
    background-color: var(--color-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 39, 76, 0.3);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1200px) {
    .datasets-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 992px) {
    .map-header h1 {
        font-size: 2rem;
    }

    .section-header h2 {
        font-size: 2rem;
    }

    .datasets-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 25px;
    }

    #map {
        height: 400px;
    }
}

@media (max-width: 768px) {
    .datasets-container {
        padding: 30px 15px;
    }

    .map-header h1 {
        font-size: 1.75rem;
        flex-direction: column;
        gap: 10px;
    }

    .map-description,
    .section-description {
        font-size: 1rem;
    }

    .section-header h2 {
        font-size: 1.75rem;
    }

    .map-container {
        max-width: 100%;
    }

    #map {
        height: 350px;
    }

    .datasets-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .dataset-actions {
        flex-direction: column;
    }

    .dataset-actions .btn {
        width: 100%;
    }

    /* Stack contribution sections vertically on tablet */
    .contribution-container {
        grid-template-columns: 1fr;
        gap: 30px;
        margin-top: 40px;
    }

    .workflow-section {
        padding: 30px 25px;
    }

    .workflow-section h2 {
        font-size: 1.75rem;
        margin-bottom: 25px;
    }

    .workflow-steps {
        gap: 22px;
    }

    .workflow-step {
        gap: 16px;
        padding-bottom: 22px;
    }

    .step-icon {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }

    .step-content h3 {
        font-size: 1.05rem;
    }

    .step-content p {
        font-size: 0.9rem;
    }

    .contribute-section {
        padding: 35px 25px;
    }

    .contribute-section h2 {
        font-size: 1.75rem;
    }

    .contribute-section p {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .map-header h1 {
        font-size: 1.5rem;
    }

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

    .dataset-title {
        font-size: 1.2rem;
    }

    #map {
        height: 300px;
    }

    .contribution-container {
        gap: 25px;
        margin-top: 30px;
    }

    .workflow-section {
        padding: 25px 20px;
    }

    .workflow-section h2 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }

    .workflow-steps {
        gap: 18px;
    }

    .workflow-step {
        gap: 12px;
        padding-bottom: 18px;
    }

    .step-icon {
        width: 44px;
        height: 44px;
        font-size: 1.05rem;
    }

    .step-content h3 {
        font-size: 0.95rem;
    }

    .step-content p {
        font-size: 0.85rem;
    }

    .contribute-section {
        padding: 30px 20px;
    }

    .contribute-section h2 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }

    .contribute-section p {
        font-size: 0.9rem;
        margin-bottom: 25px;
    }

    .btn-contribute {
        padding: 12px 25px;
        font-size: 1rem;
    }
}
