:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --background-color: #f3f4f6;
    --text-color: #1f2937;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Navbar */
.navbar {
    background-color: var(--card-bg);
    padding: 1rem 0;
    /* Remove side padding, handled by wrapper */
    display: block;
    /* Changed from flex */
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Navbar Wrapper */
.nav-wrapper {
    max-width: 90%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Hamburger Menu */
.hamburger {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    /* Align icon and text */
    align-items: center;
    gap: 0.75rem;
}

.icon-bg {
    background-color: #e0e7ff;
    /* Light indigo */
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    text-decoration: none;
    color: #6b7280;
    font-weight: 500;
    transition: color 0.3s;
}

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

/* Container */
.container {
    max-width: 90%;
    /* Match navbar width */
    margin: 2rem auto;
    padding: 0;
}

.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

.card-header {
    margin-bottom: 2rem;
    text-align: center;
    background-color: #e0e7ff;
    /* Light indigo background */
    padding: 1rem;
    border-radius: 8px;
}

.card-header h2 {
    color: var(--primary-color);
    margin-bottom: 0;
}

.card-header p {
    color: #6b7280;
    font-size: 0.95rem;
}

/* Page/Dashboard Header */
.page-header,
.dashboard-header {
    margin-bottom: 2rem;
}

.page-header h2,
.dashboard-header h2 {
    font-size: 1.75rem;
    color: #1f2937;
    /* Force Dark Color */
    margin-bottom: 0.25rem;
}

.page-header p,
.dashboard-header p {
    color: #6b7280;
    margin-top: 0;
}

/* Form */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.info-text {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 500;
}

select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    background-color: #fff;
    cursor: pointer;
}

option {
    color: #1f2937;
    background-color: #fff;
}

/* Specific style for disabled options to be visible but distinct */
option:disabled {
    color: #9ca3af;
    background-color: #f3f4f6;
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    /* Fixed width for inputs, rest for upload */
    gap: 2rem;
}

.form-left {
    display: flex;
    flex-direction: column;
}

.form-right {
    display: flex;
    flex-direction: column;
}

.upload-group {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* File Upload */
.file-drop-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    position: relative;
    transition: border-color 0.3s;
    cursor: pointer;
    flex: 1;
    /* Fill remaining height */
    display: flex;
    flex-direction: column;
    /* Stack content */
    align-items: center;
    justify-content: center;
    min-height: 300px;
    /* Reduced from 500px */
    background-color: #f9fafb;
}

.file-drop-area:hover {
    border-color: var(--primary-color);
    background-color: #f0f7ff;
}

.drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
    /* Let clicks pass to input */
}

.fake-btn {
    background-color: #e0e7ff;
    color: var(--primary-color);
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
}

.file-msg {
    color: #9ca3af;
    font-size: 0.95rem;
}

.file-input {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
    /* Behind file list items */
}

.file-list {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    /* Smaller thumbnails */
    gap: 0.75rem;
    width: 100%;
    z-index: 10;
    /* Above input */
    pointer-events: none;
    /* Let clicks pass through gaps */
}

.file-item {
    pointer-events: auto;
    /* Enable clicks on items */
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    group: relative;
}

.file-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
    transition: transform 0.3s;
}

.file-item img:hover {
    transform: scale(1.05);
}

.remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(239, 68, 68, 0.9);
    /* Red */
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
    z-index: 10;
}

.remove-btn:hover {
    background-color: #dc2626;
}

/* Lightbox Modal */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.lightbox img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

/* Submit Button */
/* Button Group */
.button-group {
    display: flex;
    justify-content: flex-end;
    /* Align right */
    gap: 1rem;
    margin-top: 1rem;
}

/* Submit Button */
.btn-submit {
    width: auto;
    /* Not full width */
    padding: 0.75rem 2rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-submit:hover {
    background-color: var(--primary-hover);
}

.btn-submit:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

/* Reset Button */
.btn-reset {
    padding: 0.75rem 2rem;
    background-color: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-reset:hover {
    background-color: #f3f4f6;
    color: #374151;
    border-color: #9ca3af;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 1000;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e5e7eb;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
/* Responsive */
@media (max-width: 820px) {

    /* Tablet/Mobile breakpoint */
    .navbar {
        padding: 1rem;
    }

    .nav-brand {
        font-size: 1.2rem;
        /* Smaller font size on mobile */
        white-space: nowrap;
        /* Keep on one line */
    }

    .hamburger {
        display: block;
        /* Show hamburger */
    }

    .nav-menu {
        display: none;
        /* Hide menu by default */
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--card-bg);
        flex-direction: column;
        padding: 1rem 0;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        text-align: center;
        gap: 0;
    }

    .nav-menu.active {
        display: flex;
        /* Show when active */
    }

    .nav-link {
        padding: 1rem;
        width: 100%;
        display: block;
    }

    .nav-link:hover {
        background-color: #f3f4f6;
    }

    .container {
        max-width: 100%;
        padding: 0 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
        /* Stack vertically */
        gap: 1.5rem;
    }

    .button-group {
        flex-direction: column-reverse;
        /* Stack buttons */
    }

    .btn-submit,
    .btn-reset {
        width: 100%;
        /* Full width on mobile/tablet small */
    }
}

/* Toast Notifications */
.toast-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    display: none;
    justify-content: center;
    align-items: flex-start;
    /* Align to top */
    padding-top: 2rem;
}

.toast-box {
    background-color: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: slideDown 0.3s ease-out;
}

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

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.toast-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.5rem;
}

.toast-message {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.toast-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-confirm {
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    border: none;
    font-weight: 500;
    cursor: pointer;
}

.btn-cancel {
    background-color: #f3f4f6;
    color: #374151;
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-weight: 500;
    cursor: pointer;
}

/* Success Toast */
.success-toast {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: #10b981;
    /* Green */
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 3001;
    display: none;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    animation: fadeInDown 0.5s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Error Toast */
.error-toast {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: #fef2f2;
    color: #b91c1c;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 3001;
    /* Same as success for visibility */
    font-weight: 500;
    border: 1px solid #fecaca;
    animation: fadeInDown 0.5s ease;
    /* Reuse existing animation */
}

/* Gallery Styles */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding-bottom: 2rem;
}

.gallery-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    cursor: pointer;
    background-color: #f3f4f6;
}

.gallery-caption {
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
}

.caption-kecamatan {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.caption-kegiatan {
    font-size: 0.95rem;
    color: #1f2937;
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Carousel Styles */
.carousel-container {
    position: relative;
    width: 100%;
    height: 200px;
    background-color: #f3f4f6;
    overflow: hidden;
}

.carousel-track {
    display: flex;
    height: 100%;
    width: 100%;
    overflow-x: scroll;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
    scroll-behavior: smooth;
}

.carousel-track::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.carousel-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    scroll-snap-align: center;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
}

/* Navigation Buttons */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.7);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 5;
    transition: background 0.2s;
}

.carousel-btn:hover {
    background: rgba(255, 255, 255, 0.95);
}

.carousel-btn.prev {
    left: 8px;
}

.carousel-btn.next {
    right: 8px;
}

.carousel-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

/* Indicators/Counter */
.carousel-indicator {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    pointer-events: none;
}

.loading-placeholder,
.error-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

.error-msg {
    color: #dc2626;
}