/* =============================================================================
 *  chapter-styles.css  —  Chapter Hub (mobile-first)
 *  Uses the core tokens from styles.css (:root). The content card sits on the
 *  app's purple gradient body, like the other pages.
 * ========================================================================== */

.main-content {
    max-width: 860px;
    margin: 0 auto;
    padding: 1rem 1rem 3rem;
}

/* Breadcrumb */
.breadcrumb {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0.5rem 0 1rem;
    line-height: 1.8;
}
.breadcrumb a { color: #fff; text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb strong { color: #fff; }

/* Header + mastery bar */
.hub-header {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}
.hub-header h1 {
    font-size: 1.5rem;
    color: var(--dark);
    margin-bottom: 1rem;
    line-height: 1.25;
}
.mastery-wrap { display: flex; align-items: center; gap: 0.75rem; }
.mastery-track {
    flex: 1;
    height: 12px;
    background: var(--light-gray);
    border-radius: 999px;
    overflow: hidden;
}
.mastery-fill {
    height: 100%;
    width: 0;
    background: var(--success);
    border-radius: 999px;
    transition: width 0.6s ease;
}
.mastery-fill[data-band="weak"]       { background: var(--danger); }
.mastery-fill[data-band="developing"] { background: var(--warning); }
.mastery-fill[data-band="strong"]     { background: var(--success); }
.mastery-label {
    font-size: 0.8rem;
    color: var(--gray);
    white-space: nowrap;
    font-weight: 600;
}

/* Resume banner */
.resume-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: #fff8e6;
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
}
.resume-text { font-weight: 600; color: var(--dark); font-size: 0.9rem; }

/* Sections */
.hub-section {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}
.hub-section h2 {
    font-size: 1.15rem;
    color: var(--dark);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.hub-section h2 i { color: var(--primary); }
.hub-muted { color: var(--gray); font-size: 0.9rem; margin-bottom: 0.75rem; }

/* Buttons / links */
.hub-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    border-radius: var(--radius);
    padding: 0.7rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    transition: var(--transition);
}
.hub-btn:hover { background: var(--primary-dark); transform: translateY(-2px); }
.hub-btn-revise { background: var(--secondary); }
.hub-btn-diagnostic {
    margin-top: 1rem;
    width: 100%;
    justify-content: center;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
}
.hub-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 0.75rem;
}
.hub-link:hover { text-decoration: underline; }

/* Test card grid */
.test-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}
.test-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--light);
    border: 1px solid var(--light-gray);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
    font-family: inherit;
}
.test-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.test-card-name { font-weight: 700; color: var(--dark); font-size: 0.95rem; }
.test-card-count { color: var(--gray); font-size: 0.8rem; margin-left: auto; }
.test-card-go {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* Topic analytics rows */
.topic-row { margin-bottom: 0.85rem; }
.topic-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--dark);
    margin-bottom: 0.3rem;
    font-weight: 600;
}
.topic-bar { height: 8px; background: var(--light-gray); border-radius: 999px; overflow: hidden; }
.topic-fill { height: 100%; border-radius: 999px; background: var(--success); transition: width 0.6s ease; }
.topic-fill[data-band="weak"]       { background: var(--danger); }
.topic-fill[data-band="developing"] { background: var(--warning); }
.topic-fill[data-band="strong"]     { background: var(--success); }

/* States */
.hub-error {
    background: #fff;
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    color: var(--dark);
}
.hub-loading {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    z-index: 9999;
}

/* Tablet and up */
@media (min-width: 600px) {
    .main-content { padding: 1.5rem 1.5rem 3rem; }
    .hub-header h1 { font-size: 1.85rem; }
    .test-grid { grid-template-columns: 1fr 1fr; }
}
