:root {
    --primary: #2ecc71;
    --bg: #0b0e14;
    --card: #1a1e29;
    --text: #e0e0e0;
    --accent: #3498db;
    --danger: #e94560;
    --border: #30363d;
    --bronze: #cd7f32;
    --silver: #c0c0c0;
    --gold: #ffd700;
    --platinum: #e5e4e2;
}

body { font-family: 'Ubuntu', sans-serif; background: var(--bg); color: var(--text); margin: 0; overflow-x: hidden; }

/* Header & Stats */
header { background: #161b22; padding: 0 20px; height: 60px; display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--border); position: sticky; top: 0; z-index: 100; }
.menu-toggle { background:none; border:none; color:white; font-size:1.5rem; cursor:pointer; }
.stats-header { display:flex; align-items:center; gap:12px; }
.stat-item { font-weight:bold; font-size: 0.9rem; }
.stat-item.accent { color: var(--accent); }
.stat-item.primary { color: var(--primary); }
.lvl-badge { background: var(--primary); color: #000; padding: 2px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: 800; }

/* Main UI */
.container { padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.card { background: var(--card); padding: 25px; border-radius: 12px; width: 100%; max-width: 450px; border: 1px solid var(--border); box-sizing: border-box; }
.primary-text { margin:0; color: var(--primary); font-size: 1.4rem; }

/* XP Bar */
#xp-bar-outer { background: #0d1117; height: 12px; border-radius: 6px; margin: 15px 0; border: 1px solid var(--border); overflow: hidden; }
#xp-bar-inner { background: var(--primary); height: 100%; width: 0%; transition: width 0.5s; }
.xp-subtext { font-size: 0.7rem; color: #8b949e; margin-bottom: 20px; }

/* Inputs */
.input-group { margin-bottom: 25px; position: relative; }
.label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; padding: 0 5px; }
label { font-size: 0.7rem; color: #8b949e; text-transform: uppercase; font-weight: bold; }
.counter-badge { font-size: 0.65rem; color: var(--accent); font-weight: bold; }

input[type="text"], textarea { 
    width: 100%; padding: 12px; margin-bottom: 8px; border-radius: 6px; 
    border: 1px solid var(--border); background: #0d1117; color: white; 
    box-sizing: border-box; font-size: 0.9rem; font-family: inherit; resize: none;
}

.action-btn { border: none; padding: 12px; width: 100%; color: white; border-radius: 6px; font-weight: bold; cursor: pointer; font-size: 0.85rem; transition: 0.2s; }
.prayer-btn { background: var(--accent); }
.faith-btn { background: var(--primary); color: #000; }
.action-btn:disabled { opacity: 0.3; cursor: not-allowed; filter: grayscale(1); }

/* Sidebar */
#side-menu { position: fixed; top: 0; left: -320px; width: 310px; height: 100%; background: #161b22; transition: 0.3s; z-index: 200; padding: 20px; border-right: 1px solid var(--border); overflow-y: auto; box-sizing: border-box; }
#side-menu.active { left: 0; }
.close-menu { background:none; color:var(--danger); float:right; border:none; font-size:1.5rem; cursor:pointer; }

.tab-nav { 
    display: flex; 
    gap: 4px; 
    margin-top: 40px; 
    margin-bottom: 20px; 
}
.tab-btn { 
    flex: 1; 
    padding: 10px 4px; /* Increased vertical padding slightly for the larger font */
    border-radius: 4px; 
    border: none; 
    background: #30363d; 
    color: white; 
    cursor: pointer; 
    font-family: 'Ubuntu', sans-serif; /* Explicitly ensuring Ubuntu is here */
    font-size: 0.7rem; /* Increased from 0.6rem */
    font-weight: bold; 
    text-align: center; 
    text-transform: none; /* Keeps the clean "Navigation" look */
    letter-spacing: 0.5px; /* Helps readability with Ubuntu at smaller sizes */
}
.tab-btn.active { background: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Library & Filters */
.filter-shelf { display: flex; gap: 5px; margin-bottom: 15px; }
.filter-pill { flex: 1; font-size: 0.65rem; padding: 6px; border-radius: 4px; border: 1px solid var(--border); background: #0d1117; color: #8b949e; cursor: pointer; text-align: center; transition: 0.2s; }
.filter-pill.on { background: var(--accent); color: white; border-color: var(--accent); }

.book-row { margin-bottom: 12px; }
.progress-bg { background: #0d1117; height: 8px; border-radius: 4px; margin-top: 3px; overflow: hidden; border: 1px solid #30363d; }
/* Progress Fill Base */
.progress-fill { 
    height: 100%; 
    border-radius: 4px; 
    transition: width 0.8s ease-out; 
}

/* The "Mastered" State */
.progress-complete {
    /* Use long-hand to prevent browser overrides */
    background-image: linear-gradient(
        90deg, 
        #ffd700 0%, 
        #fff9d0 25%, 
        #ffd700 50%, 
        #fff9d0 75%, 
        #ffd700 100%
    ) !important;
    background-size: 200% 100% !important;
    background-repeat: repeat !important;
    background-color: transparent !important;
    
    /* Hardware acceleration */
    will-change: background-position;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;

    /* Specific animation properties */
    animation-name: shine-gold;
    animation-duration: 3s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;

    -webkit-animation-name: shine-gold;
    -webkit-animation-duration: 3s;
    -webkit-animation-timing-function: linear;
    -webkit-animation-iteration-count: infinite;

    box-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}

@keyframes shine-gold {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

@-webkit-keyframes shine-gold {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

/* Logs & Medals */
.log-entry { background:#0d1117; padding:10px; margin-bottom:10px; border-left:3px solid var(--accent); font-size:0.8rem; border-radius: 0 4px 4px 0; line-height: 1.4; }
.diag-panel { margin-top: 30px; padding-top: 20px; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 8px; }
.diag-btn { background: #21262d; border: 1px solid var(--border); color: #8b949e; padding: 8px; border-radius: 4px; font-size: 0.7rem; cursor: pointer; }
.danger-text { color: var(--danger); }
.medal-row { display:flex; justify-content:center; gap:15px; margin-top:10px; }
.medal { font-size: 1.8rem; opacity: 0.15; filter: grayscale(1); transition: 0.5s; }
.medal.earned { opacity: 1; filter: grayscale(0); transform: scale(1.1); }
.medal-container { display: flex; flex-direction: column; align-items: center; }
.medal-container label { font-size: 0.5rem; color: #8b949e; margin-top: 5px; }
.stats-footer { text-align: center; margin-top: 15px; color: #8b949e; font-family: monospace; }
.chapter-medals { border-top: 1px solid var(--border); padding-top: 15px; margin-top: 15px; }
/* --- Log Structure --- */
.log-year-group { margin-top: 15px; }

/* 1st Level: Month Header */
.log-month-header { 
    background: #30363d; 
    padding: 8px 12px; 
    border-radius: 6px; 
    cursor: pointer; 
    margin-bottom: 5px;
    font-weight: bold;
    letter-spacing: 0.3px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* The new White Hug Bar */
    border-left: 4px solid #ffffff; 
}

/* Container for Weeks */
.log-month-content { 
    display: none;
    margin-left: 12px; /* Uniform indent */
    padding-left: 0 !important;
    border-left: none !important; /* Removes the old grey/blue line */
}

/* 2nd Level: Week Header (Removed the border-left here) */
.log-week-header {
    cursor: pointer;
    background: #21262d;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 8px 0;
    letter-spacing: 0.3px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--accent);
    /* The blue bar */
    border-left: 4px solid #58a6ff; 
}

/* Container for Daily Entries */
.log-week-content {
    display: none; 
    margin-left: 12px; /* Uniform indent matching the level above */
    padding-left: 0 !important;
    border-left: none !important; /* Removes any extra lines */
}

/* 3rd Level: Individual Log Entry */
.log-entry {
    font-weight: 400;
    font-size: 0.85rem;
    padding: 10px 15px; /* Added more internal padding as requested */
    margin: 8px 0;
    line-height: 1.5;
    background: rgba(255, 255, 255, 0.05);
    /* This creates the rounded 'hugging' bar */
    border-left: 4px solid #2ea44f; 
    border-radius: 6px; 
    color: #c9d1d9;
}

.log-month-content.active,
.log-week-content.active { 
    display: block !important; 
}

/* Highlights the date */
.log-entry strong {
    color: #2ea44f;
    margin-right: 8px;
    font-weight: 700;
}