/* ==========================================================================
   Topic OS - Demand Letter Operating System
   Enhances the DL index hub page with Topic OS components
   ========================================================================== */

/* ---------- Shared Variables (inherit from page, provide fallbacks) ---------- */
:root {
    --tos-primary: var(--primary, #2563eb);
    --tos-primary-dark: var(--primary-dark, #1d4ed8);
    --tos-secondary: var(--secondary, #7c3aed);
    --tos-success: var(--success, #10b981);
    --tos-danger: #ef4444;
    --tos-warning: #f59e0b;
    --tos-gray-50: var(--gray-50, #f9fafb);
    --tos-gray-100: var(--gray-100, #f3f4f6);
    --tos-gray-200: var(--gray-200, #e5e7eb);
    --tos-gray-300: var(--gray-300, #d1d5db);
    --tos-gray-400: var(--gray-400, #9ca3af);
    --tos-gray-500: var(--gray-500, #6b7280);
    --tos-gray-600: var(--gray-600, #4b5563);
    --tos-gray-700: var(--gray-700, #374151);
    --tos-gray-800: var(--gray-800, #1f2937);
    --tos-gray-900: var(--gray-900, #111827);
    --tos-radius: 12px;
    --tos-font: 'Inter', -apple-system, sans-serif;
}

/* ---------- A. Assess Your Case Hero Banner ---------- */
.tos-assess-banner {
    background: linear-gradient(135deg, #1e3a5f 0%, #1e293b 50%, #312e81 100%);
    padding: 40px 24px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.tos-assess-inner {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 32px;
}

.tos-gauge-icon {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    position: relative;
}

.tos-gauge-arc {
    width: 80px;
    height: 40px;
    border: 6px solid rgba(255,255,255,0.15);
    border-bottom: none;
    border-radius: 80px 80px 0 0;
    position: relative;
    overflow: hidden;
}

.tos-gauge-arc::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 6px;
    height: 36px;
    background: #22c55e;
    transform-origin: bottom center;
    transform: rotate(40deg);
    border-radius: 3px;
}

.tos-gauge-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 80px;
    height: 40px;
    border: 6px solid transparent;
    border-bottom: none;
    border-radius: 80px 80px 0 0;
    border-color: #ef4444 #f59e0b #22c55e transparent;
    clip-path: inset(0 0 0 0);
}

.tos-gauge-dot {
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 8px rgba(255,255,255,0.5);
}

.tos-gauge-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6rem;
    color: rgba(255,255,255,0.5);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

.tos-assess-text {
    text-align: left;
    flex: 1;
}

.tos-assess-text h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    line-height: 1.3;
}

.tos-assess-text p {
    font-size: 0.95rem;
    color: #94a3b8;
    margin-bottom: 16px;
    line-height: 1.5;
}

.tos-assess-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
}

.tos-assess-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3);
}

@media (max-width: 768px) {
    .tos-assess-inner {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    .tos-assess-text {
        text-align: center;
    }
    .tos-assess-text h2 {
        font-size: 1.2rem;
    }
    .tos-assess-banner {
        padding: 30px 16px;
    }
}

/* ---------- B. Quick Category Browser ---------- */
.tos-category-browser {
    background: var(--tos-gray-50);
    padding: 48px 24px;
    border-bottom: 1px solid var(--tos-gray-200);
}

.tos-category-browser-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.tos-section-header {
    text-align: center;
    margin-bottom: 28px;
}

.tos-section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tos-gray-800);
    margin-bottom: 6px;
}

.tos-section-header p {
    font-size: 0.95rem;
    color: var(--tos-gray-500);
    max-width: 600px;
    margin: 0 auto;
}

.tos-cat-search-wrap {
    max-width: 480px;
    margin: 0 auto 20px;
    position: relative;
}

.tos-cat-search {
    width: 100%;
    padding: 12px 16px 12px 44px;
    font-size: 0.95rem;
    border: 2px solid var(--tos-gray-200);
    border-radius: 10px;
    background: #fff;
    color: var(--tos-gray-800);
    outline: none;
    transition: border-color 0.2s;
    font-family: var(--tos-font);
}

.tos-cat-search:focus {
    border-color: var(--tos-primary);
}

.tos-cat-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tos-gray-400);
    font-size: 1.1rem;
    pointer-events: none;
}

.tos-filter-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.tos-filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border: 2px solid var(--tos-gray-200);
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--tos-gray-600);
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-height: 44px;
    font-family: var(--tos-font);
    text-decoration: none;
}

.tos-filter-chip:hover {
    border-color: var(--tos-primary);
    color: var(--tos-primary);
}

.tos-filter-chip.active {
    background: var(--tos-primary);
    border-color: var(--tos-primary);
    color: #fff;
}

.tos-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.tos-cat-card {
    background: #fff;
    border: 2px solid var(--tos-gray-200);
    border-radius: var(--tos-radius);
    padding: 18px;
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: all 0.2s;
    min-height: 44px;
}

.tos-cat-card:hover {
    border-color: var(--tos-primary);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08);
    transform: translateY(-2px);
}

.tos-cat-card.hidden {
    display: none;
}

.tos-cat-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    background: #dbeafe;
}

.tos-cat-card-body h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--tos-gray-800);
    margin-bottom: 2px;
}

.tos-cat-card-body .tos-cat-count {
    font-size: 0.75rem;
    color: var(--tos-gray-400);
    margin-bottom: 4px;
}

.tos-cat-card-body p {
    font-size: 0.82rem;
    color: var(--tos-gray-500);
    line-height: 1.45;
    margin: 0;
}

.tos-cat-toggle {
    display: none;
    margin: 20px auto 0;
    padding: 12px 24px;
    background: #fff;
    border: 2px solid var(--tos-gray-200);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--tos-primary);
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
    font-family: var(--tos-font);
    text-align: center;
}

.tos-cat-toggle:hover {
    border-color: var(--tos-primary);
    background: #eff6ff;
}

@media (max-width: 768px) {
    .tos-category-browser {
        padding: 32px 16px;
    }
    .tos-cat-grid {
        grid-template-columns: 1fr;
    }
    .tos-cat-toggle {
        display: block;
    }
    .tos-cat-card.tos-mobile-hidden {
        display: none;
    }
    .tos-filter-chips {
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }
}

/* ---------- C. Next Steps Guide ---------- */
.tos-next-steps {
    background: #fff;
    padding: 48px 24px;
    border-bottom: 1px solid var(--tos-gray-200);
}

.tos-next-steps-inner {
    max-width: 800px;
    margin: 0 auto;
}

.tos-accordion-item {
    border: 2px solid var(--tos-gray-200);
    border-radius: var(--tos-radius);
    margin-bottom: 12px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.tos-accordion-item:hover {
    border-color: var(--tos-gray-300);
}

.tos-accordion-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: var(--tos-font);
    min-height: 56px;
    transition: background 0.15s;
}

.tos-accordion-trigger:hover {
    background: var(--tos-gray-50);
}

.tos-accordion-step {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--tos-primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tos-accordion-title {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    color: var(--tos-gray-800);
}

.tos-accordion-arrow {
    font-size: 1.2rem;
    color: var(--tos-gray-400);
    transition: transform 0.3s;
    flex-shrink: 0;
}

.tos-accordion-item.open .tos-accordion-arrow {
    transform: rotate(180deg);
}

.tos-accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.tos-accordion-item.open .tos-accordion-body {
    max-height: 600px;
}

.tos-accordion-content {
    padding: 0 20px 20px 66px;
    font-size: 0.9rem;
    color: var(--tos-gray-600);
    line-height: 1.7;
}

.tos-accordion-content a {
    color: var(--tos-primary);
    text-decoration: none;
    font-weight: 500;
}

.tos-accordion-content a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .tos-next-steps {
        padding: 32px 16px;
    }
    .tos-accordion-content {
        padding-left: 20px;
    }
    .tos-accordion-title {
        font-size: 0.92rem;
    }
}

/* ---------- D. Community Discussions ---------- */
.tos-forum-section {
    background: var(--tos-gray-50);
    padding: 48px 24px;
    border-bottom: 1px solid var(--tos-gray-200);
}

.tos-forum-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.tos-forum-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.tos-forum-card {
    background: #fff;
    border: 2px solid var(--tos-gray-200);
    border-radius: var(--tos-radius);
    padding: 18px;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: all 0.2s;
}

.tos-forum-card:hover {
    border-color: var(--tos-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.tos-forum-card h3 {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--tos-gray-800);
    margin-bottom: 8px;
    line-height: 1.4;
}

.tos-forum-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--tos-gray-400);
}

.tos-forum-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tos-view-all-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--tos-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 10px 0;
    min-height: 44px;
}

.tos-view-all-link:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .tos-forum-section {
        padding: 32px 16px;
    }
    .tos-forum-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- E. Guides & Analysis (Blog) ---------- */
.tos-blog-section {
    background: #fff;
    padding: 48px 24px;
    border-bottom: 1px solid var(--tos-gray-200);
}

.tos-blog-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.tos-blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.tos-blog-card {
    background: var(--tos-gray-50);
    border: 2px solid var(--tos-gray-200);
    border-radius: var(--tos-radius);
    padding: 22px;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: all 0.2s;
}

.tos-blog-card:hover {
    border-color: var(--tos-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.tos-blog-card-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tos-primary);
    background: #eff6ff;
    padding: 4px 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.tos-blog-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--tos-gray-800);
    margin-bottom: 8px;
    line-height: 1.4;
}

.tos-blog-card p {
    font-size: 0.82rem;
    color: var(--tos-gray-500);
    line-height: 1.5;
    margin-bottom: 10px;
}

.tos-blog-card-date {
    font-size: 0.75rem;
    color: var(--tos-gray-400);
}

@media (max-width: 768px) {
    .tos-blog-section {
        padding: 32px 16px;
    }
    .tos-blog-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- F. Attorney Services Panel ---------- */
.tos-attorney-panel {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    padding: 56px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.tos-attorney-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.tos-attorney-header {
    text-align: center;
    margin-bottom: 36px;
}

.tos-attorney-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.tos-attorney-header p {
    color: #94a3b8;
    font-size: 0.95rem;
    max-width: 600px;
    margin: 0 auto;
}

.tos-service-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.tos-service-card {
    background: rgba(255,255,255,0.03);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 28px 22px;
    text-align: left;
    position: relative;
    transition: all 0.3s;
}

.tos-service-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255,255,255,0.2);
}

.tos-service-card.featured {
    border-color: var(--tos-primary);
    background: rgba(37, 99, 235, 0.08);
}

.tos-service-card.featured::before {
    content: 'MOST REQUESTED';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: #fff;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}

.tos-service-tier {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    margin-bottom: 6px;
}

.tos-service-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.tos-service-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: #22c55e;
    margin-bottom: 12px;
}

.tos-service-price span {
    font-size: 0.85rem;
    font-weight: 400;
    color: #64748b;
}

.tos-service-desc {
    font-size: 0.85rem;
    color: #94a3b8;
    line-height: 1.5;
    margin-bottom: 16px;
}

.tos-service-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.tos-service-features li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    color: #cbd5e1;
    font-size: 0.82rem;
}

.tos-service-features .check {
    color: #22c55e;
}

.tos-service-btn {
    display: block;
    width: 100%;
    padding: 13px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
    min-height: 48px;
    cursor: pointer;
    border: none;
    font-family: var(--tos-font);
}

.tos-service-btn.primary {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: #fff;
}

.tos-service-btn.secondary {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
}

.tos-service-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.tos-attorney-badge {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.tos-attorney-badge p {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 6px;
    line-height: 1.5;
    font-style: italic;
}

.tos-attorney-badge .tos-bar-number {
    font-size: 0.75rem;
    color: #64748b;
}

.tos-attorney-badge .tos-bar-number a {
    color: #60a5fa;
    text-decoration: none;
}

.tos-attorney-badge .tos-bar-number a:hover {
    text-decoration: underline;
}

@media (max-width: 900px) {
    .tos-service-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .tos-attorney-panel {
        padding: 40px 16px;
    }
}

/* ---------- G. Mega-FAQ Accordion ---------- */
.tos-faq-section {
    background: var(--tos-gray-50);
    padding: 48px 24px;
    border-bottom: 1px solid var(--tos-gray-200);
}

.tos-faq-inner {
    max-width: 800px;
    margin: 0 auto;
}

.tos-faq-item {
    border: 2px solid var(--tos-gray-200);
    border-radius: var(--tos-radius);
    margin-bottom: 10px;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.2s;
}

.tos-faq-item:hover {
    border-color: var(--tos-gray-300);
}

.tos-faq-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 20px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: var(--tos-font);
    min-height: 56px;
    transition: background 0.15s;
}

.tos-faq-trigger:hover {
    background: var(--tos-gray-50);
}

.tos-faq-trigger h3 {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--tos-gray-800);
    margin: 0;
}

.tos-faq-arrow {
    font-size: 1.2rem;
    color: var(--tos-gray-400);
    transition: transform 0.3s;
    flex-shrink: 0;
}

.tos-faq-item.open .tos-faq-arrow {
    transform: rotate(180deg);
}

.tos-faq-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.tos-faq-item.open .tos-faq-body {
    max-height: 800px;
}

.tos-faq-answer {
    padding: 0 20px 20px;
    font-size: 0.9rem;
    color: var(--tos-gray-600);
    line-height: 1.7;
}

.tos-faq-answer a {
    color: var(--tos-primary);
    text-decoration: none;
    font-weight: 500;
}

.tos-faq-answer a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .tos-faq-section {
        padding: 32px 16px;
    }
    .tos-faq-trigger h3 {
        font-size: 0.88rem;
    }
}

/* ---------- Utility: No Horizontal Scroll ---------- */
.tos-assess-banner,
.tos-category-browser,
.tos-next-steps,
.tos-forum-section,
.tos-blog-section,
.tos-attorney-panel,
.tos-faq-section {
    overflow-x: hidden;
}
