/**
 * HBB - Home Bug Bounty
 * Main Stylesheet
 * 
 * Theme: Primary(#0d0c22), Secondary(#212529), BG(white)
 * Font: Outfit (Google Fonts)
 * Mobile-first, native-app feel on small screens.
 */

/* ── CSS Variables ────────────────────────────────────────── */
:root {
    --primary: #0d0c22;
    --secondary: #212529;
    --bg: #ffffff;
    --bg-light: #f8f9fa;
    --bg-card: #ffffff;
    --border: #e9ecef;
    --text: #212529;
    --text-muted: #6c757d;
    --accent: #4f46e5;
    --accent-light: #eef2ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
    --transition: all .2s ease;
    --font: 'Outfit', sans-serif;
    --bottom-nav-h: 64px;
}

/* ── Base ─────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: contain;
}

/* ── Utility: font weights ────────────────────────────────── */
.fw-300 { font-weight: 300; }
.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* ── Navbar ───────────────────────────────────────────────── */
.hbb-navbar {
    background: var(--primary);
    padding: .75rem 0;
    box-shadow: var(--shadow-md);
    z-index: 1050;
}

.hbb-logo {
    height: 32px;
    width: auto;
    border-radius: 6px;
}

.hbb-navbar .navbar-brand {
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: -.01em;
}

.hbb-navbar .nav-link {
    font-weight: 500;
    font-size: .9rem;
    padding: .5rem .85rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.hbb-navbar .nav-link:hover,
.hbb-navbar .nav-link.active {
    background: rgba(255,255,255,.12);
}

/* ── Main Content ─────────────────────────────────────────── */
.hbb-main {
    padding-top: 80px;   /* space for fixed navbar */
    padding-bottom: 2rem;
    min-height: 100vh;
}

/* On mobile, add space for bottom nav */
@media (max-width: 767.98px) {
    .hbb-main {
        padding-bottom: calc(var(--bottom-nav-h) + 1.5rem);
    }
    /* Hide top nav links on mobile (use bottom nav instead) */
    .hbb-navbar .navbar-collapse {
        display: none !important;
    }
    .hbb-navbar .navbar-toggler {
        display: none;
    }
}

/* ── Bottom Navigation (mobile only) ─────────────────────── */
.hbb-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-h);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1040;
    box-shadow: 0 -2px 10px rgba(0,0,0,.06);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.hbb-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: .7rem;
    font-weight: 500;
    padding: .35rem .75rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.hbb-bottom-nav-item i {
    font-size: 1.2rem;
}

.hbb-bottom-nav-item.active,
.hbb-bottom-nav-item:hover {
    color: var(--accent);
}

.hbb-bottom-nav-item.active {
    background: var(--accent-light);
}

/* ── Cards ────────────────────────────────────────────────── */
.hbb-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
}

.hbb-card:hover {
    box-shadow: var(--shadow-md);
}

.hbb-card .card-body {
    padding: 1.25rem;
}

/* ── Section Headings ─────────────────────────────────────── */
.hbb-section-title {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: .25rem;
    letter-spacing: -.02em;
}

.hbb-section-subtitle {
    color: var(--text-muted);
    font-size: .9rem;
    margin-bottom: 1.5rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn-hbb {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: .65rem 1.5rem;
    font-family: var(--font);
    font-weight: 600;
    font-size: .95rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

.btn-hbb:hover {
    background: #1a1936;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-hbb-accent {
    background: var(--accent);
}

.btn-hbb-accent:hover {
    background: #4338ca;
    color: #fff;
}

.btn-hbb-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--border);
}

.btn-hbb-outline:hover {
    background: var(--bg-light);
    color: var(--primary);
    border-color: var(--primary);
}

.btn-hbb-success {
    background: var(--success);
}

.btn-hbb-success:hover {
    background: #059669;
    color: #fff;
}

/* ── Severity Badges ──────────────────────────────────────── */
.badge-severity {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: .3rem .65rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.badge-critical { background: #fef2f2; color: #dc2626; }
.badge-high     { background: #fff7ed; color: #ea580c; }
.badge-medium   { background: #fffbeb; color: #d97706; }
.badge-low      { background: #f0fdf4; color: #16a34a; }
.badge-info     { background: #eff6ff; color: #2563eb; }

/* ── Effort Badges ────────────────────────────────────────── */
.badge-effort {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: .25rem .6rem;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 500;
}

.badge-quick    { background: #ecfdf5; color: #059669; }
.badge-moderate { background: #fefce8; color: #ca8a04; }
.badge-weekend  { background: #fef2f2; color: #dc2626; }

/* ── Category Icons ───────────────────────────────────────── */
.cat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.cat-water   { background: #dbeafe; color: #2563eb; }
.cat-fire    { background: #fee2e2; color: #dc2626; }
.cat-money   { background: #d1fae5; color: #059669; }
.cat-clutter { background: #fef3c7; color: #d97706; }

/* ── Scan Progress Bar ────────────────────────────────────── */
.hbb-progress-wrap {
    position: sticky;
    top: 60px;
    z-index: 100;
    background: var(--bg);
    padding: .75rem 0;
}

.hbb-progress {
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    overflow: hidden;
}

.hbb-progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width .4s ease;
}

.hbb-step-counter {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* ── Question Card ────────────────────────────────────────── */
.hbb-question-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem 1.5rem;
    box-shadow: var(--shadow);
    animation: fadeInUp .35s ease;
}

.hbb-question-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.hbb-question-hint {
    font-size: .82rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* ── Option Buttons (radio-style) ─────────────────────────── */
.hbb-option {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: .6rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    font-size: .92rem;
    user-select: none;
    -webkit-user-select: none;
}

.hbb-option:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.hbb-option.selected {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 2px rgba(79,70,229,.15);
}

.hbb-option .option-radio {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.hbb-option.selected .option-radio {
    border-color: var(--accent);
    background: var(--accent);
}

.hbb-option.selected .option-radio::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
}

/* ── Numeric Input ────────────────────────────────────────── */
.hbb-numeric-input {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: .75rem 1rem;
    font-family: var(--font);
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    width: 100%;
    max-width: 200px;
    transition: var(--transition);
    outline: none;
}

.hbb-numeric-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

/* ── Bounty Board ─────────────────────────────────────────── */
.bounty-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    margin-bottom: .75rem;
    transition: var(--transition);
    position: relative;
}

.bounty-item:hover {
    box-shadow: var(--shadow-md);
}

.bounty-item.completed {
    opacity: .6;
    background: var(--bg-light);
}

.bounty-item.completed .bounty-title {
    text-decoration: line-through;
}

.bounty-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: .25rem;
}

.bounty-desc {
    font-size: .85rem;
    color: var(--text-muted);
    margin-bottom: .65rem;
    line-height: 1.5;
}

.bounty-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}

.bounty-stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.bounty-stat i {
    font-size: .72rem;
}

/* ── 7-Day Plan ───────────────────────────────────────────── */
.plan-day-header {
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary);
    padding: .75rem 0 .5rem;
    border-bottom: 2px solid var(--border);
    margin-bottom: .75rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.plan-day-badge {
    background: var(--accent);
    color: #fff;
    padding: .2rem .6rem;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
}

.plan-task {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: .5rem;
    transition: var(--transition);
    cursor: pointer;
}

.plan-task:hover {
    background: var(--bg-light);
}

.plan-task.completed {
    opacity: .55;
}

.plan-task.completed .plan-task-title {
    text-decoration: line-through;
}

.plan-task-check {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    margin-top: 1px;
}

.plan-task.completed .plan-task-check {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.plan-task-title {
    font-weight: 500;
    font-size: .9rem;
    color: var(--text);
}

.plan-task-time {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Score Ring ────────────────────────────────────────────── */
.score-ring-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.score-ring {
    position: relative;
    width: 120px;
    height: 120px;
}

.score-ring svg {
    transform: rotate(-90deg);
}

.score-ring-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 8;
}

.score-ring-fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
}

.score-ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-ring-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.score-ring-label {
    font-size: .7rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

/* ── Stats Row ────────────────────────────────────────────── */
.stat-card {
    text-align: center;
    padding: 1rem .75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    font-size: .75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

/* ── Empty State ──────────────────────────────────────────── */
.hbb-empty {
    text-align: center;
    padding: 3rem 1rem;
}

.hbb-empty-icon {
    font-size: 3rem;
    color: var(--border);
    margin-bottom: 1rem;
}

.hbb-empty-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: .5rem;
}

.hbb-empty-text {
    font-size: .9rem;
    color: var(--text-muted);
    max-width: 320px;
    margin: 0 auto 1.25rem;
}

/* ── Scan History Card ────────────────────────────────────── */
.scan-history-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.15rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: .65rem;
    text-decoration: none;
    color: var(--text);
    transition: var(--transition);
}

.scan-history-card:hover {
    box-shadow: var(--shadow-md);
    color: var(--text);
    border-color: var(--accent);
}

.scan-history-score {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .95rem;
    flex-shrink: 0;
}

.scan-history-info {
    flex: 1;
    min-width: 0;
}

.scan-history-date {
    font-size: .78rem;
    color: var(--text-muted);
}

.scan-history-bounties {
    font-weight: 600;
    font-size: .9rem;
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.animate-fade-in {
    animation: fadeIn .4s ease;
}

.animate-fade-in-up {
    animation: fadeInUp .4s ease;
}

/* ── Remediation Steps ────────────────────────────────────── */
.remediation-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: step;
}

.remediation-steps li {
    counter-increment: step;
    padding: .5rem 0 .5rem 2.25rem;
    position: relative;
    font-size: .88rem;
    line-height: 1.5;
    border-bottom: 1px solid var(--border);
}

.remediation-steps li:last-child {
    border-bottom: none;
}

.remediation-steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: .5rem;
    width: 24px;
    height: 24px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 50%;
    font-size: .72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Responsive Tweaks ────────────────────────────────────── */
@media (max-width: 575.98px) {
    .hbb-section-title {
        font-size: 1.25rem;
    }
    .hbb-question-card {
        padding: 1.25rem 1rem;
    }
    .bounty-item {
        padding: .85rem 1rem;
    }
    .stat-card {
        padding: .75rem .5rem;
    }
    .stat-value {
        font-size: 1.15rem;
    }
}

/* ── Loading Spinner ──────────────────────────────────────── */
.hbb-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Toast / Flash Messages ───────────────────────────────── */
.hbb-toast {
    position: fixed;
    top: 80px;
    right: 1rem;
    z-index: 9999;
    min-width: 260px;
    max-width: 360px;
    animation: fadeInUp .3s ease;
}

/* ── Collapsible Remediation ──────────────────────────────── */
.bounty-expand-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: .82rem;
    font-weight: 600;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
}

.bounty-expand-btn:hover {
    color: #4338ca;
}

.bounty-detail {
    display: none;
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--border);
    animation: fadeIn .25s ease;
}

.bounty-detail.show {
    display: block;
}

/* ── Filter Tabs ──────────────────────────────────────────── */
.hbb-filter-tabs {
    display: flex;
    gap: .4rem;
    overflow-x: auto;
    padding-bottom: .5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.hbb-filter-tabs::-webkit-scrollbar {
    display: none;
}

.hbb-filter-tab {
    padding: .4rem .85rem;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1.5px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.hbb-filter-tab:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.hbb-filter-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
