/* assets/css/app.css — Task & Earn v2 */
/* Dark theme, Android WebView optimised */

:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.4);
    --primary-grad: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --success-grad: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --warn-grad: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent
}

html,
body {
    height: 100%;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
}

a {
    text-decoration: none;
    color: var(--accent)
}

/* ── Utilities ─────────────────────────── */
.hidden {
    display: none !important
}

.mt-2 {
    margin-top: 1rem
}

.mb-1 {
    margin-bottom: .5rem
}

/* ── Toasts ─────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    width: 90%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-card);
    border-left: 4px solid var(--accent);
    padding: 14px 16px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: opacity .4s ease, transform .4s ease;
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    border-color: #10b981
}

.toast.error {
    border-color: var(--danger)
}

/* ── Loading Splash ──────────────────────── */
#initial-loader {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

#initial-loader h2 {
    margin-top: 16px;
    font-size: 24px
}

#initial-loader p {
    color: var(--text-secondary);
    margin-top: 6px
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-card);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

/* ── Views: generic ─────────────────────── */
/* All .view sections are absolutely stacked, filling the whole screen */
.view {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    overflow: hidden;
}

/* JS adds this class to make a view visible */
.view-active {
    display: block !important;
}

/* Dashboard uses flex internally for header/content/nav layout */
#dashboard-view.view-active {
    display: flex !important;
    flex-direction: column;
}

/* ── Auth View ──────────────────────────── */
#auth-view {
    overflow-y: auto;
}

.auth-box {
    min-height: 100%;
    padding: 40px 22px 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.logo-text {
    font-size: 34px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 36px
}

.accent-text {
    color: var(--accent)
}

.auth-box h2 {
    font-size: 22px;
    margin-bottom: 18px
}

.auth-link {
    text-align: center;
    margin-top: 14px;
    font-size: 14px;
    color: var(--text-secondary)
}

/* ── Input Groups ───────────────────────── */
.input-group {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 4px 14px;
    margin-bottom: 14px;
    border: 1px solid var(--bg-card-hover);
}

.input-group i {
    color: var(--text-secondary);
    width: 22px;
    min-width: 22px
}

.input-group input,
.input-group select,
.input-group textarea {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 100%;
    padding: 12px 6px;
    outline: none;
    font-size: 16px;
    font-family: inherit;
    resize: none;
}

.input-group select option {
    background: var(--bg-card);
    color: var(--text-primary)
}

/* ── Buttons ────────────────────────────── */
.btn {
    border: none;
    border-radius: 12px;
    padding: 13px 18px;
    font-weight: 600;
    font-size: 15px;
    color: #fff;
    cursor: pointer;
    transition: transform .1s, opacity .2s;
    text-align: center;
    display: block;
    width: 100%;
}

.btn:active {
    transform: scale(0.97);
    opacity: .9
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed
}

.btn-primary {
    background: var(--primary-grad);
    box-shadow: 0 4px 14px var(--accent-glow)
}

.btn-success {
    background: var(--success-grad)
}

.btn-warn {
    background: var(--warn-grad)
}

.btn-danger {
    background: var(--danger)
}

.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
    width: auto;
    border-radius: 8px
}

/* ── Dashboard Layout ───────────────────── */
#dashboard-view {
    display: none;
    flex-direction: column;
}

/* Fixed top header */
.app-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 62px;
    padding: 0 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    border-bottom: 1px solid var(--bg-card-hover);
    z-index: 10;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover
}

.greeting {
    font-weight: 600;
    font-size: 15px
}

.rank-label {
    font-size: 11px;
    color: var(--text-secondary)
}

.points-badge {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent);
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Scrollable content area between header and nav */
.content-scroll {
    position: absolute;
    top: 62px;
    bottom: 60px;
    left: 0;
    right: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* smooth iOS / WebView scroll */
    padding: 16px;
}

/* Fixed bottom nav */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-card);
    border-top: 1px solid var(--bg-card-hover);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 10;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    gap: 3px;
    font-size: 11px;
    width: 20%;
    cursor: pointer;
    text-decoration: none;
    transition: color .2s;
}

.nav-item i {
    font-size: 20px;
    transition: transform .2s
}

.nav-item.active {
    color: var(--accent)
}

.nav-item.active i {
    transform: translateY(-3px)
}

/* ── Cards ──────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.card h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 12px
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px
}

.stat-box {
    background: var(--bg-card);
    padding: 18px;
    border-radius: 14px;
    text-align: center
}

.stat-box h3 {
    font-size: 22px;
    color: var(--accent);
    margin-bottom: 4px
}

.stat-box p {
    font-size: 13px;
    color: var(--text-secondary)
}

/* ── Task / Habit Items ─────────────────── */
.task-item {
    background: var(--bg-dark);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-item:last-child {
    margin-bottom: 0
}

.task-info h4 {
    font-size: 15px;
    margin-bottom: 3px
}

.task-info p {
    font-size: 12px;
    color: var(--text-secondary)
}

.task-reward {
    color: #10b981;
    font-weight: 700;
    font-size: 13px;
    margin-top: 4px
}

/* Quick reward grid */
.reward-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px
}

/* ── Divider ────────────────────────────── */
hr.divider {
    border: none;
    border-top: 1px solid var(--bg-card-hover);
    margin: 16px 0
}