/* ── HifzTracker Custom Styles ─────────────────── */
:root {
    --dark:    #0d2137;
    --primary: #1a4a7a;
    --mid:     #2e86c1;
    --light:   #85c1e9;
    --pale:    #d6eaf8;
    --bg:      #eaf2f8;
}

body {
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* override Bootstrap default that caps input width */
input[type="number"], input[type="password"] {
    max-width: 100%;
}

/* ── LOGIN ───────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #0d2137 0%, #1a4a7a 60%, #2e86c1 100%);
}

.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.35);
}

.login-logo    { text-align: center; margin-bottom: 2rem; }
.login-moon    { font-size: 3rem; line-height: 1; }
.login-logo h1 { font-size: 1.9rem; font-weight: 800; color: var(--primary); margin: 0.25rem 0 0; }
.login-logo p  { color: #888; font-size: 0.88rem; margin: 0; }

.login-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.4rem;
    display: block;
}

.pin-input {
    width: 100%;
    text-align: center;
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 0.6rem;
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    padding: 0.7rem 1rem;
    color: var(--primary);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.pin-input:focus  { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(26,74,122,0.12); }
.pin-input.pin-error { border-color: #e74c3c; }

.login-error-msg {
    background: #fdecea;
    color: #c0392b;
    border-radius: 10px;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    margin-top: 0.75rem;
    text-align: center;
}

.btn-login {
    width: 100%;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 0.9rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 1.1rem;
    transition: background 0.2s;
}
.btn-login:hover { background: var(--dark); }

/* ── NAVBAR ──────────────────────────────────────── */
.app-nav {
    background: var(--primary);
    padding: 0.8rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.nav-brand      { color: #fff; font-weight: 800; font-size: 1.15rem; }
.nav-brand span { opacity: 0.75; font-weight: 400; }
.nav-links      { display: flex; gap: 0.25rem; }

.nav-link-btn {
    color: rgba(255,255,255,0.75);
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 0.35rem 0.75rem;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    display: inline-block;
}
.nav-link-btn:hover,
.nav-link-btn.active   { color: #fff; background: rgba(255,255,255,0.15); text-decoration: none; }
.nav-link-btn.nav-logout        { color: rgba(255,255,255,0.5); }
.nav-link-btn.nav-logout:hover  { color: #fff; background: rgba(255,255,255,0.1); }

/* ── PAGE WRAPPER ────────────────────────────────── */
.page-body {
    max-width: 640px;
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
}

/* ── CARDS ───────────────────────────────────────── */
.ht-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 2px 14px rgba(0,0,0,0.07);
    margin-bottom: 1.25rem;
}
.ht-card-body { padding: 1.25rem 1.5rem; }

.section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mid);
    margin-bottom: 1rem;
}

/* ── DATE HEADER ─────────────────────────────────── */
.date-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.greeting  { font-size: 1.15rem; font-weight: 700; color: #222; }
.date-pill {
    background: var(--primary);
    color: #fff;
    border-radius: 50px;
    padding: 0.3rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
}

/* ── AYAH INPUT ──────────────────────────────────── */
.ayah-input {
    width: 100%;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    padding: 0.65rem 1rem;
    outline: none;
    background: var(--bg);
    transition: border-color 0.2s, box-shadow 0.2s;
    display: block;
}
.ayah-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(26,74,122,0.1); background: #fff; }

.ayah-hint { text-align: center; color: #aaa; font-size: 0.8rem; margin: 0.4rem 0 0.85rem; }

/* ── LIVE PREVIEW ────────────────────────────────── */
.live-preview { margin-bottom: 1rem; display: none; }
.live-preview-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: #777;
    margin-bottom: 0.3rem;
}
.live-preview-label span:last-child { color: var(--primary); font-weight: 700; }
.mini-track { height: 6px; background: #e5e5e5; border-radius: 3px; overflow: hidden; }
.mini-fill  { height: 100%; background: linear-gradient(90deg, var(--primary), var(--mid)); border-radius: 3px; transition: width 0.3s; }

/* ── SAVE BUTTON ─────────────────────────────────── */
.btn-save {
    width: 100%;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 0.8rem;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-save:hover { background: var(--dark); }
.btn-save.saved { background: var(--mid); }

.last-updated { text-align: center; font-size: 0.82rem; color: #999; margin-top: 0.65rem; }
.last-updated strong { color: #666; }

/* ── NAMAZ TOGGLES ───────────────────────────────── */
.namaz-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
}

.namaz-btn {
    border: 2px solid #d6e8f5;
    background: #f4f9fd;
    border-radius: 14px;
    padding: 0.85rem 0.5rem 0.7rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
.namaz-btn:hover { border-color: var(--mid); }
.namaz-btn.done  { background: var(--primary); border-color: var(--primary); }

.p-icon  { font-size: 1.4rem; line-height: 1; display: block; margin-bottom: 0.2rem; }
.p-name  { font-size: 0.78rem; font-weight: 700; display: block; color: #555; }
.p-check { font-size: 0.7rem; color: #ccc; margin-top: 0.15rem; display: block; }
.namaz-btn.done .p-name  { color: rgba(255,255,255,0.9); }
.namaz-btn.done .p-check { color: rgba(255,255,255,0.7); }

/* ── PROGRESS ────────────────────────────────────── */
.stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 0.75rem; margin-bottom: 1.25rem; }
.stat-box { background: var(--bg); border-radius: 12px; padding: 0.9rem 0.5rem; text-align: center; }
.stat-val { font-size: 1.5rem; font-weight: 800; color: var(--primary); line-height: 1; }
.stat-lbl { font-size: 0.72rem; color: #999; margin-top: 0.2rem; }

.prog-track { height: 14px; background: #d6e8f5; border-radius: 7px; overflow: hidden; margin-bottom: 0.4rem; }
.prog-fill  { height: 100%; background: linear-gradient(90deg, var(--primary), var(--mid)); border-radius: 7px; transition: width 0.6s; }
.prog-meta  { display: flex; justify-content: space-between; font-size: 0.78rem; color: #999; margin-bottom: 1.5rem; }
.prog-meta span:last-child { color: var(--primary); font-weight: 700; }

/* ── CONTRIBUTION GRID ───────────────────────────── */
.contrib-outer { overflow-x: auto; padding: 4px 2px 6px; }
.contrib-inner { min-width: max-content; padding: 0 4px; }

.contrib-row { display: flex; align-items: center; margin-bottom: 5px; }
.contrib-lbl { width: 86px; font-size: 0.75rem; font-weight: 600; color: #666; flex-shrink: 0; padding-right: 4px; }

.sq { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; }
.sq + .sq { margin-left: 3px; }

.sq-done       { background: var(--primary); }
.sq-missed     { background: #cfe0ee; }
.sq-today-done { background: var(--mid); outline: 2px solid var(--primary); }
.sq-today-miss { background: var(--bg); outline: 2px solid #9ec7e0; }

.grid-legend { display: flex; align-items: center; gap: 1rem; margin-top: 0.75rem; font-size: 0.75rem; color: #888; }
.leg-item    { display: flex; align-items: center; gap: 0.35rem; }
.leg-sq      { width: 12px; height: 12px; border-radius: 2px; }

/* ── TOAST ───────────────────────────────────────── */
#toast {
    position: fixed;
    bottom: 1.75rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--dark);
    color: #fff;
    padding: 0.65rem 1.4rem;
    border-radius: 50px;
    font-size: 0.88rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 400px) {
    .namaz-grid { grid-template-columns: repeat(2,1fr); }
    .stat-val   { font-size: 1.2rem; }
}
