:root {
    --primary-color: #008000;
    --primary-dark: #006400;
    --primary-light: #90EE90;
    /* Light theme colors */
    --text-light: #1f2937;
    --text-secondary-light: #4b5563;
    --bg-light: #ffffff;
    --card-light: #f9fafb;
    --border-light: #e5e7eb;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --footer-bg-light: #f9fafb;
    --footer-text-light: #374151;
    /* Dark theme colors - improved contrast */
    --text-dark: #f9fafb;
    --text-secondary-dark: #d1d5db;
    --bg-dark: #0f172a;
    --card-dark: #1e293b;
    --border-dark: #334155;
    --shadow-dark: rgba(0, 0, 0, 0.4);
    --footer-bg-dark: #020617;
    --footer-text-dark: #e2e8f0;
    --transition-speed: 0.3s;
}

html {
    scroll-behavior: smooth;
}

/* Default to light theme */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    margin: 0;
    padding: 0;
    --text-color: var(--text-light);
    --text-secondary: var(--text-secondary-light);
    --bg-color: var(--bg-light);
    --card-bg: var(--card-light);
    --border-color: var(--border-light);
    --shadow-color: var(--shadow-light);
    --footer-bg: var(--footer-bg-light);
    --footer-text: var(--footer-text-light);
    background-color: var(--bg-color);
    color: var(--text-color);
}

body.light {
    --text-color: var(--text-light);
    --text-secondary: var(--text-secondary-light);
    --bg-color: var(--bg-light);
    --card-bg: var(--card-light);
    --border-color: var(--border-light);
    --shadow-color: var(--shadow-light);
    --footer-bg: var(--footer-bg-light);
    --footer-text: var(--footer-text-light);
}

body.dark {
    --text-color: var(--text-dark);
    --text-secondary: var(--text-secondary-dark);
    --bg-color: var(--bg-dark);
    --card-bg: var(--card-dark);
    --border-color: var(--border-dark);
    --shadow-color: var(--shadow-dark);
    --footer-bg: var(--footer-bg-dark);
    --footer-text: var(--footer-text-dark);
}

.card {
    background-color: var(--card-bg);
    transition: transform 0.3s, box-shadow 0.3s, background-color var(--transition-speed);
}

/* Improved text contrast for accessibility */
.text-secondary {
    color: var(--text-secondary);
}

/* Override Tailwind classes for better dark mode contrast */
body.dark .text-gray-600 {
    color: var(--text-secondary-dark) !important;
}

body.dark .text-gray-700 {
    color: var(--text-dark) !important;
}

body.dark .text-gray-800 {
    color: var(--text-dark) !important;
}

body.dark .text-gray-400 {
    color: var(--text-secondary-dark) !important;
}

body.dark .text-gray-500 {
    color: var(--text-secondary-dark) !important;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px var(--shadow-color);
}

.section-title {
    position: relative;
    display: inline-block;
    margin-bottom: 2rem;
}

.section-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -10px;
    width: 50px;
    height: 4px;
    background-color: var(--primary-color);
    transition: width 0.3s;
}

.section-title:hover::after {
    width: 100%;
}

.nav-link {
    position: relative;
    margin: 0 1rem;
    text-decoration: none;
    transition: color 0.3s;
}

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

.nav-link:hover::after {
    width: 100%;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

/* Logo Fade-in Animation */
.logo-fade-in {
    animation: fadeInAnimation 1.5s ease-in-out;
    opacity: 0; /* Start fully transparent */
    animation-fill-mode: forwards; /* Stay at 100% opacity after animation */
}

@keyframes fadeInAnimation {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* Timeline */
.timeline {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 6px;
    background-color: var(--primary-color);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -3px;
}

.timeline-container {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 50%;
}

.timeline-container.left {
    left: 0;
}

.timeline-container.right {
    left: 50%;
}

.timeline-container::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 25px;
    right: -17px;
    background-color: var(--bg-color);
    border: 4px solid var(--primary-color);
    top: 15px;
    border-radius: 50%;
    z-index: 1;
}

.timeline-container.left::after {
    right: -13px; /* Adjusted for visual centering */
}

.timeline-container.right::after {
    left: -13px; /* Adjusted for visual centering */
}

.timeline-content {
    padding: 20px 30px;
    background-color: var(--card-bg);
    position: relative;
    border-radius: 6px;
}

@media screen and (max-width: 768px) {
    .timeline::after {
        left: 31px;
    }

    .timeline-container {
        width: 100%;
        padding-left: 70px;
        padding-right: 25px;
    }

    .timeline-container.left {
        left: 0;
    }

    .timeline-container.right {
        left: 0;
    }

    .timeline-container.left::after,
    .timeline-container.right::after {
        left: 15px;
    }
}

/* Button Animation */
.btn-animated {
    position: relative;
    overflow: hidden;
    transition: 0.5s;
}

.btn-animated:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: var(--text-color);
    opacity: 0.1;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: 0.5s;
}

.btn-animated:hover:after {
    width: 300px;
    height: 300px;
}

/* Additional Styles for Sticky Header */
.sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    /* background-color: var(--bg-color); */ /* Ensure bg adapts */
    /* box-shadow: 0 2px 10px rgba(0,0,0,0.1); */ /* Softer shadow */
    transition: transform 0.3s ease-in-out, background-color var(--transition-speed), box-shadow 0.3s; /* Added background-color transition */
}

.header-shadow {
    box-shadow: 0 2px 10px var(--shadow-color);
}

/* Mobile Menu Styles */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%; /* Start off-screen */
    width: 80%; /* Adjust as needed */
    max-width: 300px;
    height: 100%;
    background-color: var(--bg-color); /* Adapts to theme */
    color: var(--text-color);
    box-shadow: -2px 0 5px var(--shadow-color);
    z-index: 1001;
    transition: right 0.3s ease-in-out, background-color var(--transition-speed), color var(--transition-speed);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

.mobile-menu.active {
    right: 0; /* Slide in */
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Footer Styles */
footer {
    background-color: var(--footer-bg) !important;
    color: var(--footer-text) !important;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

footer .border-gray-800 {
    border-color: var(--border-color) !important;
}

footer .text-gray-400 {
    color: var(--footer-text) !important;
    opacity: 0.7;
}

footer input[type="email"] {
    background-color: var(--card-bg);
    color: var(--text-color);
    border-color: var(--border-color);
}

/* Admin Dashboard Styles */
.admin-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    transition: left 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.admin-sidebar.active {
    left: 0;
}

.admin-main {
    margin-left: 0;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.admin-main.sidebar-active {
    margin-left: 280px;
}

.admin-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

.sidebar-nav .nav-link {
    color: var(--text-color);
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: var(--primary-color);
    color: white;
}

.sidebar-nav .nav-link i {
    margin-right: 0.5rem;
    width: 20px;
}

.stats-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.stats-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
}

.login-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 6px var(--shadow-color);
}

.table-responsive {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

.table {
    color: var(--text-color);
    margin-bottom: 0;
}

.table th {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

.table td {
    border-color: var(--border-color);
}

.badge {
    font-size: 0.75rem;
}

.modal-content {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
}

.form-control, .form-select {
    background: var(--card-bg);
    color: var(--text-color);
    border-color: var(--border-color);
}

.form-control:focus, .form-select:focus {
    background: var(--card-bg);
    color: var(--text-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 128, 0, 0.25);
}

@media (min-width: 992px) {
    .admin-sidebar {
        left: 0;
    }
    
    .admin-main {
        margin-left: 280px;
    }
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.admin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.admin-overlay.active {
    display: block;
}

/* Dark mode adjustments */
body.dark .table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: rgba(255, 255, 255, 0.05);
}

body.dark .btn-outline-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

body.dark .btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
