/* =========================================================
   HABIT TRACKER MASTER STYLESHEET
   Includes Base, Auth, Admin, and PG Habit Campaign UI
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&family=Bebas+Neue&display=swap');

:root {
    /* Brand Colors */
    --primary-dark: #1a0b2e; /* Brand deep blue */
    --primary-light: #e8e4f2;
    --orange-active: #FDBA74;
    
    /* UI Colors */
    --app-bg: #FFFFFF;
    --card-bg: #FFF1E6; /* Pale peach */
    --white: #FFFFFF;
    --text-main: #1A202C;
    --text-muted: #718096;
    
    /* System Colors */
    --error: #E53E3E;
    --success: #38A169;
}

/* --- 1. Global Reset & Typography --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    background-color: var(--app-bg);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    padding-bottom: 100px; /* Space for the floating button */
}

/* --- 2. Base Components (Forms, Alerts, Containers) --- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.auth-container { max-width: 400px; margin: 5rem auto; padding: 2rem; background: var(--white); border-radius: 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.05); border: 1px solid #e2e8f0; }
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 600; color: var(--text-main); }
.form-group input, .form-group select { width: 100%; padding: 0.8rem; border: 1px solid #cbd5e1; border-radius: 8px; font-family: 'Inter', sans-serif; font-size: 1rem; }
.form-group input:focus { outline: none; border-color: var(--primary-dark); }
.btn-primary { width: 100%; padding: 0.8rem; background: var(--primary-dark); color: white; border: none; border-radius: 8px; font-weight: 700; font-size: 1rem; cursor: pointer; transition: 0.2s; }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: #e2e8f0; color: var(--text-main); padding: 0.5rem 1rem; border-radius: 6px; border: none; cursor: pointer; font-weight: bold; text-decoration: none; display: inline-block; }
.alert { padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; font-weight: 600; }
.alert.error { background: #fee2e2; color: #991b1b; }
.alert.success { background: #dcfce3; color: #166534; }

/* Admin Tables */
.admin-table { width: 100%; border-collapse: collapse; background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.admin-table th, .admin-table td { padding: 1rem; text-align: left; border-bottom: 1px solid #e2e8f0; }
.admin-table th { background: #f8fafc; font-weight: bold; color: var(--text-muted); text-transform: uppercase; font-size: 0.85rem; }
.badge { padding: 0.25rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: bold; }
.badge-success { background: #dcfce3; color: #166534; }
.badge-error { background: #fee2e2; color: #991b1b; }


/* =========================================================
   PG HABIT CAMPAIGN APP UI (Mobile First)
   ========================================================= */

/* --- Top Header (Hamburger, Title, PG Logo) --- */
.app-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.5rem; background: var(--app-bg); position: sticky; top: 0; z-index: 50;
}
.custom-hamburger { display: flex; flex-direction: column; gap: 5px; cursor: pointer; width: 28px; z-index: 1001; }
.custom-hamburger span { height: 3px; background-color: var(--primary-dark); border-radius: 4px; transition: all 0.3s ease; }
.custom-hamburger span:nth-child(1) { width: 100%; }
.custom-hamburger span:nth-child(2) { width: 75%; }
.custom-hamburger span:nth-child(3) { width: 50%; }
.custom-hamburger.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); width: 100%; }
.custom-hamburger.active span:nth-child(2) { opacity: 0; }
.custom-hamburger.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); width: 100%; }
.campaign-title { font-size: 1.2rem; font-weight: 800; color: var(--primary-dark); margin: 0; }
.pg-logo { width: 40px; height: 40px; background: var(--primary-light); color: var(--primary-dark); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; border: 2px solid var(--primary-dark); }

/* --- Greeting Section --- */
.greeting-section { padding: 0 1.5rem 1rem 1.5rem; }
.greeting-section h2 { margin: 0; font-size: 1.6rem; color: var(--text-main); }
.greeting-date { font-size: 1rem; color: var(--text-muted); font-weight: 600; margin-top: 0.25rem; }

/* --- Mini Nav Pills (Tabs) --- */
.mini-nav { display: flex; gap: 0.5rem; padding: 0 1.5rem 1.5rem 1.5rem; overflow-x: auto; scrollbar-width: none; }
.mini-nav::-webkit-scrollbar { display: none; }
.tab-btn { background: transparent; border: none; font-size: 0.95rem; color: var(--text-muted); padding: 0.6rem 1.2rem; border-radius: 999px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: all 0.2s ease; }
.tab-btn.active { background: var(--primary-light); color: var(--primary-dark); }

/* --- Habit Cards --- */
.habit-app-card { background: var(--card-bg); border-radius: 24px; padding: 1.25rem 1.5rem; margin: 0 1.5rem 1.5rem 1.5rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.icon-box { background: #FEEBC8; border-radius: 14px; width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.card-title-group { flex: 1; margin-left: 1rem; }
.card-title-group h4 { margin: 0; font-size: 1.1rem; color: var(--text-main); font-weight: 700; }
.card-title-group p { margin: 0; font-size: 0.85rem; color: var(--text-muted); font-weight: 600; margin-top: 2px; }
.card-title-group span { color: #DD6B20; font-weight: bold; }
.check-btn { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--orange-active); background: transparent; display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; font-size: 1.2rem; cursor: pointer; transition: 0.2s; }
.check-btn.done { background: var(--orange-active); border-color: var(--orange-active); }

/* --- Tab Grids (Weekly, Monthly, Overall) --- */
.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Weekly Layout */
.weekly-grid { display: flex; justify-content: space-between; align-items: center; }
.day-col { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.day-circle { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #FEEBC8; display: flex; align-items: center; justify-content: center; color: transparent; }
.day-col.done .day-circle { border-color: var(--orange-active); background: var(--orange-active); color: white; }

/* Real Calendar Layout */
.calendar-header { text-align: center; font-weight: 800; color: var(--primary-dark); margin-bottom: 0.8rem; font-size: 1rem; text-transform: uppercase; letter-spacing: 1px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-day-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 700; padding-bottom: 5px; }
.cal-box { aspect-ratio: 1; background: rgba(255, 255, 255, 0.6); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 700; color: var(--text-muted); transition: 0.2s; }
.cal-box.empty { background: transparent; }
.cal-box.done { background: var(--orange-active); color: white; }
.cal-box.is-today { border: 2px solid var(--orange-active); color: var(--primary-dark); }
.cal-box.is-today.done { color: white; }

/* Overall Layout */
.overall-grid { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; }
.grid-box { aspect-ratio: 1; background: rgba(255, 255, 255, 0.7); border-radius: 6px; }
.grid-box.done { background: var(--orange-active); }

/* --- Achievements Slider --- */
.achievements-section { padding: 0 1.5rem; margin-top: 2rem; }
.achievements-section h3 { margin-bottom: 1rem; color: var(--primary-dark); }
.achievements-slider { display: flex; overflow-x: auto; gap: 1rem; padding-bottom: 1rem; scroll-snap-type: x mandatory; scrollbar-width: none; }
.achievements-slider::-webkit-scrollbar { display: none; }
.achievement-slide { min-width: 100px; background: #f8f9fa; padding: 1rem; border-radius: 12px; border: 1px solid #e2e8f0; scroll-snap-align: start; text-align: center; flex-shrink: 0; transition: opacity 0.3s; }
.achievement-slide.locked { opacity: 0.4; filter: grayscale(100%); }
.ach-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.ach-title { font-weight: bold; font-size: 0.85rem; color: var(--text-main); }

/* --- Sidebar & Overlay --- */
.sidebar { position: fixed; top: 0; left: -100%; width: 280px; max-width: 80vw; height: 100vh; background: var(--app-bg); box-shadow: 4px 0 24px rgba(0,0,0,0.1); transition: left 0.4s cubic-bezier(0.25, 1, 0.5, 1); z-index: 1000; padding: 6rem 2rem 2rem 2rem; display: flex; flex-direction: column; gap: 1rem; }
.sidebar.active { left: 0; }
.sidebar a { text-decoration: none; color: var(--primary-dark); font-weight: 700; font-size: 1.2rem; padding: 1rem; border-radius: 16px; transition: 0.2s; }
.sidebar a:hover, .sidebar a.active { background: var(--primary-light); }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.3); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity 0.4s ease; z-index: 999; }
.sidebar-overlay.active { opacity: 1; pointer-events: auto; }

/* --- Floating Action Button (+) --- */
.fab-plus { position: fixed; bottom: 2rem; right: 1.5rem; width: 60px; height: 60px; background: var(--primary-dark); border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 2rem; color: white; text-decoration: none; box-shadow: 0 8px 20px rgba(26, 11, 46, 0.3); z-index: 90; transition: transform 0.2s; }
.fab-plus:active { transform: scale(0.95); }