:root {
    --primary: #059669;
    --primary-dark: #064e3b;
    --secondary: #2563eb;
    --bg-gradient: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 100%);
    --text-main: #1f2937;
    --text-sec: #6b7280;
    --danger: #ef4444;
    --white: #ffffff;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; outline: none; }

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    padding-bottom: 120px;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* --- Header --- */
header {
    background: linear-gradient(120deg, #064e3b, #059669);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 50;
    height: 70px;
}

.header-left { display: flex; align-items: center; flex: 1; }

.btn-back {
    background: rgba(255,255,255,0.2); border: none; color: white;
    padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 0.9rem; display: none; margin-right: 10px;
}

.header-title { margin: 0; font-size: 1.2rem; font-weight: 700; line-height: 1.2; }
.header-sub { font-size: 0.75rem; opacity: 0.9; display: block; }

/* --- AUTH BUTTON --- */
.auth-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.4);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    z-index: 60;
    position: relative;
}

@keyframes popIn {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    70% { transform: scale(1.2) rotate(10deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.auth-btn.animate-in {
    animation: popIn 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
}

.auth-btn:hover {
    background: rgba(255,255,255,0.4);
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 0 15px rgba(255,255,255,0.6);
}

.auth-btn:active { transform: scale(0.9); }
.auth-btn.is-logout {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(255, 200, 200, 0.6);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

/* --- View Containers --- */
.view-section { display: none; padding: 20px; animation: fadeIn 0.3s ease; }
.view-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- HOME: Menu Cards --- */
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.menu-card {
    background: white; border-radius: 20px; padding: 30px 20px;
    text-align: center; box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; border: 2px solid transparent;
}
.menu-card:active { transform: scale(0.97); }
.card-muzakki { border-bottom: 6px solid var(--primary); }
.card-mustahik { border-bottom: 6px solid var(--secondary); }
.menu-icon { width: 50px; height: 50px; margin: 0 auto 15px; padding: 12px; border-radius: 50%; color: white; }
.icon-muz { background: var(--primary); }
.icon-mus { background: var(--secondary); }
.menu-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 5px; }
.menu-desc { font-size: 0.8rem; color: var(--text-sec); }

/* --- SLIDESHOW --- */
.slideshow-container {
    margin-top: 30px; position: relative; max-width: 100%; height: 200px;
    overflow: hidden; border-radius: 20px; box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
.slide { display: none; width: 100%; height: 100%; }
.slide img {
    width: 100%; height: 100%; object-fit: cover; cursor: pointer; transition: transform 0.3s;
}
.slide img:hover { transform: scale(1.05); }
.slide-caption {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: rgba(0, 0, 0, 0.5); color: #fff; padding: 10px; text-align: center; font-size: 0.9rem;
}
.dots-container { text-align: center; margin-top: 10px; }
.dot {
    height: 10px; width: 10px; margin: 0 5px; background-color: #bbb; border-radius: 50%;
    display: inline-block; transition: background-color 0.6s ease; cursor: pointer;
}
.active-dot { background-color: var(--primary); }

/* --- LIGHTBOX --- */
.lightbox-modal {
    display: none; position: fixed; z-index: 10000; left: 0; top: 0;
    width: 100%; height: 100%; background-color: rgba(0,0,0,0.95);
    justify-content: center; align-items: center; flex-direction: column;
}
.lightbox-content { max-width: 90%; max-height: 80%; border-radius: 8px; }
.close-lightbox {
    position: absolute; top: 20px; right: 30px; color: #f1f1f1; font-size: 40px;
    font-weight: bold; cursor: pointer; transition: 0.3s;
}
.close-lightbox:hover { color: var(--primary); }

/* --- TABLE VIEWS --- */
.stats-row { display: flex; gap: 10px; margin-bottom: 20px; overflow-x: auto; }
.stat-badge {
    background: white; padding: 10px 15px; border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); min-width: 120px; flex: 1;
}
.stat-label { font-size: 0.7rem; color: var(--text-sec); text-transform: uppercase; }
.stat-val { font-size: 1rem; font-weight: 700; color: var(--text-main); margin-top: 5px; }
.text-green { color: var(--primary); }
.text-blue { color: var(--secondary); }
.table-container {
    overflow-x: auto; background: white; border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02); margin-top: 15px;
}
table { width: 100%; border-collapse: collapse; min-width: 400px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #f3f4f6; font-size: 0.85rem; vertical-align: middle; }
th { background: #f9fafb; color: var(--text-sec); font-weight: 600; white-space: nowrap; }
.badge { padding: 4px 8px; border-radius: 6px; font-size: 0.7rem; font-weight: 600; }
.bg-rice { background: #fffbeb; color: #d97706; }
.bg-money { background: #ecfdf5; color: #047857; }

/* --- FAB --- */
.fab {
    position: fixed; bottom: 50px; right: 24px; width: 56px; height: 56px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2); border: none; cursor: pointer;
    transition: transform 0.2s; z-index: 1050;
}
.fab:active { transform: scale(0.9); }
.fab-muzakki { background: var(--primary); color: white; display: none; }
.fab-mustahik { background: var(--secondary); color: white; display: none; }

/* --- Modals --- */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(5px);
    display: none; align-items: flex-end; justify-content: center; z-index: 2000;
}
.modal.active { display: flex; }
.modal-content {
    background: white; width: 100%; max-width: 400px;
    border-top-left-radius: 24px; border-top-right-radius: 24px;
    padding: 25px; transform: translateY(100%); transition: transform 0.3s;
    animation: slideUp 0.3s forwards;
}
@keyframes slideUp { to { transform: translateY(0); } }

.form-group { margin-bottom: 15px; }
label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 5px; color: var(--text-main); }
input, select {
    width: 100%; padding: 12px; border: 1px solid #e5e7eb; border-radius: 10px;
    font-size: 1rem; background: #f9fafb;
}
.type-toggle { display: flex; background: #f3f4f6; padding: 4px; border-radius: 10px; margin-bottom: 15px; }
.type-opt { flex: 1; text-align: center; padding: 8px; border-radius: 8px; font-size: 0.9rem; cursor: pointer; color: #6b7280; }
.type-opt.active { background: white; font-weight: 600; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.type-opt.active.muz { color: var(--primary); }
.type-opt.active.mus { color: var(--secondary); }

.btn-block { width: 100%; padding: 14px; border: none; border-radius: 12px; font-weight: 700; cursor: pointer; font-size: 1rem; color: white; }
.btn-muz { background: var(--primary); }
.btn-mus { background: var(--secondary); }
.btn-cancel { background: #f3f4f6; color: #4b5563; margin-top: 10px; }
.delete-btn { background: #fee2e2; color: #ef4444; border: none; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 0.8rem; }
.empty-msg { text-align: center; padding: 30px; color: var(--text-sec); font-size: 0.9rem; }

.btn-excel { width: 100%; padding: 12px; border: none; border-radius: 12px; font-weight: 600; margin-bottom: 15px; cursor: pointer; color: white; background: #10b981; display: none; align-items: center; justify-content: center; gap: 8px;}

svg { width: 20px; height: 20px; fill: currentColor; }
.big-icon { width: 24px; height: 24px; }

/* --- Footer Marquee --- */
.footer-marquee {
    position: fixed; bottom: 0; left: 0; width: 100%; height: 40px;
    background-color: var(--primary-dark); color: #fff; display: flex; align-items: center;
    z-index: 1000; overflow: hidden; white-space: nowrap; box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}
.marquee-content {
    display: inline-block; padding-left: 100%;
    animation: marquee 45s linear infinite; font-size: 0.9rem; font-weight: 500;
}
@keyframes marquee {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}

/* --- Efek Salju --- */
.snowflake {
    position: fixed; top: -10px; color: #ffffff; font-size: 1.5em;
    font-family: Arial; text-shadow: 0 0 1px #000; z-index: 9999; pointer-events: none;
    animation-name: fall; animation-timing-function: linear; animation-iteration-count: infinite;
}
@keyframes fall {
    0% { transform: translateY(-10vh); opacity: 0.8; }
    100% { transform: translateY(110vh); opacity: 0.3; }
}