/* ==========================================
   Balik Kampung Checklist - Premium Raya Theme
   ========================================== */

:root {
    --bg-primary: #0a0f1c;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.8);
    --glass-border: rgba(255, 255, 255, 0.06);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-gold: #f59e0b;
    --accent-gold-light: #fbbf24;
    --accent-emerald: #10b981;
    --accent-emerald-dark: #059669;
    --accent-purple: #8b5cf6;
    --accent-rose: #f43f5e;
    --gradient-raya: linear-gradient(135deg, #f59e0b 0%, #d97706 50%, #b45309 100%);
    --gradient-hero: linear-gradient(135deg, #1e1b4b 0%, #0f172a 50%, #1a1a2e 100%);
    --gradient-progress: linear-gradient(90deg, #f59e0b, #10b981);
    --shadow-glow: 0 0 40px rgba(245, 158, 11, 0.15);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ==========================================
   Background Decoration
   ========================================== */
.bg-decoration {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.ketupat {
    position: absolute;
    font-size: 2.5rem;
    opacity: 0.12;
    animation: float 8s ease-in-out infinite;
}

.ketupat-1 { top: 8%; left: 5%; animation-delay: 0s; }
.ketupat-2 { top: 20%; right: 8%; animation-delay: 2s; font-size: 1.8rem; }
.ketupat-3 { bottom: 30%; left: 10%; animation-delay: 4s; font-size: 3rem; }
.ketupat-4 { bottom: 15%; right: 5%; animation-delay: 6s; font-size: 2rem; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(5deg); }
    50% { transform: translateY(-10px) rotate(-3deg); }
    75% { transform: translateY(-25px) rotate(3deg); }
}

/* ==========================================
   Container
   ========================================== */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    position: relative;
    z-index: 1;
}

/* ==========================================
   Header
   ========================================== */
.header {
    position: relative;
    text-align: center;
    padding: 40px 24px 28px;
    margin-bottom: 16px;
    background: var(--gradient-hero);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.header-glow {
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.2) 0%, transparent 70%);
    pointer-events: none;
}

.title {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fbbf24, #f59e0b, #d97706);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

/* Progress Section */
.progress-section {
    position: relative;
    z-index: 1;
    margin-bottom: 20px;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-percent {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-gold-light);
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient-progress);
    border-radius: 100px;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Search */
.search-wrapper {
    position: relative;
    z-index: 1;
}

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

.search-input {
    width: 100%;
    padding: 12px 40px 12px 42px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all var(--transition-fast);
}

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

.search-input:focus {
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.search-clear.visible {
    opacity: 1;
}

.search-clear:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

/* ==========================================
   Controls
   ========================================== */
.controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.btn {
    flex: 1;
    min-width: 100px;
    padding: 10px 14px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
    text-align: center;
    white-space: nowrap;
}

.btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-check-all:hover { border-color: rgba(16, 185, 129, 0.4); }
.btn-uncheck-all:hover { border-color: rgba(244, 63, 94, 0.4); }
.btn-reset:hover { border-color: rgba(139, 92, 246, 0.4); }

/* ==========================================
   Category
   ========================================== */
.category {
    margin-bottom: 12px;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    backdrop-filter: blur(12px);
    transition: all var(--transition-smooth);
}

.category:hover {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-card);
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast);
}

.category-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.category-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.category-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.category-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-progress {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 3px 10px;
    border-radius: 100px;
    letter-spacing: 0.02em;
}

.category-progress.complete {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
}

.category-chevron {
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: transform var(--transition-smooth);
}

.category.collapsed .category-chevron {
    transform: rotate(-90deg);
}

.category-items {
    padding: 0 12px 12px;
    display: grid;
    gap: 2px;
    max-height: 2000px;
    overflow: hidden;
    transition: max-height var(--transition-smooth), padding var(--transition-smooth), opacity var(--transition-smooth);
    opacity: 1;
}

.category.collapsed .category-items {
    max-height: 0;
    padding: 0 12px;
    opacity: 0;
}

/* ==========================================
   Checklist Item
   ========================================== */
.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.checklist-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.checklist-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkmark {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
    position: relative;
}

.checkmark::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid transparent;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin-top: -2px;
}

.checklist-item input:checked ~ .checkmark {
    background: var(--gradient-raya);
    border-color: var(--accent-gold);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.checklist-item input:checked ~ .checkmark::after {
    border-color: white;
    transform: rotate(45deg) scale(1);
}

.item-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    font-weight: 400;
}

.checklist-item input:checked ~ .item-text {
    color: var(--text-muted);
    text-decoration: line-through;
    text-decoration-color: rgba(100, 116, 139, 0.5);
}

.checklist-item.hidden {
    display: none;
}

/* ==========================================
   Category hidden when all items filtered
   ========================================== */
.category.hidden-by-search {
    display: none;
}

/* ==========================================
   Footer
   ========================================== */
.footer {
    text-align: center;
    padding: 32px 20px;
    margin-top: 24px;
}

.footer p {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.footer-sub {
    font-size: 0.85rem !important;
    font-weight: 400 !important;
    -webkit-text-fill-color: var(--text-muted) !important;
    background: none !important;
}

/* ==========================================
   Confetti overlay
   ========================================== */
.confetti-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
    animation: confetti-fall 3s ease-in forwards;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(-20px) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* ==========================================
   Toast notification
   ========================================== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(16px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
}

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

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 480px) {
    .container {
        padding: 12px 10px 32px;
    }

    .header {
        padding: 28px 18px 22px;
    }

    .title {
        font-size: 1.6rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .controls {
        gap: 6px;
    }

    .btn {
        padding: 9px 10px;
        font-size: 0.75rem;
    }

    .category-header {
        padding: 14px 16px;
    }

    .category-title {
        font-size: 0.95rem;
    }

    .checklist-item {
        padding: 10px 12px;
    }

    .item-text {
        font-size: 0.85rem;
    }
}

@media (min-width: 768px) {
    .container {
        padding: 32px 20px 60px;
    }

    .title {
        font-size: 2.4rem;
    }
}

/* ==========================================
   Scrollbar
   ========================================== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}
