/* assets/css/style.css */

/* Fonts & Variables */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #164A41;
    --primary-light: #4D774E;
    --primary-bg: #f0f5f3;
    --secondary: #F1B24A;
    --secondary-light: #f9dfb2;
    --dark: #0e2924;
    --light: #f7faf9;
    --gray: #5a726e;
    --border-color: rgba(22, 74, 65, 0.12);
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    --shadow-sm: 0 4px 15px rgba(22, 74, 65, 0.05);
    --shadow-md: 0 12px 35px rgba(22, 74, 65, 0.08);
    --shadow-lg: 0 24px 55px rgba(22, 74, 65, 0.12);
    --border-radius: 24px;
    --border-radius-sm: 16px;

    /* Accent colors based on the new botanical theme */
    --accent-green: #4D774E;
    --accent-green-light: #9DC88D;
    --accent-green-bg: #f0f5f3;
    
    /* Override Bootstrap variables dynamically to match our new botanical theme */
    --bs-primary: #164A41;
    --bs-primary-rgb: 22, 74, 65;
    --bs-link-color: #164A41;
    --bs-link-hover-color: #4D774E;
}

/* Custom Bootstrap Override to Match Brown Brand Color */
.text-primary {
    color: var(--primary) !important;
}
.hover-text-primary:hover {
    color: var(--primary) !important;
}
.bg-primary {
    background-color: var(--primary) !important;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #5d4328 100%) !important;
    border: none !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(122, 92, 62, 0.2);
    transition: var(--transition);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(122, 92, 62, 0.35);
    color: #ffffff !important;
}
.btn-outline-primary {
    color: var(--primary) !important;
    border: 2px solid var(--primary) !important;
    background-color: transparent !important;
    transition: var(--transition);
}
.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(122, 92, 62, 0.2);
}
.list-group-item.active {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}
.page-item.active .page-link {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
}
.page-link {
    color: var(--primary) !important;
}
.page-link:hover {
    color: var(--primary-light) !important;
}

/* Global Styles */
body {
    font-family: var(--font-sans);
    color: var(--dark);
    background-color: #f6fbf9; /* Soft botanical white-green background */
    background-image: 
        radial-gradient(at 0% 0%, rgba(22, 74, 65, 0.03) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(77, 119, 78, 0.04) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(241, 178, 74, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
    overflow-x: hidden;
}

a {
    color: var(--secondary);
    text-decoration: none;
    transition: var(--transition);
}
a:hover {
    color: var(--secondary-light);
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 55px;
    height: 55px;
    border: 3px solid rgba(122, 92, 62, 0.1); /* Match our warm brown brand theme */
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    margin: 0 auto 15px; /* CENTER the block horizontally and add bottom space */
    animation: spin 1s cubic-bezier(0.55, 0.085, 0.68, 0.53) infinite;
}

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

/* Sticky Navbar & Glassmorphism */
.navbar-custom {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1030;
    background-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    transition: var(--transition);
    padding: 24px 0;
}

/* Adjust subpage breadcrumb headers to accommodate transparent absolute navbar */
.navbar-custom ~ div.text-white[style*="background"] {
    padding-top: 150px !important;
    padding-bottom: 50px !important;
}

.navbar-brand-custom {
    font-weight: 800;
    font-size: 1.45rem;
    color: #ffffff !important;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.5px;
    transition: var(--transition);
}

.navbar-custom .nav-link {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    padding: 8px 18px !important;
    border-radius: 30px;
    transition: var(--transition);
    font-size: 0.95rem;
}

/* Active or Hover menu item: Orange! */
.navbar-custom .nav-link:hover,
.navbar-custom .nav-item.active .nav-link {
    color: #0e2924 !important;
    background-color: #F1B24A !important; /* Orange accent color */
    box-shadow: 0 4px 12px rgba(241, 178, 74, 0.25);
}

/* Toggle icon color in transparent mode */
.navbar-custom .navbar-toggler-icon {
    filter: invert(1) grayscale(1) brightness(2); /* Make it white */
}

/* Scrolled state */
.navbar-custom.scrolled,
.navbar-custom.navbar-scrolled {
    position: fixed; /* Keep fixed to top when scrolled */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1030;
    padding: 12px 0;
    background-color: rgba(255, 255, 255, 0.98) !important; /* solid/opaque white background */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(22, 74, 65, 0.08);
    border-bottom: 1px solid rgba(22, 74, 65, 0.05);
}

.navbar-custom.scrolled .navbar-brand-custom,
.navbar-custom.navbar-scrolled .navbar-brand-custom {
    color: var(--primary) !important;
}

.navbar-custom.scrolled .nav-link,
.navbar-custom.navbar-scrolled .nav-link {
    color: var(--dark);
}

.navbar-custom.scrolled .nav-link:hover,
.navbar-custom.scrolled .nav-item.active .nav-link,
.navbar-custom.navbar-scrolled .nav-link:hover,
.navbar-custom.navbar-scrolled .nav-item.active .nav-link {
    color: #0e2924 !important;
    background-color: #F1B24A !important; /* Keep active item orange */
    box-shadow: 0 4px 12px rgba(241, 178, 74, 0.25);
}

.navbar-custom.scrolled .navbar-toggler-icon,
.navbar-custom.navbar-scrolled .navbar-toggler-icon {
    filter: none; /* Reset toggler color to default dark */
}

/* Mobile Hamburger Menu Background & Styling */
@media (max-width: 991.98px) {
    /* Solid background on top bar when hamburger is opened at top of page */
    .navbar-custom.menu-open:not(.scrolled),
    .navbar-custom:has(.navbar-collapse.show):not(.scrolled),
    .navbar-custom:has(.navbar-collapse.collapsing):not(.scrolled) {
        background-color: var(--primary) !important;
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    }

    /* Container background for collapsed menu on mobile when NOT scrolled */
    .navbar-custom:not(.scrolled) .navbar-collapse {
        background: linear-gradient(135deg, #164A41 0%, #0e2924 100%);
        border-radius: 20px;
        padding: 20px;
        margin-top: 15px;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.12);
    }

    /* Container background for collapsed menu on mobile when scrolled */
    .navbar-custom.scrolled .navbar-collapse {
        background-color: #ffffff;
        border-radius: 20px;
        padding: 20px;
        margin-top: 15px;
        box-shadow: 0 15px 35px rgba(22, 74, 65, 0.12);
        border: 1px solid rgba(22, 74, 65, 0.08);
    }

    .navbar-custom .nav-item {
        margin-bottom: 6px;
    }
    .navbar-custom .nav-item:last-child {
        margin-bottom: 0;
    }
}

.btn-nav-login {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    color: #fff !important;
    border-radius: 30px;
    font-weight: 600;
    padding: 8px 24px !important;
    box-shadow: 0 8px 20px rgba(22, 74, 65, 0.15);
    transition: var(--transition);
}

.btn-nav-login:hover {
    background: linear-gradient(135deg, var(--secondary-light) 0%, var(--secondary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(22, 74, 65, 0.25);
}

/* Hero Section */
.hero-section {
    position: relative;
    padding: 180px 0 120px;
    background: linear-gradient(135deg, rgba(77, 119, 78, 0.85) 0%, rgba(22, 74, 65, 0.93) 100%), 
                url('../images/hero-bg.jpg') center/cover no-repeat; /* Beautiful real local village rice fields sawah */
    color: #fff;
    min-height: 85vh;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(161, 129, 98, 0.15) 0%, rgba(161, 129, 98, 0) 70%);
    top: -200px;
    right: -200px;
    border-radius: 50%;
    z-index: 1;
    pointer-events: none;
    animation: heroPulse 12s ease-in-out infinite alternate;
}

@keyframes heroPulse {
    0% { transform: scale(1) translate(0, 0); opacity: 0.5; }
    100% { transform: scale(1.2) translate(-50px, 50px); opacity: 0.8; }
}

.hero-title {
    font-weight: 800;
    font-size: 3.8rem;
    line-height: 1.15;
    margin-bottom: 24px;
    text-shadow: 0 4px 15px rgba(0,0,0,0.2);
    letter-spacing: -1.5px;
}

.hero-subtitle {
    font-size: 1.3rem;
    font-weight: 300;
    margin-bottom: 40px;
    opacity: 0.9;
    line-height: 1.7;
    max-width: 650px;
}

/* Cards & Layout Grid */
.card-custom {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(122, 92, 62, 0.06);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.card-custom:hover {
    transform: translateY(-10px) scale(1.01);
    box-shadow: var(--shadow-lg);
    border-color: rgba(122, 92, 62, 0.2);
    background: rgba(255, 255, 255, 0.95);
}

.card-img-custom {
    height: 230px;
    object-fit: cover;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-custom:hover .card-img-custom {
    transform: scale(1.06);
}

.card-body-custom {
    padding: 28px;
}

.badge-custom {
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge-primary {
    background-color: var(--primary-bg);
    color: var(--primary);
}

.badge-secondary {
    background-color: rgba(122, 92, 62, 0.08);
    color: var(--secondary);
}

/* Section Header */
.section-title {
    position: relative;
    font-weight: 800;
    font-size: 2.4rem;
    color: var(--dark);
    margin-bottom: 20px;
    letter-spacing: -0.75px;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 5px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    margin-top: 15px;
    border-radius: 10px;
}

.section-title-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.section-title-center::after {
    margin-left: auto;
    margin-right: auto;
}

/* Statistics Counter Section */
.stats-container {
    margin-top: -60px;
    position: relative;
    z-index: 10;
}

.stats-card {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--border-radius);
    padding: 35px 30px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(122, 92, 62, 0.05);
    text-align: center;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.stats-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-green);
    background: rgba(255, 255, 255, 0.95);
}

.stats-icon {
    font-size: 2rem;
    color: var(--primary);
    margin: 0 auto 20px;
    width: 65px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px; /* Squircle style */
    background-color: var(--primary-bg);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.stats-card:hover .stats-icon {
    background-color: var(--accent-green);
    color: #fff;
    transform: scale(1.15) rotate(12deg);
    border-radius: 50%; /* Smooth transition to circle */
}

.stats-count {
    font-size: 2.2rem;
    font-weight: 850;
    color: var(--dark);
    margin-bottom: 5px;
    letter-spacing: -1px;
}

.stats-label {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Logbook Timeline */
.timeline {
    position: relative;
    padding: 30px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background-color: var(--border-color);
    transform: translateX(-50%);
}

.timeline-item {
    position: relative;
    margin-bottom: 50px;
    width: 50%;
}

.timeline-item:nth-child(even) {
    left: 50%;
    padding-left: 40px;
}

.timeline-item:nth-child(odd) {
    left: 0;
    padding-right: 40px;
    text-align: right;
}

.timeline-dot {
    position: absolute;
    top: 20px;
    left: 100%;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--primary);
    border: 4px solid #fff;
    box-shadow: 0 0 0 4px rgba(78, 159, 61, 0.2);
    transform: translateX(-50%);
    z-index: 10;
    transition: var(--transition);
}

.timeline-item:nth-child(even) .timeline-dot {
    left: 0;
}

.timeline-item:hover .timeline-dot {
    background-color: var(--secondary);
    transform: translateX(-50%) scale(1.2);
}

.timeline-date {
    font-weight: 700;
    font-size: 1rem;
    color: var(--secondary);
    margin-bottom: 8px;
}

.timeline-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 25px;
    border-radius: var(--border-radius);
    border: 1px solid rgba(122, 92, 62, 0.06);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    text-align: left;
}

.timeline-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: rgba(122, 92, 62, 0.2);
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-5px);
}

@media (max-width: 768px) {
    .timeline::before {
        left: 20px;
    }
    .timeline-item {
        width: 100% !important;
        left: 0 !important;
        padding-left: 40px !important;
        padding-right: 0 !important;
        text-align: left !important;
    }
    .timeline-dot {
        left: 20px !important;
    }
}

/* Lightbox Modal CSS */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(10, 25, 12, 0.95);
    backdrop-filter: blur(8px);
}

.lightbox-content {
    position: relative;
    margin: auto;
    display: block;
    max-width: 85%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s ease;
}

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

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.lightbox-close:hover {
    color: var(--primary-light);
}

.lightbox-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 15px 0;
    font-size: 1.1rem;
}

/* Scroll to Top */
#btn-back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: none;
    z-index: 1000;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 4px 10px rgba(30, 81, 40, 0.3);
    transition: var(--transition);
    align-items: center;
    justify-content: center;
}

#btn-back-to-top:hover {
    background-color: var(--primary-light);
    transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(30, 81, 40, 0.4);
}

/* Leaflet Map Styling */
#map {
    height: 480px;
    width: 100%;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    z-index: 1;
}

.leaflet-popup-content-wrapper {
    border-radius: 12px;
    padding: 5px;
}

.leaflet-popup-content h5 {
    font-weight: 700;
    color: var(--primary);
    font-size: 1rem;
    margin-bottom: 5px;
}

/* Admin Dashboard CSS Styling */
.admin-wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
    min-height: 100vh;
}

#admin-sidebar {
    min-width: 260px;
    max-width: 260px;
    background: radial-gradient(circle at 50% 0%, #1c534a 0%, #0e2924 100%);
    color: #fff;
    transition: all 0.3s;
    box-shadow: 4px 0 15px rgba(0,0,0,0.1);
    z-index: 100;
}

#admin-sidebar.active {
    margin-left: -260px;
}

#admin-sidebar .sidebar-header {
    padding: 20px;
    background: #0b211d;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

#admin-sidebar ul.components {
    padding: 20px 0;
}

#admin-sidebar ul li a {
    padding: 12px 20px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    transition: var(--transition);
}

#admin-sidebar ul li a:hover,
#admin-sidebar ul li.active a {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-left: 4px solid var(--primary-light);
}

#admin-content {
    width: 100%;
    padding: 30px;
    background: #f4f7f5;
    transition: all 0.3s;
    overflow-x: hidden;
}

.admin-card-stat {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.02);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    background: #ffffff;
}

.admin-card-stat:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(30, 81, 40, 0.05);
}

/* Tables in Admin */
.table-custom {
    background: #fff;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.02);
    border: 1px solid rgba(0,0,0,0.03);
}

.table-custom th {
    background-color: var(--primary-bg);
    color: var(--primary);
    font-weight: 750;
    border-bottom: 2px solid rgba(30, 81, 40, 0.04);
    padding: 18px 24px;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.75px;
}

.table-custom td {
    padding: 18px 24px;
    vertical-align: middle;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    color: #495057;
    font-size: 0.95rem;
}

/* Footer Section */
.footer-custom {
    background-color: #0d1e11;
    color: rgba(255, 255, 255, 0.7);
    padding: 70px 0 30px;
    font-size: 0.95rem;
    border-top: 4px solid var(--primary-light);
}

.footer-title {
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 25px;
}

.footer-links {
    list-style: none;
    padding-left: 0;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
}

.footer-links a:hover {
    color: #fff;
    padding-left: 5px;
}

.footer-socials {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.footer-socials a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    color: #fff;
    transition: var(--transition);
}

.footer-socials a:hover {
    background-color: var(--primary-light);
    transform: translateY(-3px);
}

.footer-bottom {
    margin-top: 50px;
    padding-top: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
}
