/* =========================================================
   SIDARKA — REKAPITULASI QUICK COUNT (Minimalis Compact)
   Tema: Dominan Biru Muda & Biru Dongker (Navy/Blue)
   File: assets/css/rekap.css
   ========================================================= */

:root {
    --primary-color: #0284c7;
    --primary-hover: #0369a1;
    --bg-main: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #cbd5e1;
}

.rekap-page {
    width: 100%;
    max-width: 1440px !important;
    margin: 0 auto;
    padding: 16px 20px 36px !important;
    flex: 1 0 auto;
    color: var(--text-main);
    background-color: var(--bg-main);
}
.rekap-page * { box-sizing: border-box; }

/* Header & Filter Section */
.rekap-page-heading {
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    gap: 12px; 
    margin-bottom: 14px;
    background: var(--card-bg);
    padding: 16px 20px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.03);
    border: 1px solid var(--border-color);
}
.rekap-heading-copy { min-width: 0; }
.rekap-eyebrow {
    display: inline-flex; 
    align-items: center; 
    gap: 6px;
    color: var(--primary-color); 
    font-size: .72rem; 
    font-weight: 800;
    letter-spacing: .5px; 
    text-transform: uppercase; 
    margin-bottom: 4px;
}
.rekap-page-heading h1 {
    display: flex; 
    align-items: center; 
    gap: 8px; 
    margin: 0;
    color: var(--text-main); 
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    line-height: 1.2; 
    font-weight: 850;
}
.rekap-page-heading h1 i { color: var(--primary-color); font-size: .9em; }
.rekap-page-heading p { color: var(--text-muted); margin: 4px 0 0; font-size: .84rem; }

.rekap-refresh-button, .rekap-table-refresh {
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    gap: 6px;
    flex-shrink: 0; 
    padding: 10px 16px; 
    border: 0; 
    border-radius: 10px;
    background: var(--primary-color); 
    color: #fff; 
    font-size: .82rem; 
    font-weight: 750;
    cursor: pointer; 
    transition: background .2s, transform 0.1s;
}
.rekap-refresh-button:hover, .rekap-table-refresh:hover { background: var(--primary-hover); }
.rekap-refresh-button:active { transform: scale(0.97); }

/* Notice Banner (Diubah menjadi tema Merah Peringatan / Warning) */
.rekap-notice {
    display: flex; 
    align-items: flex-start; 
    gap: 12px; 
    padding: 12px 16px;
    margin-bottom: 16px; 
    border: 1px solid #fecdd3; 
    border-radius: 12px;
    background: linear-gradient(120deg, #fff1f2, #ffe4e6);
    box-shadow: 0 2px 6px rgba(225, 29, 72, 0.04);
}
.rekap-notice-icon {
    display: flex; 
    align-items: center; 
    justify-content: center; 
    flex: 0 0 32px;
    width: 32px; 
    height: 32px; 
    border-radius: 8px;
    color: #e11d48; 
    background: #fecdd3; 
    font-size: 1rem;
}
.rekap-notice h2 { margin: 0 0 2px; color: #9f1239; font-size: .88rem; font-weight: 800; }
.rekap-notice p { margin: 0; color: #881337; font-size: .78rem; line-height: 1.45; }

/* Kandidat Quick Card Layout */
.rekap-candidate-grid {
    display: grid; 
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px; 
    margin-bottom: 16px;
}
.rekap-candidate-card {
    position: relative; 
    display: flex; 
    align-items: center; 
    gap: 14px;
    overflow: hidden; 
    min-width: 0; 
    padding: 12px 16px;
    border: 1px solid transparent; 
    border-radius: 14px;
    box-shadow: 0 3px 12px rgba(2, 132, 199, 0.05);
    background: var(--card-bg);
    transition: transform 0.2s;
}
.rekap-candidate-card:hover { transform: translateY(-1px); }
.candidate-orange { background: linear-gradient(135deg, #f0f9ff, #e0f2fe); border-color: #bae6fd; }
.candidate-green { background: linear-gradient(135deg, #f8fafc, #eff6ff); border-color: #bfdbfe; }

.candidate-visual {
    position: relative; 
    flex-shrink: 0; 
    width: 52px; 
    height: 52px;
    border-radius: 50%; 
    overflow: hidden; 
    background: #fff;
    border: 2px solid #fff; 
    box-shadow: 0 3px 8px rgba(30, 58, 138, 0.15);
}
.candidate-visual img {
    display: block; 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    object-position: center;
}
.candidate-card-top, .candidate-progress { display: none; }

.candidate-info-wrapper {
    flex: 1; 
    min-width: 0; 
    display: flex; 
    flex-direction: column; 
    justify-content: center;
}
.candidate-header-row {
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    gap: 8px; 
    margin-bottom: 4px;
}
.rekap-candidate-card h2 {
    margin: 0; 
    color: var(--text-main); 
    font-size: .88rem; 
    font-weight: 800;
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis;
}
.candidate-number {
    display: inline-flex; 
    align-items: center; 
    padding: 2px 8px; 
    border-radius: 999px;
    font-size: .65rem; 
    font-weight: 800; 
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.candidate-accent-orange { color: #fff; background-color: #0284c7; }
.candidate-accent-green { color: #fff; background-color: #1e3a8a; }

.candidate-body-row {
    display: flex; 
    align-items: baseline; 
    justify-content: space-between; 
    gap: 6px; 
    margin-bottom: 6px;
}
.candidate-votes { display: flex; align-items: baseline; gap: 4px; }
.candidate-votes strong { color: var(--text-main); font-size: 1.05rem; font-weight: 900; line-height: 1; }
.candidate-votes span { color: var(--text-muted); font-size: .7rem; font-weight: 700; }

.candidate-percent { color: var(--text-main); font-size: 1.05rem; font-weight: 900; line-height: 1; }
.candidate-percent small { font-size: .6em; margin-left: 1px; }

.candidate-progress-track { height: 6px; overflow: hidden; border-radius: 999px; background: rgba(30, 58, 138, 0.08); width: 100%; }
.candidate-progress-track span { display: block; height: 100%; border-radius: inherit; }
.candidate-footnote { display: none; }

.rekap-empty-state, .table-empty { padding: 20px 12px; color: var(--text-muted); text-align: center; background: #fff; font-size: .85rem; }

/* Ringkasan Statistik Grid */
.rekap-summary-grid { 
    display: grid; 
    grid-template-columns: repeat(4, minmax(0,1fr)); 
    gap: 12px; 
    margin-bottom: 14px; 
}
.rekap-summary-card {
    display: flex; 
    align-items: center; 
    gap: 12px; 
    min-width: 0; 
    padding: 12px 14px;
    border: 1px solid transparent; 
    border-radius: 14px; 
    box-shadow: 0 3px 10px rgba(2, 132, 199, 0.03);
    background: var(--card-bg);
}
.summary-orange { background: #f0f9ff; border-color: #bae6fd; }
.summary-green { background: #f8fafc; border-color: #cbd5e1; }
.summary-red { background: #fff1f2; border-color: #fecdd3; }
.summary-darkgreen { background: #eff6ff; border-color: #bfdbfe; }
.summary-icon {
    display: flex; 
    align-items: center; 
    justify-content: center; 
    flex: 0 0 38px;
    width: 38px; 
    height: 38px; 
    border-radius: 10px; 
    background: #fff; 
    font-size: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.summary-orange .summary-icon { color: #0284c7; }
.summary-green .summary-icon, .summary-darkgreen .summary-icon { color: #1e3a8a; }
.summary-red .summary-icon { color: #e11d48; }
.rekap-summary-card > div { display: flex; flex-direction: column; min-width: 0; }
.summary-label { color: #64748b; font-size: .7rem; font-weight: 750; line-height: 1.2; }
.rekap-summary-card strong { margin-top: 2px; color: var(--text-main); font-size: clamp(1.1rem, 1.8vw, 1.4rem); line-height: 1.2; font-weight: 900; }
.rekap-summary-card strong small { color: var(--text-muted); font-size: .55em; font-weight: 750; }
.rekap-summary-card > div > small { margin-top: 2px; color: #64748b; font-size: .65rem; }

/* Info Waktu */
.rekap-time-card {
    display: grid; 
    grid-template-columns: repeat(2, minmax(0,1fr)); 
    gap: 12px;
    padding: 12px 16px; 
    margin-bottom: 16px; 
    background: var(--card-bg);
    border: 1px solid var(--border-color); 
    border-radius: 14px; 
    box-shadow: 0 3px 10px rgba(2, 132, 199, 0.03);
}
.rekap-time-item { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rekap-time-item + .rekap-time-item { border-left: 1px solid var(--border-color); padding-left: 16px; }
.rekap-time-icon { display: flex; align-items: center; justify-content: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px; font-size: .95rem; }
.rekap-time-icon.orange { color: #0284c7; background: #e0f2fe; }
.rekap-time-icon.green { color: #1e3a8a; background: #eff6ff; }
.rekap-time-item div { display: flex; flex-direction: column; min-width: 0; }
.rekap-time-item small { color: var(--text-muted); font-size: .68rem; }
.rekap-time-item strong { color: #0f172a; font-size: .8rem; font-weight: 800; }

/* Tabel Detail TPS */
.rekap-table-panel { 
    overflow: hidden; 
    margin-bottom: 24px; 
    background: var(--card-bg); 
    border: 1px solid var(--border-color); 
    border-radius: 16px; 
    box-shadow: 0 4px 16px rgba(2, 132, 199, 0.04); 
}
.rekap-table-heading {
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    gap: 12px;
    padding: 16px 20px; 
    border-bottom: 1px solid #e2e8f0;
}
.rekap-table-heading .rekap-eyebrow { margin-bottom: 3px; }
.rekap-table-heading h2 { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text-main); font-size: 1rem; font-weight: 850; }
.rekap-table-heading h2 i { color: var(--primary-color); }
.rekap-table-heading p { margin: 3px 0 0; color: var(--text-muted); font-size: .78rem; }
.rekap-table-refresh { padding: 8px 14px; background: #fff; color: var(--primary-color); border: 1px solid #bae6fd; box-shadow: none; font-size: .78rem; }
.rekap-table-refresh:hover { color: #fff; background: var(--primary-color); }

.desktop-table-view { display: block; width: 100%; overflow-x: auto; }
.mobile-card-view { display: none; }
.rekap-table { width: 100%; border-collapse: separate; border-spacing: 0; color: #0f172a; font-size: .82rem; }
.rekap-table thead th {
    padding: 12px 14px; 
    color: #475569; 
    background: #f8fafc; 
    border-bottom: 2px solid #cbd5e1;
    text-align: center; 
    white-space: nowrap; 
    font-size: .72rem; 
    font-weight: 800; 
    text-transform: uppercase;
    letter-spacing: .3px;
}
.rekap-table tbody td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; text-align: center; white-space: nowrap; }
.rekap-table tbody tr:last-child td { border-bottom: 0; }
.rekap-table tbody tr:hover td { background: #f8fafc; }
.rekap-table tbody td:first-child { color: var(--primary-color); font-weight: 800; }
.rekap-status { display: inline-flex; align-items: center; justify-content: center; padding: 4px 10px; border-radius: 999px; font-size: .68rem; font-weight: 800; }
.status-done { color: #1e3a8a; background: #eff6ff; border: 1px solid #bfdbfe; }
.status-process { color: #b45309; background: #fef3c7; border: 1px solid #fde68a; }
.status-pending { color: #9f1239; background: #fff1f2; border: 1px solid #fecdd3; }

/* Mobile TPS Cards Styling */
.tps-mobile-card { 
    padding: 14px; 
    margin: 10px; 
    border: 1px solid var(--border-color); 
    border-radius: 12px; 
    background: #fff; 
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.04); 
}
.tps-mobile-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid #f1f5f9; }
.tps-mobile-top h3 { margin: 0; color: var(--primary-color); font-size: .92rem; font-weight: 850; }
.tps-mobile-meta { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; color: var(--text-muted); font-size: .75rem; }
.tps-mobile-meta strong { color: #0f172a; }
.tps-vote-list { padding: 8px 12px; border-radius: 10px; background: #f8fafc; border: 1px solid #e2e8f0; }
.tps-vote-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 6px 0; color: #475569; font-size: .76rem; }
.tps-vote-row + .tps-vote-row { border-top: 1px dashed #cbd5e1; }
.tps-vote-row strong { color: var(--text-main); font-weight: 800; }
.tps-mobile-invalid { display: flex; justify-content: space-between; gap: 10px; padding-top: 10px; color: var(--text-muted); font-size: .76rem; border-top: 1px solid #f1f5f9; margin-top: 8px; }
.tps-mobile-invalid strong { color: var(--text-main); font-weight: 800; }

/* Floating Refresh Button Mobile */
.mobile-floating-refresh {
    display: none; 
    position: fixed; 
    right: 16px; 
    bottom: 70px; 
    z-index: 1040;
    align-items: center; 
    justify-content: center; 
    width: 46px; 
    height: 46px;
    border: 0; 
    border-radius: 14px; 
    color: #fff; 
    background: var(--primary-color);
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.3); 
    font-size: 1rem; 
    cursor: pointer;
}

/* Responsiveness Rules */
@media (max-width: 1024px) {
    .rekap-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767.98px) {
    .rekap-page { padding: 10px 8px 24px !important; }
    
    .rekap-page-heading { 
        flex-direction: column; 
        align-items: stretch; 
        gap: 10px; 
        margin-bottom: 10px; 
        padding: 12px 14px;
        position: relative; 
        padding-right: 50px; 
    }
    .rekap-heading-copy h1 { font-size: 1.1rem; }
    .rekap-refresh-button span { display: none; }
    .rekap-refresh-button { 
        width: 38px; 
        height: 38px; 
        padding: 0; 
        border-radius: 10px; 
        position: absolute; 
        top: 12px; 
        right: 12px; 
    }
    
    .rekap-notice { padding: 10px 12px; margin-bottom: 10px; border-radius: 10px; }
    .rekap-candidate-grid { grid-template-columns: 1fr; gap: 8px; margin-bottom: 12px; }
    .rekap-candidate-card { padding: 10px 14px; border-radius: 12px; }
    
    .rekap-summary-grid { gap: 8px; margin-bottom: 10px; }
    .rekap-summary-card { gap: 10px; padding: 10px 12px; border-radius: 12px; }
    .summary-icon { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 8px; font-size: .85rem; }
    .rekap-summary-card strong { font-size: 1rem; }
    
    .rekap-time-card { grid-template-columns: 1fr; gap: 8px; padding: 10px 12px; margin-bottom: 12px; border-radius: 12px; }
    .rekap-time-item + .rekap-time-item { padding-top: 8px; border-top: 1px solid var(--border-color); border-left: 0; padding-left: 0; }
    
    .rekap-table-panel { border-radius: 12px; margin-bottom: 16px; }
    .rekap-table-heading { padding: 12px 14px; }
    .rekap-table-heading h2 { font-size: .9rem; }
    
    .desktop-table-view { display: none; }
    .mobile-card-view { display: block; background: #f8fafc; padding-bottom: 6px; }
    .mobile-floating-refresh { display: flex; bottom: calc(65px + env(safe-area-inset-bottom)); right: 12px; }
}

@media (min-width: 768px) {
    .desktop-table-view { display: block; }
    .mobile-card-view { display: none; }
}