/* Global Styles */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #108e45;
    /* Brand Green */
    --primary-dark: #0c6b33;
    --primary-light: #e6f7ed;
    --accent-color: #16a34a;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --white: #ffffff;
    --background: #fdfdfd;
    --gradient-bg: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-full: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    color: var(--text-color);
    background-color: var(--background);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Navbar */
.navbar {
    padding: 1rem 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-color);
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 20px 24px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--white);
    color: var(--white);
}

.btn-outline:hover {
    background-color: var(--white);
    color: var(--primary-color);
}

.btn-icon {
    height: 25px;
    width: 25px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    /* Ensure it's white if it's not already, or remove if it is */
}

.btn-primary .btn-icon {
    filter: brightness(0) invert(1);
}

/* Sections */
section {
    padding: 5rem 0;
}

.hero {
    padding-top: 10rem;
    padding-bottom: 8rem;
    text-align: center;
    background: var(--gradient-bg);
}

.section-title {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title h2 {
    font-size: 2.25rem;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.section-title p {
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.feature-card {
    text-align: center;
    padding: 2rem;
    background: var(--white);
    border-radius: var(--radius-lg);
    transition: transform 0.3s ease;
}

.feature-card:hover {
    /* Subtle hover effect */
    transform: translateY(-5px);
}

.icon-box {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    background-color: var(--primary-color);
    border-radius: var(--radius-md);
    /* Rounded square logic from image */
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.5rem;
}

.feature-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.feature-card p {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 4rem 0 2rem;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.copyright {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Helper for green text in text blocks */
.text-green {
    color: var(--primary-color);
}

/* Programs Pages Specifics */

/* Program Main Cards */
.program-main-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.program-main-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.program-card-content {
    padding: 2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.link-arrow {
    margin-top: auto;
    color: var(--primary-color);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Price Lists (Harga) */
.price-card {
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-lg);
    padding: 2rem;
    background: var(--white);
}

.price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
}

.price-icon {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

/* SOP Steps */
.step-card {
    background: var(--primary-color);
    color: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    height: 100%;
}

.step-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Bottom Navigation (Jelajahi Lebih Lanjut) */
.nav-card {
    background: var(--primary-color);
    color: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    height: 100%;
    transition: transform 0.2s;
    display: block;
}

.nav-card:hover {
    transform: translateY(-5px);
    color: var(--white);
}

.nav-card-icon {
    background: rgba(255, 255, 255, 0.2);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

/* Stats (Poin Page) */
.stat-large {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        /* Simplification for now */
    }

    .hero {
        padding-top: 8rem;
    }

    .section-title h2 {
        font-size: 1.75rem;
    }
}

/* Auth Pages */
.auth-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.auth-left {
    flex: 1;
    background-color: var(--primary-color);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    padding: 3rem;
    overflow: hidden;
}

.auth-bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.2;
    /* Subtle overlap */
    z-index: 1;
}

.auth-left-content {
    position: relative;
    z-index: 2;
    max-width: 500px;
    text-align: center;
}

.auth-left h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.auth-left p {
    font-size: 1rem;
    line-height: 1.6;
    opacity: 0.9;
}

.auth-right {
    flex: 1;
    background: white;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    position: relative;
    overflow-y: auto;
}

.auth-nav {
    display: flex;
    justify-content: flex-end;
    gap: 2rem;
    margin-bottom: 2rem;
}

.auth-nav a {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
}

.auth-nav a:hover {
    color: var(--primary-color);
}

.auth-form-wrapper {
    max-width: 450px;
    width: 100%;
    margin: auto;
    /* Center vertically and horizontally if flex column */
}

/* Tabs */
.auth-tabs {
    display: flex;
    background: #f3f4f6;
    /* Gray-100 */
    border-radius: var(--radius-md);
    padding: 0;
    margin-bottom: 2rem;
    overflow: hidden;
}

.auth-tab {
    flex: 1;
    text-align: center;
    padding: 1rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
    transition: all 0.2s;
    text-decoration: none;
    background: #f3f4f6;
    border: none;
}

.auth-tab.active {
    background: var(--primary-color);
    color: white;
}

.auth-tab.inactive {
    background: #f3f4f6;
    color: #6b7280;
}

.auth-tab:hover:not(.active) {
    background: #e5e7eb;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.auth-header p {
    font-size: 0.9rem;
    color: var(--text-light);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-color);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.btn-block {
    width: 100%;
    justify-content: center;
    margin-top: 1rem;
}

.credential-box {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
}

.credential-box strong {
    color: var(--primary-color);
}

/* Placeholder styles for inputs */
::placeholder {
    color: #9ca3af;
}

/* Responsive */
@media (max-width: 900px) {
    .auth-container {
        flex-direction: column;
    }

    .auth-left {
        padding: 4rem 2rem;
        min-height: 250px;
    }

    .auth-right {
        padding: 0;
    }

    .auth-nav {
        justify-content: center;
    }
}

.auth-right {
    flex: 1;
    background: white;
    display: flex;
    flex-direction: column;
    padding: 0;
    /* Removed global padding */
    position: relative;
    overflow-y: auto;
}

.auth-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem 2rem;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 50;
    background: white;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.auth-links {
    display: flex;
    gap: 2rem;
}

.auth-nav a {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
    text-decoration: none;
}

.auth-nav a:hover {
    color: var(--primary-color);
}

.auth-form-wrapper {
    max-width: 450px;
    width: 100%;
    margin: auto;
    padding: 2rem;
    /* Add padding here instead */
}

/* Dashboard Styles */
.dashboard-header {
    background: #fff;
    padding: 1.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.dashboard-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    font-weight: 500;
}

.dashboard-stats {
    padding: 2rem 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--primary-color);
    color: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
}

.stat-info h3 {
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.stat-info p {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

/* Dashboard Tabs */
.dashboard-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: none;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.tab-btn.inactive {
    background: white;
    color: var(--primary-color);
    border: 1px solid #e5e7eb;
}

.tab-btn.inactive:hover {
    background-color: #f3f4f6;
}

/* Dashboard Content */
.dashboard-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e5e7eb;
}

/* Table Styles */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.table th {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

.table td {
    color: var(--text-light);
    font-size: 0.9rem;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-success {
    background: #dcfce7;
    color: #166534;
}

.status-pending {
    background: #fef9c3;
    color: #854d0e;
}

.status-inactive {
    background: #f3f4f6;
    color: #6b7280;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

/* Split View for Jual Sampah */
.split-view {
    display: flex;
    gap: 2rem;
}

.split-left,
.split-right {
    flex: 1;
}

@media(max-width: 768px) {
    .split-view {
        flex-direction: column;
    }
}

.price-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
}

.price-list-item h4 {
    font-size: 0.95rem;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.price-list-item span {
    font-size: 0.8rem;
    color: var(--text-light);
}

.price-tag {
    color: var(--primary-color);
    font-weight: 600;
}

/* Admin Dashboard Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background-color: #f8fafc;
    /* Slate-50 */
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    padding: 2rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.admin-sidebar-header {
    padding: 0 2rem;
    margin-bottom: 3rem;
}

.admin-nav {
    flex: 1;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    color: var(--text-light);
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 1rem;
}

.nav-item:hover {
    background-color: #f0fdf4;
    color: var(--primary-color);
}

.nav-item.active {
    background-color: #dcfce7;
    color: #166534;
    font-weight: 600;
}

.nav-item i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.admin-logout {
    margin-top: auto;
    padding: 1rem 2rem;
}

.logout-btn {
    margin-top: auto !important;
    /* Force to bottom in flex column */
}

/* Admin Main Content */
.admin-main {
    flex: 1;
    margin-left: 260px;
    /* Width of sidebar */
    padding: 2rem;
}

.admin-header {
    display: flex;
    justify-content: flex-end;
    /* Just the User Profile on right as per image */
    align-items: center;
    margin-bottom: 2rem;
}

/* Admin Stats Cards */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.admin-stat-card {
    background: var(--primary-color);
    color: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    height: 100%;
    min-height: 140px;
}

.admin-stat-card h3 {
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.admin-stat-card p {
    font-size: 2rem;
    font-weight: 700;
}

.stat-trend {
    font-size: 0.8rem;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.trend-icon {
    background: rgba(255, 255, 255, 0.2);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
}

/* Charts Area */
.charts-row {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.chart-header {
    margin-bottom: 1.5rem;
}

.chart-header h3 {
    color: #166534;
    font-size: 1rem;
    font-weight: 700;
}

/* Simple CSS Bar Chart for demo */
.bar-chart-container {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 200px;
    padding-top: 1rem;
}

.bar-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 10%;
}

.bar {
    width: 100%;
    background-color: var(--primary-color);
    border-radius: 4px;
    transition: height 0.5s ease;
}

.bar-label {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Pie Chart Legend */
.donut-chart-wrapper {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.donut-chart-ui {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: conic-gradient(#34d399 0% 25%,
            #60a5fa 25% 65%,
            #a78bfa 65% 85%,
            #f472b6 85% 100%);
    position: relative;
    /* Create hole for donut */
}

.donut-chart-ui::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 50%;
}

.chart-legend ul {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.legend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    gap: 2rem;
    width: 100%;
}

.legend-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}


/* Admin Table */
.admin-table-card {
    background: white;
    padding: 0;
    border-radius: var(--radius-lg);
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    background: #fdfdfd;
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    text-align: left;
    font-size: 0.85rem;
    border-bottom: 1px solid #e5e7eb;
}

.admin-table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f3f4f6;
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 500;
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.action-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    color: var(--text-color);
}

.action-btn:hover {
    background-color: #f3f4f6;
}

@media (max-width: 1100px) {
    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ... existing code ... */

/* ========================================= */
/* CSS-Only Scroll Animations                */
/* ========================================= */

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: no-preference) {

    /* Animation Keyframes */
    @keyframes fade-in-up {
        0% {
            opacity: 0;
            transform: translateY(50px);
        }

        100% {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* 
       Apply Scroll-Driven Animations
       Uses modern 'animation-timeline: view()' supported in Chrome 115+, Edge 115+
       Elements will fade in and slide up as they scroll into view.
    */
    @supports (animation-timeline: view()) {

        /* General Sections */
        section .container {
            animation: fade-in-up linear both;
            animation-timeline: view();
            animation-range: entry 5% cover 20%;
        }

        /* Cards & Interactive Elements */
        .feature-card,
        .program-main-card,
        .price-card,
        .step-card,
        .nav-card,
        .stat-card,
        .admin-stat-card,
        .chart-card,
        .admin-table-card,
        .auth-left-content,
        .auth-form-wrapper {
            animation: fade-in-up linear both;
            animation-timeline: view();
            animation-range: entry 10% cover 30%;
        }

        /* Titles */
        .section-title h2,
        .section-title p {
            animation: fade-in-up linear both;
            animation-timeline: view();
            animation-range: entry 0% cover 20%;
        }
    }
}

/* ========================================= */
/* CSS-Only Counting Number Animation        */
/* ========================================= */

@property --num {
    syntax: "<integer>";
    initial-value: 0;
    inherits: false;
}

.counting-num {
    counter-reset: num var(--num);
    animation: count-up linear both;
    animation-timeline: view();
    animation-range: entry 10% cover 50%;
}

.counting-num::after {
    content: counter(num);
}

@keyframes count-up {
    from {
        --num: 0;
    }

    to {
        --num: var(--target);
    }
}

/* ========================================= */
/* CSS-Only Pop-In Animation for Stats       */
/* ========================================= */

@keyframes pop-in {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(20px);
    }

    70% {
        transform: scale(1.1) translateY(0);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.stat-pop {
    display: inline-block;
    /* Required for transform */
    animation: pop-in 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
    animation-timeline: view();
    animation-range: entry 10% cover 40%;
}

/* Stagger delays if needed (optional, harder with view() timeline but works with standard animation) */
.stat-pop:nth-child(1) {
    transition-delay: 0ms;
}

.stat-pop:nth-child(2) {
    transition-delay: 100ms;
}

.stat-pop:nth-child(3) {
    transition-delay: 200ms;
}

/* ========================================= */
/* MOBILE RESPONSIVENESS UPDATES             */
/* ========================================= */

/* Grid Classes inserted to replace inline styles */
.grid-split,
.stats-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.stats-grid-2 {
    gap: 2rem;
}

/* Mobile Media Queries */
@media (max-width: 768px) {

    /* Layout Reset */
    .container {
        padding: 0 1.5rem;
    }

    /* Navbar */
    .navbar {
        padding: 1rem 0;
        background: white;
        /* Ensure visibility */
    }

    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        display: flex;
        flex-direction: row;
        /* Horizontal scroll if many, or wrap */
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
        width: 100%;
    }

    /* Hero */
    .hero {
        padding-top: 11rem;
        /* Make space for stacked nav */
        padding-bottom: 4rem;
    }

    .hero h1 {
        font-size: 2.5rem !important;
        /* Override inline style */
        line-height: 1.2;
    }

    .hero .btn {
        width: 100%;
        justify-content: center;
    }

    .hero div[style*="display: flex"] {
        flex-direction: column;
        width: 100%;
    }

    /* Grids to Single Column */
    .card-grid,
    .grid-split,
    .stats-grid-2,
    .admin-stats-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem;
    }

    .admin-stats-grid {
        gap: 1rem;
    }

    /* Admin Dashboard Layout */
    .admin-layout {
        display: flex;
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1rem 0;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        overflow-y: visible;
    }

    .admin-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        gap: 0.5rem;
    }

    .nav-item {
        white-space: nowrap;
        font-size: 0.85rem;
        padding: 0.75rem;
        width: auto;
        /* Allow auto width for horizontal scrolling */
    }

    .admin-sidebar-header {
        /* Optionally show logo only */
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-bottom: 1rem;
        padding: 0 1rem;
    }

    /* .admin-logout was removed as it's no longer needed to be hidden on mobile */

    .admin-main {
        margin-left: 0;
        padding: 1rem;
        width: 100%;
    }

    /* Dashboard Content */
    .charts-row {
        flex-direction: column;
        gap: 2rem;
    }

    .chart-card {
        padding: 1rem;
    }

    .bar-chart-wrapper {
        overflow-x: auto;
        /* Allow horizontal scroll if bars slightly compressed */
    }

    .donut-chart-wrapper {
        flex-direction: column;
        text-align: center;
    }

    /* Tables */
    .admin-table-card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.75rem 1rem;
        white-space: nowrap;
        /* Prevent wrapping in tight cells */
    }

    /* Auth Pages */
    .auth-container {
        flex-direction: column;
    }

    .auth-left {
        display: none;
        /* Often best to hide the artistic side on mobile to get to the form */
    }

    .auth-right {
        padding: 1rem;
    }

    /* General Typography */
    .section-title h2 {
        font-size: 1.75rem !important;
    }

    .admin-header {
        margin-bottom: 1rem;
        justify-content: center;
    }

    /* Footer */
    .footer-links,
    .social-links {
        flex-direction: column;
        gap: 1rem;
    }
}