/* ==========================================================================
   Billing User Guide Component Styles
   ========================================================================== */

/* Light Theme Variables (Default) */
:root {
    --sp-bg: #F8FAFC;
    --sp-surface: #FFFFFF;
    --sp-surface-hover: #F1F5F9;
    --sp-border: rgba(15, 23, 42, 0.08);
    --sp-primary: #4F46E5;
    --sp-primary-dim: rgba(79, 70, 229, 0.08);
    --sp-text: #0F172A;
    --sp-text-muted: #475569;
    --sp-text-dim: #64748B;
    --sp-warning: #D97706;
}

/* Dark Theme Variables */
html.dark :root,
html.dark {
    --sp-bg: #05090F;
    --sp-surface: #111827;
    --sp-surface-hover: #1F2937;
    --sp-border: rgba(255, 255, 255, 0.12);
    --sp-primary: #6366f1;
    --sp-primary-dim: rgba(99, 102, 241, 0.15);
    --sp-text: #E5EDF7;
    --sp-text-muted: #9CA3AF;
    --sp-text-dim: #6B7280;
    --sp-warning: #f59e0b;
}

/* Progress Bar */
.guide-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--sp-primary, #6366f1) 0%, var(--sp-primary-dim, #818cf8) 100%);
    z-index: 10000;
    transition: width 0.1s ease-out;
}

/* Sidebar Section & Accordion */
.guide-sidebar {
    padding-right: 8px;
}

@media (min-width: 1024px) {
    .guide-sidebar {
        position: sticky;
        top: 20px;
        height: calc(100vh - 40px);
        overflow-y: auto;
    }
}

.guide-sidebar::-webkit-scrollbar {
    width: 4px;
}

.guide-sidebar::-webkit-scrollbar-thumb {
    background: var(--sp-border, #e2e8f0);
    border-radius: 2px;
}

.guide-section {
    margin-bottom: 12px;
    border: 1px solid var(--sp-border, #e2e8f0);
    border-radius: 1rem;
    background: var(--sp-surface, #ffffff);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.01);
}

.guide-section:hover {
    border-color: var(--sp-primary, #6366f1);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

.guide-section.is-open {
    border-color: var(--sp-primary, #6366f1);
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.08), 0 8px 10px -6px rgba(99, 102, 241, 0.04);
}

.guide-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--sp-surface, #ffffff);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

.guide-section-header:hover {
    background: var(--sp-surface-hover, #f8fafc);
}

.guide-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono, monospace);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--sp-text, #1e293b);
}

.guide-section-chevron {
    width: 16px;
    height: 16px;
    color: var(--sp-text-muted, #64748b);
    transition: transform 0.2s ease;
}

.guide-section.is-open .guide-section-chevron {
    transform: rotate(180deg);
}

.guide-section-content {
    border-top: 1px solid var(--sp-border, #e2e8f0);
    background: rgba(248, 250, 252, 0.45);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: background-color 0.2s ease;
}

html.dark .guide-section-content {
    background: rgba(5, 9, 15, 0.45);
}

.guide-article-link {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--sp-text-muted, #64748b);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--sp-border, rgba(15, 23, 42, 0.05));
    border-radius: 0.75rem;
    background: var(--sp-surface, #ffffff);
    position: relative;
    padding-left: 32px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.01);
}

html.dark .guide-article-link {
    border-color: var(--sp-border, rgba(255, 255, 255, 0.08));
}

.guide-article-link::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--sp-text-dim, #94a3b8);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.guide-article-link:hover {
    color: var(--sp-primary, #6366f1);
    background: var(--sp-surface-hover, #f1f5f9);
    border-color: var(--sp-primary, #6366f1);
    padding-left: 38px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.05);
}

.guide-article-link:hover::before {
    background-color: var(--sp-primary, #6366f1);
    left: 18px;
    transform: translateY(-50%) scale(1.3);
}

.guide-article-link.is-active {
    color: var(--sp-primary, #6366f1);
    background: var(--sp-primary-dim, rgba(99, 102, 241, 0.08));
    border-color: var(--sp-primary, #6366f1);
    font-weight: 700;
    padding-left: 38px;
}

.guide-article-link.is-active::before {
    background-color: var(--sp-primary, #6366f1);
    left: 18px;
    transform: translateY(-50%) scale(1.3);
}

/* Article Cards Grid */
.guide-article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.guide-article-card {
    background: var(--sp-surface, #ffffff);
    border: 1px solid var(--sp-border, #e2e8f0);
    border-radius: var(--radius-lg, 8px);
    padding: 20px;
    text-decoration: none;
    color: var(--sp-text, #1e293b);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}

.guide-article-card:hover {
    transform: translateY(-2px);
    border-color: var(--sp-primary, #6366f1);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.05);
}

.guide-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.guide-card-icon-box {
    width: 36px;
    height: 36px;
    background: var(--sp-primary-dim, rgba(99, 102, 241, 0.05));
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sp-primary, #6366f1);
}

.guide-card-section-name {
    font-size: 0.75rem;
    font-family: var(--font-mono, monospace);
    color: var(--sp-text-muted, #64748b);
    font-weight: bold;
}

.guide-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: var(--sp-text, #1e293b);
    line-height: 1.4;
}

.guide-card-desc {
    font-size: 0.8rem;
    color: var(--sp-text-muted, #64748b);
    margin-bottom: 16px;
    flex: 1;
}

.guide-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--sp-border, #e2e8f0);
}

.guide-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--sp-text-muted, #64748b);
}

/* Tags styling */
.guide-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.guide-tag {
    font-size: 0.7rem;
    font-family: var(--font-mono, monospace);
    background: var(--sp-border, #f1f5f9);
    color: var(--sp-text-muted, #475569);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Breadcrumbs */
.guide-breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.8rem;
    font-family: var(--font-mono, monospace);
    color: var(--sp-text-muted, #64748b);
    margin-bottom: 24px;
}

.guide-breadcrumbs a {
    color: var(--sp-primary, #6366f1);
    text-decoration: none;
}

.guide-breadcrumbs a:hover {
    text-decoration: underline;
}

.guide-breadcrumbs-sep {
    color: var(--sp-border, #cbd5e1);
}

/* Mobile Breadcrumbs Toggle */
@media (max-width: 768px) {
    .guide-breadcrumbs-desktop {
        display: none !important;
    }
    .guide-breadcrumbs-mobile {
        display: flex !important;
    }
}

.guide-breadcrumbs-mobile {
    display: none;
    margin-bottom: 16px;
}

/* Table of Contents (TOC) */
.guide-toc-container {
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
}

.guide-toc {
    background: var(--sp-surface, #ffffff);
    border: 1px solid var(--sp-border, #e2e8f0);
    border-radius: 1rem;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
}

.guide-toc-title {
    font-size: 0.75rem;
    font-family: var(--font-mono, monospace);
    font-weight: 900;
    color: var(--sp-primary, #6366f1);
    margin-top: 0;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.guide-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.guide-toc-item {
    font-size: 0.8rem;
    line-height: 1.4;
}

.guide-toc-item--h3 {
    padding-left: 12px;
    font-size: 0.75rem;
}

.guide-toc-link {
    color: var(--sp-text-muted, #64748b);
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 2px solid transparent;
    padding-left: 10px;
    display: block;
}

.guide-toc-link:hover,
.guide-toc-link.is-active {
    color: var(--sp-primary, #6366f1);
    border-left-color: var(--sp-primary);
    padding-left: 14px;
}

/* Alert icon inline in seed content */
.guide-alert-icon {
    width: 1.1em;
    height: 1.1em;
    display: inline-block;
    vertical-align: middle;
    margin-right: 3px;
    color: var(--sp-warning, #f59e0b);
    flex-shrink: 0;
}

/* Guide tip/warning block in article content */
.guide-tip {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 0;
    font-size: 0.9rem;
}

.guide-tip strong {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--sp-warning, #d97706);
}

/* Article Content Formatting */
.guide-article-body {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--sp-text, #1e293b);
}

.guide-article-body h2 {
    font-family: var(--font-mono, monospace);
    font-size: 1.5rem;
    color: var(--sp-primary, #6366f1);
    margin-top: 32px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--sp-border, #e2e8f0);
    padding-bottom: 8px;
}

.guide-article-body h3 {
    font-family: var(--font-mono, monospace);
    font-size: 1.15rem;
    color: var(--sp-text, #1e293b);
    margin-top: 24px;
    margin-bottom: 12px;
}

.guide-article-body p {
    margin-bottom: 16px;
}

.guide-article-body ul,
.guide-article-body ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.guide-article-body li {
    margin-bottom: 8px;
}

.guide-article-body strong {
    font-weight: 700;
    color: var(--sp-text, #0f172a);
}

/* Scroll to Top Button */
.guide-btn-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--sp-primary, #6366f1);
    color: white !important;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    z-index: 999;
    opacity: 0.9;
    transition: transform 0.2s, opacity 0.2s;
}

.guide-btn-top:hover {
    transform: translateY(-2px);
    opacity: 1;
}

/* Related articles section */
.guide-related-articles {
    border-top: 1px solid var(--sp-border, #e2e8f0);
    margin-top: 48px;
    padding-top: 32px;
}

/* Print Overrides */
@media print {
    .guide-sidebar,
    .guide-toc-container,
    .guide-btn-top,
    .guide-progress-bar,
    .guide-breadcrumbs,
    .guide-related-articles,
    .sp-btn,
    .sp-btn-sm,
    header,
    footer,
    nav {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .sp-card,
    .guide-article-body {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
}

/* Search bar styling */
.guide-search-wrapper {
    position: relative;
    width: 100%;
}

.guide-search-input {
    width: 100%;
    box-sizing: border-box;
    background: var(--sp-surface, #ffffff);
    border: 1px solid var(--sp-border, #e2e8f0);
    border-radius: var(--radius-md, 6px);
    padding: 12px 16px 12px 48px;
    color: var(--sp-text, #1e293b);
    font-size: 0.95rem;
    transition: all 0.15s ease;
}

.guide-search-input:focus {
    border-color: var(--sp-primary, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
}

.guide-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--sp-text-muted, #64748b);
}

/* Mobile Sidebar Overlay */
@media (max-width: 768px) {
    .guide-mobile-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: var(--sp-surface, #ffffff);
        z-index: 1000;
        box-shadow: 4px 0 12px rgba(0,0,0,0.15);
        transition: left 0.3s ease;
        padding: 20px;
        box-sizing: border-box;
    }
    .guide-mobile-sidebar.is-open {
        left: 0;
    }
    .guide-mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 999;
        display: none;
    }
    .guide-mobile-overlay.is-open {
        display: block;
    }
}
