:root {
    --primary: #6253e8;
    --secondary: #6c757d;
    --background: #ffffff;
    --text-dark: #2c2c2c;
    --text-muted: #888888;
    --font-main: 'Inter', sans-serif;
}

body {
    font-family: var(--font-main);
    background-color: var(--background);
    color: var(--text-dark);
}

/* Typography */
.hero-title {
    font-size: 2.5rem;
    /* Reduced from 3.5rem to match data.gov.sg */
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.hero-title .text-muted {
    color: #a0a0a0 !important;
}

.hero-desc {
    font-size: 1.125rem;
    color: #4a4a4a;
    max-width: 600px;
    margin-bottom: 2rem !important;
    /* Adjusted margin */
}

/* Navbar */
.navbar {
    box-shadow: none;
    transition: padding 0.3s ease;
}

.nav-link {
    font-size: 0.95rem;
    padding: 0.5rem 1rem !important;
}

.nav-link:hover {
    color: var(--primary) !important;
}

/* Navbar Dropdown Menus */
.navbar .dropdown-menu {
    font-size: 0.9rem;
}

.navbar .dropdown-item {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    padding: 6px 16px;
}

.navbar .dropdown-item:hover {
    background-color: #f3f0ff;
    color: var(--primary);
}

.navbar .dropdown-item:active,
.navbar .dropdown-item.active {
    background-color: var(--primary);
    color: #fff;
}

/* Nested Dropdown */
.dropdown-submenu {
    position: relative;
}

.dropdown-submenu .dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -5px;
    margin-left: 0.1rem;
    display: none;
    position: absolute;
}

.dropdown-submenu:hover>.dropdown-menu {
    display: block;
}

/* Ensure nested menus open to the right on mobile as well (per user request) */
@media (max-width: 991.98px) {
    .dropdown-submenu .dropdown-menu {
        position: absolute;
        left: 100%;
        top: 0;
        margin-left: 0.5rem;
    }

    /* Ensure the navbar allows overflow so side menus are visible */
    .navbar-collapse {
        overflow: visible !important;
    }
}

/* Search Bar */
.search-container {
    max-width: 680px;
    position: relative;
    z-index: 10;
}

.search-container .form-control {
    height: 50px;
    font-size: 1rem;
    border-radius: 12px;
    /* Added consistent border-radius */
}

.search-container .form-control::placeholder {
    color: #999;
    font-size: 0.9rem;
}

/* Category Pills - data.gov.sg style */
.category-container {
    max-width: 900px;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 10px 20px;
    border-radius: 8px;
    /* Changed from 50px to 8px to match data.gov.sg */
    color: #333;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    /* Softer shadow */
    transition: all 0.2s ease;
}

.category-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    color: #333;
    /* Keep text color on hover */
}

.category-pill i {
    font-size: 1.1rem;
}

/* Wave Background - Subtle gradient matching data.gov.sg */
.wave-bg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: radial-gradient(circle at 50% 100%, rgba(30, 136, 229, 0.03) 0%, rgba(255, 255, 255, 0) 70%);
    z-index: 0;
    pointer-events: none;
}

/* Agency Cards */
.agency-card {
    border: 1px solid #eee;
    border-radius: 8px;
    /* Reduced from 12px to match data.gov.sg */
    padding: 24px;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    /* Neutral shadow instead of purple */
}

.agency-card:hover {
    border-color: #ddd;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    /* Neutral hover shadow */
}

.agency-logo {
    max-width: 100%;
    filter: grayscale(100%);
    opacity: 0.8;
    transition: all 0.3s ease;
}

.agency-card:hover .agency-logo {
    filter: grayscale(0%);
    opacity: 1;
}

/* Custom Purple Color */
.text-purple {
    color: #9c27b0 !important;
}

.bg-purple-subtle {
    background-color: #f3e5f5 !important;
    color: #9c27b0 !important;
}

/* Most Used Dataset Mini Cards */
.dataset-mini-card {
    transition: all 0.3s ease;
    border-radius: 8px;
    /* Added consistent border-radius */
}

.dataset-mini-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
}

/* Minimalist Icon Box (data.gov.sg style) */
.dataset-icon-box {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.9rem;
    /* Smaller icon size */
}

/* Creation Cards */
.creation-card {
    transition: all 0.3s ease;
    border-radius: 8px;
    /* Added consistent border-radius */
}

.creation-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1) !important;
}

/* Trusted Logos Slider */
.logo-slider {
    height: 100px;
    margin: auto;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.logo-slider::before,
.logo-slider::after {
    background: linear-gradient(to right, white 0%, rgba(255, 255, 255, 0) 100%);
    content: "";
    height: 100px;
    position: absolute;
    width: 100px;
    z-index: 2;
}

.logo-slider::after {
    right: 0;
    top: 0;
    transform: rotateZ(180deg);
}

.logo-slider::before {
    left: 0;
    top: 0;
}

.logo-slide-track {
    animation: scroll 30s linear infinite;
    display: flex;
    width: calc(250px * 14);
    /* 250px * number of slides */
}

.slide {
    height: 100px;
    width: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trusted-logo {
    height: 35px;
    filter: grayscale(100%);
    opacity: 0.5;
    transition: all 0.3s ease;
}

.trusted-logo:hover {
    filter: grayscale(0%);
    opacity: 1;
    transform: scale(1.1);
}

@keyframes scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(calc(-250px * 7));
        /* Move half of the total width */
    }
}

/* Buttons */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    transition: all 0.2s ease;
    border-radius: 8px;
    /* Added consistent border-radius */
}

.btn-primary:hover {
    background-color: #5b00b8;
    border-color: #5b00b8;
}

.footer {
    background-color: #f8f9fa;
    padding: 60px 0;
    margin-top: 80px;
    font-size: 0.9rem;
}

.footer h5,
.footer h6 {
    font-size: 0.95rem;
}

.footer p,
.footer a,
.footer li,
.footer .text-muted {
    font-size: 0.9rem;
}

.footer .form-control {
    font-size: 0.9rem;
}

.footer .btn {
    font-size: 0.9rem;
}

/* Hover Shadow Utility */
.hover-shadow {
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.hover-shadow:hover {
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15) !important;
    transform: translateY(-2px);
}

/* Scroll Container Hide Scrollbar */
.scroll-container::-webkit-scrollbar {
    display: none;
}

.scroll-container {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

/* Transition Utility */
.transition-colors {
    transition: color 0.3s ease;
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.hover-bg-light:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* New Animations */
.transition-transform {
    transition: transform 0.2s ease;
}

.hover-scale:hover {
    transform: scale(1.1);
}

.hover-translate {
    transition: all 0.3s ease;
}

.hover-translate:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
}

/* Home — News cards: consistent sizing */
#newsContainer .card {
    height: 320px;
}

#newsContainer .card-body {
    height: 100%;
}

#newsContainer .card-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    line-height: 1.25;
    min-height: 2.5em;
}

#newsContainer .card-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    line-height: 1.6;
    min-height: 4.8em;
}

/* Responsive Improvements */
@media (max-width: 991.98px) {

    /* Widen container to use more screen space */
    .container {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Navbar mobile adjustments */
    .navbar-collapse {
        margin-top: 1rem;
        max-height: 80vh;
        overflow-y: auto !important;
    }

    .navbar-nav {
        gap: 1.5rem !important;
        /* Increase spacing between nav items */
        padding-bottom: 1rem;
    }

    .nav-link {
        padding: 0.5rem 0 !important;
        /* Remove horizontal padding, increase vertical target */
        font-size: 1.1rem;
    }

    /* Hero adjustments - data.gov.sg mobile style */
    .hero-title {
        font-size: 2rem;
        /* Reduced from 2.5rem for better mobile fit */
        margin-bottom: 1rem;
    }

    .hero-desc {
        font-size: 1rem;
        /* Slightly smaller on mobile */
    }

    .category-container {
        gap: 8px !important;
        /* Tighter spacing on mobile */
    }

    .category-pill {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

@media (max-width: 575.98px) {
    #newsContainer .card {
        height: 300px;
    }
}

/* ═══════════════════════════════════════════════
   Search Results Page — data.gov.sg style
   ═══════════════════════════════════════════════ */

/* Filter Bar */
.search-filter-bar {
    background-color: #fff;
}

.filter-btn {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 5px 12px;
    transition: all 0.15s ease;
    white-space: nowrap;
    background-color: transparent !important;
    color: #555 !important;
    border: none !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    outline: none !important;
    cursor: pointer;
}

.filter-btn:hover,
.filter-btn:focus {
    color: #111 !important;
    background-color: #f5f5f5 !important;
}

.filter-btn:active,
.filter-btn.show {
    color: #111 !important;
    background-color: #f0f0f0 !important;
    font-weight: 600;
}

.filter-btn.dropdown-toggle::after {
    vertical-align: 0.15em;
    margin-left: 0.35em;
    opacity: 0.5;
}

.filter-btn.filter-active {
    border: 1.5px solid #6253e8 !important;
    color: #6253e8 !important;
    border-radius: 20px;
}

.filter-bar-scroll {
    flex-wrap: wrap;
    gap: 2px !important;
}

/* Filter Dropdown Panel */
.filter-dropdown-menu {
    --bs-dropdown-border-width: 0;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    font-size: 0.85rem;
}

.filter-dropdown-menu.show {
    opacity: 1;
    transform: translateY(0);
}

.filter-dropdown-menu h6 {
    font-size: 0.7rem !important;
    letter-spacing: 0.05em;
}

.filter-dropdown-menu .form-check-label {
    font-size: 0.85rem;
    cursor: pointer;
}

.filter-dropdown-menu .form-check-input {
    cursor: pointer;
}

.filter-dropdown-menu .form-check-input:checked {
    background-color: #6253e8;
    border-color: #6253e8;
}

.filter-dropdown-menu .filter-apply-btn {
    font-size: 0.8rem;
    padding: 4px 20px;
}

.filter-dropdown-menu .filter-clear-btn {
    font-size: 0.8rem;
}

.filter-badge {
    font-size: 0.65rem;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 5px;
}

/* Sort Dropdown */
.sort-option {
    font-size: 0.85rem;
}

.sort-option.active,
.sort-option:active {
    background-color: transparent !important;
    color: #111 !important;
    font-weight: 600;
}

.sort-option:hover {
    background-color: #f5f5f5 !important;
    color: #111 !important;
}

/* Results Scroll Container (data.gov.sg: sol panel scrollable) */
.results-scroll-container {
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f1f1f1;
}

.results-scroll-container::-webkit-scrollbar {
    width: 5px;
}

.results-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.results-scroll-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

/* Search Result Cards */
.search-result-card {
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent !important;
    padding: 12px 14px !important;
}

.search-result-card:hover {
    background-color: #f8f9fa !important;
}

.search-result-card.active {
    background-color: #E4E1FB !important;
    border-left: none !important;
    padding-left: 14px !important;
}

.search-result-card .result-title {
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Highlighted search terms */
.search-result-card em,
.search-result-card .result-title em {
    font-style: normal;
    font-weight: 700;
    color: var(--primary);
    background-color: rgba(98, 83, 232, 0.08);
    padding: 0 2px;
    border-radius: 2px;
}

/* Detail Panel */
#detailContent,
#detailSkeletonLoader,
#detailWelcome {
    min-height: 600px;
}

/* Format Badges */
.format-badge {
    background-color: #eef2ff;
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Skeleton */
.search-skeleton-card {
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

@keyframes skeletonPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Autocomplete */
.search-autocomplete-dropdown {
    position: fixed;
    z-index: 1060;
    background: #fff;
    border-radius: 12px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e8e8e8;
}

.search-autocomplete-item {
    transition: background-color 0.15s ease;
}

.search-autocomplete-item:hover {
    background-color: #f3f0ff !important;
}

/* API Code Tabs */
.api-tab {
    background: transparent;
    border: none;
    transition: all 0.15s ease;
}

.api-tab.active {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
}

.api-tab:hover:not(.active) {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Pagination */
.pagination .page-link {
    border: none;
    color: #555;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 5px 10px;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pagination .page-link:hover {
    background-color: #f3f0ff;
    color: var(--primary);
}

/* Empty State */
.search-empty-state {
    padding: 40px 16px;
}

/* Sort — quş işarəsi aktiv olanı göstərir */
.sort-check {
    font-size: 1rem;
    color: #111;
}

/* Responsive */
@media (max-width: 991.98px) {
    #detailPanel {
        margin-top: 1.5rem;
    }

    .results-scroll-container {
        max-height: none;
        overflow-y: visible;
    }

    .filter-bar-scroll .dropdown,
    .filter-bar-scroll .ms-auto {
        flex-shrink: 0;
    }
}

@media (max-width: 767.98px) {
    .filter-dropdown-menu {
        width: 280px !important;
    }

    #detailContent,
    #detailSkeletonLoader,
    #detailWelcome {
        min-height: 300px;
    }
}

/* ═══════════════════════════════════════════════
   Thumbs Up / Down Rating Component
   ═══════════════════════════════════════════════ */
.rating-thumb-btn {
    transition: all 0.2s ease !important;
}

.rating-thumb-btn:not(:disabled):hover {
    transform: scale(1.08);
}

.rating-thumb-btn:not(:disabled):active {
    transform: scale(0.95);
}

#thumbUpBtn:not(:disabled):hover,
#detailsThumbUpBtn:not(:disabled):hover {
    background-color: #ecfdf5 !important;
    border-color: #10b981 !important;
    color: #10b981 !important;
}

#thumbDownBtn:not(:disabled):hover,
#detailsThumbDownBtn:not(:disabled):hover {
    background-color: #fef2f2 !important;
    border-color: #ef4444 !important;
    color: #ef4444 !important;
}

.rating-thumb-btn:disabled {
    opacity: 0.8;
}

.details-thumb-btn {
    transition: all 0.25s ease !important;
}

.details-thumb-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.details-thumb-btn:not(:disabled):active {
    transform: translateY(0) scale(0.97);
}