/* ===================================
   PHASE 2: USER ENGAGEMENT - STYLES
   =================================== */

/* 1. DARK MODE VARIABLES (Enforced) */
:root {
    /* Dark Mode Defaults (Slate Palette) */
    --bg-primary: #0f172a;
    /* Slate-900 */
    --bg-secondary: #1e293b;
    /* Slate-800 */
    --text-primary: #f1f5f9;
    /* Slate-100 */
    --text-secondary: #cbd5e1;
    /* Slate-300 */
    --card-bg: #1e293b;
    /* Slate-800 */
    --border-color: #334155;
    /* Slate-700 */
    --accent-color: #818cf8;
    /* Indigo-400 */
    --accent-bg: rgba(129, 140, 248, 0.15);
}

/* Apply Dark Mode Globally */
body {
    /* Removed background override - using purple-blue gradient from style.css */
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.navbar {
    background: rgba(15, 23, 42, 0.95);
    border-bottom-color: var(--border-color);
}

.result-card,
.state-card,
.search-suggestions {
    background: var(--card-bg) !important;
    border-color: var(--border-color);
    box-shadow: none;
}

.result-pincode {
    color: var(--accent-color) !important;
    -webkit-text-fill-color: var(--accent-color) !important;
}

.result-details {
    background: rgba(255, 255, 255, 0.03) !important;
    color: var(--text-secondary) !important;
    border-color: transparent;
}

.result-compact-details {
    color: var(--text-secondary) !important;
}

.suggestion-item {
    background: transparent;
    color: var(--text-primary);
    border-bottom-color: var(--border-color);
}

.suggestion-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.footer {
    /* Removed background override - using purple-blue gradient from style.css */
    border-top-color: var(--border-color);
    color: var(--text-secondary);
}

.footer-section h3 {
    color: var(--text-primary);
}

.footer-section ul li a {
    color: var(--text-secondary);
}

.footer-section ul li a:hover {
    color: var(--accent-color);
}

.history-chip {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--border-color);
    box-shadow: none;
}

/* ===================================
   UI ELEMENTS
   =================================== */

/* Favorites Button */
.fav-btn {
    font-size: 1rem !important;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: transparent;
    border: none;
    cursor: pointer;
}

.fav-btn.active {
    transform: scale(1.1);
}

.fav-btn:hover {
    transform: scale(1.2);
}

/* Explore Button */
.explore-btn {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 0.4rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: 0.5rem;
    box-shadow: none;
}

.explore-btn:hover {
    background: var(--accent-color);
    color: #fff;
}

/* ===================================
   COMPACT STATE BLOCKS (User Request)
   =================================== */

.states-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
    /* Tighter grid */
    gap: 0.8rem !important;
}

.state-card {
    min-height: 90px !important;
    /* Reduced from 140px */
    padding: 0.75rem 0.5rem !important;
}

.state-icon {
    font-size: 1.25rem !important;
    /* Smaller icon */
    margin-bottom: 0.25rem !important;
}

.state-name {
    font-size: 0.9rem !important;
}

.state-count {
    font-size: 0.75rem !important;
}

/* ===================================
   GLOBAL COMPACTNESS (User Request)
   =================================== */

/* Hero: Reduce vertical spread */
.hero {
    min-height: 60vh !important;
    /* Reduced from 100vh */
    padding-top: 60px !important;
    padding-bottom: 2rem !important;
}

.hero-content {
    padding: 2rem 0 !important;
    /* Reduced from spacing-2xl */
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3rem) !important;
    /* Smaller title */
    margin-bottom: 1rem !important;
}

.hero-subtitle {
    margin-bottom: 1.5rem !important;
}

/* Search Box: Tighter */
.search-box-wrapper {
    margin-bottom: 2rem !important;
}

.search-box {
    padding: 0.5rem 1rem !important;
}

/* Sections: Less spacing between them */
section {
    margin-bottom: 3rem !important;
    /* Global reduction */
}

.section-heading {
    margin-bottom: 1.5rem !important;
}

/* Stats: Compact Strip */
.stats-container {
    padding: 1.5rem !important;
    gap: 1.5rem !important;
}

.stat-item h3 {
    font-size: 1.5rem !important;
}

/* Fix Excessive Gap */
.search-results-section {
    display: none !important;
    padding: 0 !important;
    min-height: 0 !important;
}

.search-results-section.has-results {
    display: block !important;
    padding: 2rem 0 !important;
    min-height: auto !important;
}

/* ===================================
   HOMEPAGE ENHANCEMENTS - COMPACT & USER-FRIENDLY
   =================================== */

/* Enhanced Hero Compactness */
.hero {
    min-height: 45vh !important;
    padding-top: 40px !important;
    padding-bottom: 1.5rem !important;
}

.hero-title {
    font-size: clamp(1.75rem, 4.5vw, 2.75rem) !important;
    margin-bottom: 0.75rem !important;
}

.hero-subtitle {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    margin-bottom: 1.25rem !important;
}

/* Reduced Section Spacing */
section {
    margin-bottom: 2.5rem !important;
}

.section-heading {
    margin-bottom: 1.25rem !important;
}

/* 2x2 Stats Grid on Mobile */
@media (max-width: 768px) {
    .stats-container {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
        padding: 1.25rem !important;
    }

    .stat-item h3 {
        font-size: 1.25rem !important;
    }

    .stat-item p {
        font-size: 0.75rem !important;
    }
}

/* State Filter Input */
.state-filter-wrapper {
    margin-bottom: 1.5rem;
    max-width: 400px;
}

.state-filter-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.state-filter-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.08);
}

.state-filter-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    background: #9fa8fa;
}

/* Compact Trending Chips */
.search-chip {
    padding: 0.5rem 0.85rem !important;
    font-size: 0.85rem !important;
    gap: 0.4rem !important;
}

.chip-icon {
    font-size: 0.85rem !important;
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .back-to-top {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }

    .state-filter-wrapper {
        max-width: 100%;
    }
}

/* ===================================
   TRENDING SEARCHES FIXES (Moved here for Priority)
   =================================== */

/* Enforce Layout */
.trending-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
    margin-top: 1.5rem !important;
}

@media (min-width: 768px) {
    .trending-grid {
        grid-template-columns: 1fr 1fr !important;
        /* Strict side-by-side */
    }
}

.trending-category {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    /* Using purple gradient from style.css */
    border: 1px solid rgba(139, 92, 246, 0.2) !important;
}

/* Enforce Color Gradient */
.trending-heading {
    background: linear-gradient(90deg, #d946ef 0%, #f43f5e 50%, #f97316 100%) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    /* Fallback for fill-color */
    font-size: 1.3rem !important;
    font-weight: 800 !important;
    margin-bottom: 1.25rem !important;
    display: inline-block !important;
    /* Needed for background-clip sometimes */
    width: fit-content !important;
}

/* Enforce Chip Styling */
.search-chip {
    padding: 0.6rem 1rem !important;
    border-radius: 50px !important;
    /* Pill shape */
    font-size: 0.9rem !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(255, 255, 255, 0.05) !important;
}