:root {
    --primary-green: #2E7D32;
    --secondary-green: #4a7c44;
    --accent-green: #F3F7F3;
    --earth-brown: #8d6e63;
    --earth-light: #F3F4F6;
    --text-dark: #1F2937;
    --text-muted: #6B7280;
    --white: #ffffff;
    --bg-body: #F9FAFB;
    --card-bg: #FFFFFF;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    --transition: all 0.25s ease;
}

body.dark {
    --primary-green: #4caf50;
    --secondary-green: #81c784;
    --accent-green: #1b2e1b;
    --earth-brown: #d7ccc8;
    --earth-light: #2c2c2c;
    --text-dark: #f5f5f5;
    --text-muted: #b0bec5;
    --white: #1e1e1e;
    --bg-body: #121212;
    --card-bg: #1e1e1e;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header & Nav */
header {
    background: var(--white);
    padding: 0.6rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    animation: fadeInDown 0.5s ease-out;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-transform: uppercase;
    text-decoration: none;
    transition: var(--transition);
}

.logo:hover {
    transform: scale(1.02);
}

.logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.logo span {
    color: #000000;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 1.75rem;
    align-items: center;
}

.theme-btn {
    background: var(--earth-light);
    border: 1px solid rgba(0,0,0,0.05);
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-dark);
    transition: var(--transition);
}

.theme-btn:hover {
    background: var(--accent-green);
    border-color: var(--primary-green);
}

.tools-btn {
    background: transparent !important;
    color: var(--primary-green) !important;
    border: 2px solid var(--primary-green);
    padding: 0.4rem 1.1rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
}

.tools-btn:hover {
    background: var(--primary-green) !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.2);
}

nav a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
    position: relative;
    padding: 0.2rem 0;
}

nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--primary-green);
    transition: width 0.3s ease;
}

nav a:hover {
    color: var(--primary-green);
}

nav a:hover::after {
    width: 100%;
}

.tools-btn::after {
    display: none;
}

/* Hero Section */
.hero {
    padding: 6rem 0;
    text-align: center;
    background: var(--bg-body);
    color: var(--text-dark);
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-weight: 700;
    animation: fadeInDown 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero h1 span {
    color: var(--primary-green);
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto 2rem;
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.2s backwards;
}

/* Stats Dashboard */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    padding: 30px;
    background: #F3F7F3;
    border-radius: 20px;
    margin-top: -3rem;
    position: relative;
    z-index: 10;
    box-shadow: var(--shadow);
}

body.dark .stats-container {
    background: #1b2e1b;
}

.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    transition: var(--transition);
    animation: scaleIn 0.5s ease-out backwards;
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.stat-card h3 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.stat-card p {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Controls Section */
.controls {
    padding: 2.5rem 0;
    background: var(--white);
    border-top: 1px solid rgba(0,0,0,0.05);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.controls-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: space-between;
}

.search-box {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.8rem;
    border: 2px solid #eee;
    border-radius: 12px;
    outline: none;
    transition: var(--transition);
    font-size: 1rem;
}

.search-box input:focus {
    border-color: var(--primary-green);
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.filter-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.7rem 1.5rem;
    border: 1px solid rgba(0,0,0,0.05);
    background: var(--earth-light);
    color: var(--text-dark);
    border-radius: 100px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    background: var(--accent-green);
}

.filter-btn.active {
    background: var(--primary-green);
    color: var(--white);
    border-color: var(--primary-green);
    box-shadow: 0 4px 15px rgba(45, 90, 39, 0.3);
}

.state-select {
    padding: 0.6rem 1rem;
    border: 2px solid #eee;
    border-radius: 12px;
    outline: none;
    cursor: pointer;
    font-size: 0.95rem;
}

/* State Info Section */
.state-info-panel {
    padding: 3rem 0;
    display: none; /* Hidden by default */
    animation: fadeIn 0.6s ease-out;
    scroll-margin-top: 80px;
}

.state-info-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2.5rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.info-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stats-mini {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    background: #F3F7F3;
    padding: 1.5rem;
    border-radius: 16px;
}

body.dark .stats-mini {
    background: #1b2e1b;
}

.mini-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--white);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.mini-stat span {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.mini-stat strong {
    font-size: 1.5rem;
    color: var(--text-dark);
}

.area-list-section {
    margin-top: 1rem;
}

.area-list-section h4 {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.area-list-section p {
    font-size: 0.95rem;
    color: var(--text-dark);
    line-height: 1.8;
}

.info-item h4 {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.info-item p {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-dark);
}

.river-tag {
    background: #E0F7FA;
    color: #00796B;
    padding: 6px 12px;
    border-radius: 20px;
    margin: 4px;
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.river-tag:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,121,107,0.2);
}

/* Grid Section */
.content-grid {
    padding: 4rem 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    padding: 1.75rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(30px);
}

.card.peak-card {
    border-left: 4px solid #ffd700;
}

.card.show {
    opacity: 1;
    transform: translateY(0);
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-green);
    background: var(--white);
}

.card-type {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--primary-green);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card .label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 2px;
    display: block;
}

.card .value {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    display: block;
}

.species-list {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.species-tag {
    display: inline-block;
    background: var(--earth-light);
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    font-size: 0.75rem;
    margin-right: 0.4rem;
    margin-bottom: 0.4rem;
    color: var(--text-dark);
    transition: var(--transition);
}

.species-tag:hover {
    background: var(--primary-green);
    color: var(--white);
    transform: translateY(-2px);
}

.upsc-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: #ffd700;
    color: #000;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 10;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.5s ease;
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid var(--accent-green);
    border-bottom-color: var(--primary-green);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: var(--white);
    margin: 5% auto;
    padding: 2.5rem;
    border-radius: 20px;
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px rgba(0,0,0,0.2);
}

.close-modal {
    position: absolute;
    right: 1.5rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--primary-green);
}

.notes-body h2 {
    color: var(--primary-green);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--accent-green);
    padding-bottom: 0.5rem;
}

.ramsar-section h2 {
    color: #00796B !important;
    border-bottom-color: #E0F7FA !important;
}

.notes-body h3 {
    margin: 2rem 0 1rem;
    color: var(--text-dark);
}

.notes-body ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.notes-body li {
    margin-bottom: 0.5rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.feature-item {
    background: var(--accent-green);
    padding: 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
}

.tables-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.table-wrapper h4 {
    margin-bottom: 0.75rem;
    color: var(--primary-green);
    font-size: 0.9rem;
    text-transform: uppercase;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--earth-light);
}

th {
    background: var(--earth-light);
    font-weight: 700;
}

.facts-list li {
    background: #fff9c4;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    list-style: none;
    border-left: 4px solid #fbc02d;
}

body.dark .facts-list li {
    background: #332b00;
    color: #fff;
}

@media (max-width: 768px) {
    .tables-section {
        grid-template-columns: 1fr;
    }
    .modal-content {
        margin: 10% auto;
        padding: 1.5rem;
    }
}
    .hero h1 { font-size: 3rem; }
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .hero { padding: 4rem 0; }
    .hero h1 { font-size: 2.2rem; }
    
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    nav ul {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .stats-container {
        grid-template-columns: 1fr 1fr;
        padding: 20px;
        margin-top: -2rem;
    }
    
    .stat-card h3 { font-size: 24px; }
    
    .controls { padding: 1.5rem 0; }
    .controls-container { flex-direction: column; align-items: stretch; }
    .search-box { min-width: 100%; }
    .filter-group { justify-content: center; }
    
    .state-info-card {
        grid-template-columns: 1fr;
        padding: 1.5rem;
        gap: 1.5rem;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
        padding: 2rem 0;
    }
}

@media (max-width: 480px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .hero h1 { font-size: 1.8rem; }
    .hero p { font-size: 1rem; }
    
    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
}

footer {
    padding: 5rem 0 2rem;
    background: #1F2937;
    color: #F9FAFB;
    margin-top: 5rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-brand h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #FFFFFF;
}

.footer-brand p {
    color: #9CA3AF;
    font-size: 0.95rem;
    line-height: 1.6;
}

.footer-links h4 {
    color: #FFFFFF;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: #9CA3AF;
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-green);
    padding-left: 5px;
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.footer-bottom p {
    color: #6B7280;
    font-size: 0.85rem;
}

@media (max-width: 1024px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

@media (max-width: 640px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-brand {
        text-align: center;
    }
    
    .footer-links {
        text-align: center;
    }
}
