/* ========================================== */
/* PETRACHORD Jemaat - Dark Theme Stylesheet  */
/* ========================================== */

:root {
    --bg-primary: #0d0d1a;
    --bg-secondary: #151528;
    --bg-card: #1a1a30;
    --bg-card-hover: #1f1f38;
    --bg-input: #1e1e35;
    --text-primary: #e8e8f0;
    --text-secondary: #a8a8c0;
    --text-muted: #707088;
    --accent: #5eb8f7;
    --accent-hover: #7cc8ff;
    --accent-dim: #3a6fa0;
    --success: #4caf84;
    --danger: #f06464;
    --warning: #f0b864;
    --border: #2a2a40;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --transition: 0.15s ease;
}

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

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

/* ============ LAYOUT ============ */
.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 12px;
}

/* ============ HEADER ============ */
.app-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.app-logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.app-logo span {
    color: var(--accent);
}

/* ============ NAVIGATION ============ */
.nav-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 8px 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
    flex-shrink: 0;
    padding: 9px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
    user-select: none;
}

.nav-tab:hover, .nav-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ============ STATS CARDS ============ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    padding: 16px 0;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    text-align: center;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============ PAGE SECTION ============ */
.page-section {
    display: none;
    padding: 8px 0 40px;
}

.page-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius);
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    font-family: var(--font);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
    border-radius: 6px;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 0.72rem;
    border-radius: 5px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.1rem;
}

.btn-full {
    width: 100%;
}

/* ============ SEARCH BAR ============ */
.search-bar {
    flex: 1;
    min-width: 180px;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: var(--font);
    transition: border-color var(--transition);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(94,184,247,0.15);
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

/* ============ TABLES ============ */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 600px;
}

th {
    background: var(--bg-secondary);
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 11px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--text-primary);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255,255,255,0.02);
}

tr.clickable {
    cursor: pointer;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-active {
    background: rgba(76,175,132,0.2);
    color: var(--success);
}

.badge-inactive {
    background: rgba(240,100,100,0.2);
    color: var(--danger);
}

.badge-pelayan {
    background: rgba(94,184,247,0.2);
    color: var(--accent);
}

/* ============ MODAL ============ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 12px 20px 20px;
}

/* ============ FORMS ============ */
.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font);
    transition: border-color var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(94,184,247,0.15);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a8a8c0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Checkbox pills untuk role pelayan */
.role-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.role-pill {
    padding: 7px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
}

.role-pill.selected {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: #fff;
}

/* ============ KAS LEDGER ============ */
.ledger-summary {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.ledger-box {
    flex: 1;
    min-width: 120px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    text-align: center;
}

.ledger-box .amount {
    font-size: 1.6rem;
    font-weight: 700;
}

.ledger-box .amount.masuk { color: var(--success); }
.ledger-box .amount.keluar { color: var(--danger); }
.ledger-box .amount.saldo { color: var(--accent); }

.kas-row-masuk { color: var(--success); font-weight: 600; }
.kas-row-keluar { color: var(--danger); font-weight: 600; }

/* ============ JADWAL CARDS (Mobile Friendly) ============ */
.jadwal-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.jadwal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    cursor: pointer;
    transition: all var(--transition);
}

.jadwal-card:hover {
    border-color: var(--accent-dim);
    background: var(--bg-card-hover);
}

.jadwal-card-date {
    font-weight: 700;
    color: var(--accent);
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.jadwal-card-type {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.jadwal-card-roles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    font-size: 0.8rem;
}

.jadwal-card-roles .role-label {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.jadwal-card-roles .role-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* ============ TOAST ============ */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--success);
    color: #fff;
    padding: 12px 24px;
    border-radius: 24px;
    font-weight: 600;
    font-size: 0.85rem;
    z-index: 300;
    transition: transform 0.3s ease;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    background: var(--danger);
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ============ MONTH PICKER ============ */
.month-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.month-nav .btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    padding: 0;
    font-size: 1rem;
}

.month-label {
    font-weight: 700;
    font-size: 0.95rem;
    min-width: 140px;
    text-align: center;
}

/* ============ PRINT STYLES ============ */
@media print {
    body {
        background: #fff;
        color: #000;
    }
    .app-header, .nav-tabs, .btn, .search-bar, .modal-overlay, .stats-row {
        display: none !important;
    }
    .table-wrap {
        border: 1px solid #ccc;
        background: #fff;
    }
    th { background: #eee; color: #000; }
    td, th { border-color: #ddd; color: #000; }
}

/* ============ MOBILE OPTIMIZATIONS ============ */
@media (max-width: 600px) {
    .btn {
        padding: 10px 14px;
        font-size: 0.82rem;
    }
    .section-header {
        flex-direction: column;
        align-items: stretch;
    }
    .search-bar {
        min-width: 100%;
    }
    .ledger-summary {
        flex-direction: column;
    }
    .jadwal-card-roles {
        grid-template-columns: 1fr;
    }
    .modal {
        max-width: 100%;
        margin: 8px;
        border-radius: var(--radius-lg);
    }
}
