/* assets/css/guides.css */
/* CalcHub Knowledge Hub & Educational Calculation Guides */

.guides-page {
    padding: 1.75rem 0 4.5rem;
    background: var(--bg-page);
    overflow-x: hidden;
}

/* ---------- 1. Knowledge Hub Hero ---------- */
.guides-hero {
    position: relative;
    background: linear-gradient(135deg, #ffffff 0%, #f5f3ff 48%, #eff6ff 100%);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.35rem;
    margin-top: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 20px 45px -18px rgba(79, 70, 229, 0.14);
    overflow: hidden;
}

html.dark .guides-hero {
    background: linear-gradient(135deg, #131b2e 0%, #1b1b3a 52%, #13223b 100%);
    box-shadow: 0 20px 45px -18px rgba(0, 0, 0, 0.55);
}

.guides-hero-grid {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
    gap: 2rem;
    align-items: center;
}

.guides-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.38rem 0.95rem;
    border-radius: 9999px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #4338ca;
    font-size: 0.8rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

html.dark .guides-eyebrow {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(129, 140, 248, 0.32);
    color: #a5b4fc;
}

.guides-hero-title {
    font-size: clamp(2rem, 3.2vw, 2.75rem);
    font-weight: 900;
    line-height: 1.12;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin: 0 0 0.85rem;
}

.guides-hero-title span {
    background: linear-gradient(135deg, #4f46e5 0%, #2563eb 60%, #0d9488 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

html.dark .guides-hero-title span {
    background: linear-gradient(135deg, #818cf8 0%, #60a5fa 60%, #2dd4bf 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.guides-hero-desc {
    font-size: 1.02rem;
    line-height: 1.65;
    color: var(--text-secondary);
    max-width: 650px;
    margin: 0 0 1.4rem;
}

.guides-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 560px;
    background: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    padding: 0.35rem 0.45rem 0.35rem 1rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 0.9rem;
}

.guides-search-wrap:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.guides-search-ico {
    color: var(--text-muted);
    margin-right: 0.65rem;
    flex-shrink: 0;
}

.guides-search-input {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.94rem;
    font-weight: 500;
    padding: 0.48rem 0.4rem;
}

.guides-search-input:focus {
    outline: none;
}

.guides-search-clear {
    display: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--bg-surface-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    margin-right: 0.35rem;
}

.guides-search-clear.visible {
    display: inline-flex;
}

.guides-quick-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.guides-quick-lbl {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-right: 0.2rem;
}

.guides-quick-btn {
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-radius: 9999px;
    padding: 0.25rem 0.75rem;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.guides-quick-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-1px);
}

/* Right Hero Stats Card */
.guides-hero-summary {
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

html.dark .guides-hero-summary {
    background: rgba(15, 23, 42, 0.72);
}

.guides-summary-title {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-primary);
}

.guides-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.guides-stat-tile {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 0.85rem;
}

.guides-stat-val {
    display: block;
    font-size: 1.45rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1.15;
}

.guides-stat-txt {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.guides-cheat-jump {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem 1rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #4f46e5 0%, #2563eb 100%);
    color: #ffffff;
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.16s ease;
}

.guides-cheat-jump:hover {
    transform: translateY(-1px);
}

/* ---------- 2. Featured Deep-Dive Playbook ---------- */
.guides-featured {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 22px;
    padding: 1.85rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 1.85rem;
    align-items: stretch;
}

.guides-feat-badge-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 0.85rem;
}

.guides-feat-pill {
    font-size: 0.74rem;
    font-weight: 800;
    padding: 0.28rem 0.75rem;
    border-radius: 9999px;
    background: #eef2ff;
    color: #4f46e5;
}

html.dark .guides-feat-pill {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

.guides-meta-pill {
    font-size: 0.74rem;
    font-weight: 700;
    padding: 0.28rem 0.7rem;
    border-radius: 9999px;
    background: var(--bg-surface-secondary);
    color: var(--text-secondary);
}

.guides-feat-title {
    font-size: 1.65rem;
    font-weight: 850;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
}

.guides-prose {
    font-size: 0.94rem;
    line-height: 1.68;
    color: var(--text-secondary);
    margin: 0 0 0.95rem;
}

.guides-tip-box {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-left: 4px solid #10b981;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    font-size: 0.87rem;
    line-height: 1.55;
    color: #065f46;
    margin-bottom: 1.15rem;
}

html.dark .guides-tip-box {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(52, 211, 153, 0.28);
    color: #a7f3d0;
}

.guides-feat-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.guides-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.62rem 1.15rem;
    border-radius: 11px;
    background: linear-gradient(135deg, #4f46e5 0%, #2563eb 100%);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.guides-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -8px rgba(79, 70, 229, 0.5);
}

.guides-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.62rem 1.1rem;
    border-radius: 11px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

/* Right Formula Breakdown Card */
.guides-playbook-panel {
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
}

.guides-formula-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.85rem 1rem;
}

.guides-box-kicker {
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.guides-formula-code {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--color-primary);
    word-break: break-word;
}

html.dark .guides-formula-code {
    color: #a5b4fc;
}

.guides-vars-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.42rem;
    font-size: 0.83rem;
    color: var(--text-secondary);
}

.guides-vars-list strong {
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.guides-example-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    font-size: 0.84rem;
    line-height: 1.55;
    color: #1e3a8a;
}

html.dark .guides-example-box {
    background: rgba(37, 99, 235, 0.14);
    border-color: rgba(96, 165, 250, 0.3);
    color: #bfdbfe;
}

/* ---------- 3. Topic Filter Bar ---------- */
.guides-toolbar {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 0.8rem 1.1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.guides-filters {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.guides-filter-btn {
    border: 1px solid var(--border-color);
    background: var(--bg-surface-secondary);
    color: var(--text-secondary);
    border-radius: 9999px;
    padding: 0.42rem 0.9rem;
    font-family: var(--font-sans);
    font-size: 0.81rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.guides-filter-btn:hover {
    border-color: var(--color-primary);
    color: var(--text-primary);
}

.guides-filter-btn.active {
    background: linear-gradient(135deg, #4f46e5 0%, #2563eb 100%);
    border-color: transparent;
    color: #ffffff;
}

.guides-visible-info {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
}

/* ---------- 4. 2-Column Rich Guide Cards Grid ---------- */
.guides-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.35rem;
    margin-bottom: 2.75rem;
}

.guide-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.55rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.guide-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--guide-accent, var(--color-primary));
}

.guide-card.is-hidden {
    display: none !important;
}

.guide-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.guide-card-catwrap {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.guide-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--guide-bg, #eef2ff);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

html.dark .guide-icon-box {
    background: rgba(255, 255, 255, 0.08);
}

.guide-icon-box img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
}

.guide-cat-label {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--guide-accent, var(--color-primary));
}

.guide-meta-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.guide-read-badge {
    font-size: 0.71rem;
    font-weight: 700;
    padding: 0.22rem 0.6rem;
    border-radius: 9999px;
    background: var(--bg-surface-secondary);
    color: var(--text-secondary);
}

.guide-title {
    font-size: 1.24rem;
    font-weight: 850;
    line-height: 1.3;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    margin: 0.15rem 0 0.55rem;
}

.guide-text {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-secondary);
    margin: 0 0 0.85rem;
}

.guide-formula-strip {
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.72rem 0.9rem;
    margin-bottom: 0.75rem;
}

.guide-formula-strip code {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.81rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 0.2rem;
    word-break: break-word;
}

.guide-worked-box {
    background: rgba(16, 185, 129, 0.07);
    border: 1px solid rgba(16, 185, 129, 0.22);
    border-radius: 12px;
    padding: 0.75rem 0.95rem;
    font-size: 0.84rem;
    line-height: 1.55;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.guide-takeaway {
    font-size: 0.83rem;
    line-height: 1.52;
    color: var(--text-secondary);
    padding-left: 0.75rem;
    border-left: 3px solid var(--guide-accent, var(--color-primary));
}

.guide-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.95rem;
    border-top: 1px solid var(--border-color-subtle);
    flex-wrap: wrap;
}

.guide-calc-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.52rem 1rem;
    border-radius: 10px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 0.82rem;
    font-weight: 800;
    text-decoration: none;
    transition: all 0.16s ease;
}

.guide-calc-link:hover {
    background: var(--color-primary);
    color: #ffffff;
}

html.dark .guide-calc-link {
    color: #a5b4fc;
}

html.dark .guide-calc-link:hover {
    color: #ffffff;
}

.guide-level-text {
    font-size: 0.77rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* ---------- 5. Formula Cheat-Sheet Table ---------- */
.guides-cheatsheet {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 22px;
    padding: 1.75rem;
    margin-bottom: 2.25rem;
    box-shadow: var(--shadow-sm);
}

.guides-cheat-head {
    margin-bottom: 1.15rem;
}

.guides-cheat-head h2 {
    font-size: 1.4rem;
    font-weight: 850;
    color: var(--text-primary);
    margin: 0 0 0.3rem;
}

.guides-cheat-head p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

.guides-table-wrap {
    overflow-x: auto;
}

.guides-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.guides-table th {
    text-align: left;
    padding: 0.78rem 0.9rem;
    background: var(--bg-surface-secondary);
    color: var(--text-primary);
    font-weight: 800;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.guides-table td {
    padding: 0.82rem 0.9rem;
    border-bottom: 1px solid var(--border-color-subtle);
    color: var(--text-secondary);
    vertical-align: middle;
}

.guides-table td strong {
    color: var(--text-primary);
}

.guides-table code {
    font-family: var(--font-mono);
    font-size: 0.79rem;
    color: var(--color-primary);
    background: var(--bg-surface-secondary);
    padding: 0.22rem 0.5rem;
    border-radius: 6px;
}

html.dark .guides-table code {
    color: #a5b4fc;
}

.guides-table-link {
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
    white-space: nowrap;
}

.guides-table-link:hover {
    text-decoration: underline;
}

/* Empty State */
.guides-empty {
    display: none;
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--bg-surface);
    border: 1px dashed var(--border-color);
    border-radius: 20px;
    margin-bottom: 2rem;
}

.guides-empty.visible {
    display: block;
}

/* Responsive */
@media (max-width: 1080px) {
    .guides-hero-grid,
    .guides-featured,
    .guides-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .guides-hero,
    .guides-featured,
    .guide-card,
    .guides-cheatsheet {
        padding: 1.25rem;
    }
}
