/* ============================================
   SIUMKM GKJ Wirobrajan — Main Stylesheet
   Sistem Informasi UMKM Jemaat GKJ Wirobrajan
   ============================================ */

/* --- CSS Custom Properties / Design Tokens --- */
:root {
    --color-primary: #00a4bb;
    --color-primary-light: #e0f2fe;
    --color-primary-bg: #f0f9ff;
    --color-success: #10b981;
    --color-text-dark: #0f172a;
    --color-text: #1e293b;
    --color-text-muted: #475569;
    --color-text-light: #64748b;
    --color-text-lighter: #94a3b8;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;
    --color-bg: #f8f9fa;
    --color-white: #ffffff;
    --color-scrollbar-track: #f1f5f9;
    --color-scrollbar-thumb: #cbd5e1;
    --color-scrollbar-hover: #94a3b8;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --navbar-height: 70px;
    --sidebar-width: 360px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 14px;
    --radius-pill: 20px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.02);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.05);
    --shadow-lg: 0 4px 15px rgba(0,0,0,0.08);
    --shadow-popup: 0 10px 40px rgba(0,0,0,0.12);
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* --- Base / Reset --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    overflow: hidden;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Skip to Content (Accessibility) --- */
.skip-to-content {
    position: absolute;
    top: -100%;
    left: 0;
    z-index: 9999;
    background: var(--color-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s;
}

.skip-to-content:focus {
    top: 0;
}

/* --- Navbar --- */
.navbar-custom {
    background-color: var(--color-primary);
    color: white;
    height: var(--navbar-height);
}

/* --- Search Bars --- */
.search-bar-nav {
    border-radius: var(--radius-md);
    border: none;
    padding-left: 36px;
    padding-right: 16px;
    font-size: 0.9rem;
    height: 38px;
}

.search-bar-sidebar {
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding-left: 36px;
    padding-right: 16px;
    font-size: 0.85rem;
    height: 38px;
    background-color: #f8fafc;
}

/* --- Layout --- */
.main-wrapper {
    display: flex;
    height: calc(100vh - var(--navbar-height));
    position: relative;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-white);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    height: 100%;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
}

.sidebar-search-container {
    padding: 0 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    background-color: var(--color-white);
}

/* --- Map --- */
.map-container {
    flex-grow: 1;
    position: relative;
}

#map {
    height: 100%;
    width: 100%;
    z-index: 1;
}

/* --- UMKM Cards --- */
.umkm-card {
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 1rem;
    transition: all var(--transition-fast);
    cursor: pointer;
    background: var(--color-white);
    box-shadow: var(--shadow-sm);
}

.umkm-card:hover {
    border-color: #bae6fd;
    box-shadow: var(--shadow-md);
}

.umkm-card.active {
    border: 1px solid var(--color-primary);
    background-color: var(--color-primary-bg);
}

/* --- Total Badge --- */
.total-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 10px 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border-light);
    transition: all var(--transition-normal);
}

/* --- Icon Box --- */
.icon-box {
    width: 42px;
    height: 42px;
    background-color: var(--color-primary-bg);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* --- Custom Scrollbar --- */
.sidebar-content::-webkit-scrollbar { width: 6px; }
.sidebar-content::-webkit-scrollbar-track { background: var(--color-scrollbar-track); }
.sidebar-content::-webkit-scrollbar-thumb { background: var(--color-scrollbar-thumb); border-radius: 10px; }
.sidebar-content::-webkit-scrollbar-thumb:hover { background: var(--color-scrollbar-hover); }

/* --- Leaflet Popup Styling --- */
.custom-popup .leaflet-popup-content-wrapper {
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-popup);
    padding: 0;
    overflow: hidden;
}

.custom-popup .leaflet-popup-content {
    margin: 0;
    width: 320px !important;
}

.custom-popup .leaflet-popup-close-button {
    top: 16px !important;
    right: 16px !important;
    color: var(--color-text-lighter) !important;
    font-size: 24px !important;
    z-index: 10;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
}

.popup-header {
    padding: 20px;
    border-bottom: 1px solid var(--color-border-light);
    position: relative;
}

.popup-body {
    padding: 20px;
    max-height: 55vh;
    overflow-y: auto;
}

.popup-body::-webkit-scrollbar { width: 4px; }
.popup-body::-webkit-scrollbar-track { background: transparent; }
.popup-body::-webkit-scrollbar-thumb { background: var(--color-scrollbar-thumb); border-radius: 4px; }

.popup-products::-webkit-scrollbar { width: 4px; }
.popup-products::-webkit-scrollbar-track { background: transparent; }
.popup-products::-webkit-scrollbar-thumb { background: var(--color-scrollbar-thumb); border-radius: 4px; }

/* --- Footer --- */
.site-footer {
    background-color: var(--color-text-dark);
    color: var(--color-text-lighter);
    font-size: 0.8rem;
    padding: 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 500;
    display: none;
}

.site-footer a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.site-footer a:hover {
    color: white;
    text-decoration: underline;
}

/* --- SEO Content Section (visible but below-the-fold) --- */
.seo-content-section {
    display: none;
}

/* --- CLS Prevention: Reserve space for dynamic elements --- */
.icon-box svg {
    width: 20px;
    height: 20px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: absolute;
        z-index: 2000;
        transform: translateX(-100%);
        transition: var(--transition-normal);
        height: 100%;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .custom-popup .leaflet-popup-content {
        width: 290px !important;
    }

    .popup-body {
        padding: 15px;
    }

    .popup-header {
        padding: 15px;
    }

    .icon-box {
        width: 40px;
        height: 40px;
    }

    .icon-box svg {
        width: 20px;
        height: 20px;
    }

    .total-badge {
        top: 10px;
        bottom: auto;
        left: auto;
        right: 10px;
        padding: 8px 16px;
    }

    .leaflet-control-zoom {
        display: none;
    }
}

/* --- Mobile Navigation Dropdown Menu --- */
.mobile-nav-dropdown {
    position: absolute;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    background: var(--color-white);
    z-index: 1500;
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    display: none;
    max-height: calc(100vh - var(--navbar-height));
    overflow-y: auto;
}

.mobile-nav-dropdown.show {
    display: block;
    animation: slideDownMenu 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--color-text-dark);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
}

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

.mobile-nav-link i {
    font-size: 1.2rem;
    color: var(--color-text-light);
}

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

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

/* --- Print Styles --- */
@media print {
    .sidebar,
    .navbar-custom,
    .total-badge,
    .site-footer,
    .mobile-nav-dropdown {
        display: none !important;
    }

    .map-container {
        width: 100%;
    }

    body {
        overflow: visible;
    }
}
