/* ===========================
   MOBILE BOTTOM NAVIGATION
   =========================== */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.95));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(59, 130, 246, 0.1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    display: none;
    padding: 0.5rem 0.25rem calc(env(safe-area-inset-bottom) + 0.5rem);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.25rem;
    border: none;
    background: transparent;
    color: #6b7280;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.mobile-nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 80%;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 0 0 3px 3px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-nav-item.active::before {
    transform: translateX(-50%) scaleX(1);
}

.mobile-nav-item:active {
    transform: scale(0.95);
}

.nav-icon {
    width: 24px;
    height: 24px;
    stroke-width: 2;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 0.25rem;
}

.mobile-nav-item.active .nav-icon {
    stroke-width: 2.5;
    color: #3b82f6;
    transform: translateY(-2px);
    filter: drop-shadow(0 2px 4px rgba(59, 130, 246, 0.3));
}

.nav-label {
    font-size: 0.65rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.3px;
}

.mobile-nav-item.active .nav-label {
    color: #3b82f6;
    font-weight: 700;
    font-size: 0.7rem;
}

/* ===========================
   RESPONSIVE MEDIA QUERIES
   =========================== */
@media (max-width: 640px) {
    .mobile-bottom-nav {
        display: flex;
    }
    
    body {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }
    
    .desktop-tabs {
        display: none !important;
    }
    
    #main-content-wrapper {
        padding-bottom: 2rem;
    }
}

@media (min-width: 641px) {
    .mobile-bottom-nav {
        display: none !important;
    }
    
    .sticky-desktop {
        position: static !important;
    }
}

/* Small mobile optimization */
@media (max-width: 380px) {
    .nav-label {
        font-size: 0.6rem;
    }
    
    .nav-icon {
        width: 20px;
        height: 20px;
    }
    
    .mobile-nav-item {
        padding: 0.4rem 0.15rem;
    }
}

/* ===========================
   TAB SYSTEM
   =========================== */
.tab-button.active {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.desktop-tabs {
    background: linear-gradient(to bottom, #f3f4f6, #e5e7eb);
    border-radius: 0.75rem;
    padding: 0.375rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.tab-button {
    transition: all 0.2s ease;
    border-radius: 0.5rem;
}

.tab-button:hover {
    background-color: #d1d5db;
    transform: translateY(-1px);
}

/* ===========================
   GENERAL STYLES
   =========================== */
button:disabled { opacity: 0.5; cursor: not-allowed; }
#mapid { height: 400px; width: 100%; border-radius: 0.5rem; z-index: 0; }

/* ===========================
   TABLE STICKY COLUMN
   =========================== */
.ranking-table th { cursor: pointer; user-select: none; }
.ranking-table th.sort-asc::after { content: ' \25B2'; }
.ranking-table th.sort-desc::after { content: ' \25BC'; }

/* Sticky column NO */
.ranking-table .sticky-col-no {
    position: sticky;
    left: 0;
    z-index: 11;
    background-color: white;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.08);
    min-width: 60px;
    width: 60px;
    max-width: 60px;
}

.ranking-table thead .sticky-col-no {
    z-index: 21;
    background-color: #f9fafb;
}

.ranking-table tbody tr:hover .sticky-col-no {
    background-color: #eff6ff;
}

/* Sticky column SEKOLAH */
.ranking-table .sticky-col-school {
    position: sticky;
    left: 60px;
    z-index: 10;
    background-color: white;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.08);
    min-width: 200px;
    width: 200px;
    max-width: 200px;
    white-space: normal;
    word-wrap: break-word;
}

.ranking-table thead .sticky-col-school {
    z-index: 20;
    background-color: #f9fafb;
}

.ranking-table tbody tr:hover .sticky-col-school {
    background-color: #eff6ff;
}

/* Ensure table has proper layout */
.ranking-table {
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
}

/* Table wrapper for proper scrolling */
.overflow-x-auto {
    position: relative;
}

/* Prevent text overflow in sticky columns */
.sticky-col-no,
.sticky-col-school {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sticky-col-school span {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sticky-col-school .text-xs {
    display: block;
    font-size: 0.75rem;
}

/* Remove old unused styles */
.ranking-table .sticky-col {
    position: sticky;
    left: 0;
    z-index: 10;
    background-color: white;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
}

.ranking-table thead .sticky-col {
    z-index: 20;
    background-color: #f9fafb;
}

.ranking-table tbody tr:hover .sticky-col {
    background-color: #eff6ff;
}

/* ===========================
   PDF STYLES
   =========================== */
.pdf-page { font-family: Arial, sans-serif; width: 210mm; min-height: 297mm; padding: 15mm; background-color: white; color: #333; box-sizing: border-box; border: 1px solid #eee; margin: 10px auto; page-break-after: always; }
.pdf-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #4a90e2; padding-bottom: 10px; }
.pdf-header img { height: 60px; }
.pdf-header h1 { font-size: 18px; color: #4a90e2; font-weight: bold; text-align: right; }
.pdf-section { margin-top: 15px; }
.pdf-section h2 { font-size: 16px; font-weight: bold; color: #333; border-bottom: 1px solid #ccc; padding-bottom: 5px; margin-bottom: 8px; }
.pdf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pdf-grid-item { background-color: #f9f9f9; border-radius: 5px; padding: 10px; }
.pdf-grid-item strong { display: block; font-size: 12px; color: #555; margin-bottom: 2px; }
.pdf-grid-item span { font-size: 14px; color: #000; }
.pdf-analysis-item { border-radius: 5px; margin-bottom: 8px; padding: 10px; }
.pdf-analysis-item h3 { font-size: 13px; font-weight: bold; margin-bottom: 5px; }
.pdf-analysis-item p { font-size: 12px; margin: 2px 0; }
.pdf-analysis-good { background-color: #e6f7ec; border-left: 4px solid #52c41a; }
.pdf-analysis-warn { background-color: #fffbe6; border-left: 4px solid #faad14; }
.pdf-analysis-bad { background-color: #fff1f0; border-left: 4px solid #f5222d; }
.pdf-footer { position: absolute; bottom: 10mm; left: 15mm; right: 15mm; text-align: center; font-size: 10px; color: #888; border-top: 1px solid #eee; padding-top: 5px; }
#pdf-render-template { position: fixed; left: -3000px; top: 0; z-index: -100; max-height: none; }
.pdf-break { height: 0; margin-top: 297mm; page-break-after: always; box-sizing: content-box; }
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.75); display: none; justify-content: center; align-items: center; z-index: 2000; }
.modal-content { background-color: white; padding: 20px; border-radius: 10px; max-width: 95%; width: 1200px; max-height: 90vh; overflow-y: auto; position: relative; }
.modal-header { position: sticky; top: 0; background-color: white; z-index: 2010; padding-bottom: 10px; border-bottom: 1px solid #eee; }