/*
 * 75 Soft Challenge - Component Styles
 * Vanilla CSS conversion of Shadcn/Radix components
 */

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    outline: none;
    text-decoration: none;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

.btn:disabled {
    pointer-events: none;
    opacity: 0.5;
}

/* Button Variants */
.btn-primary {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    padding: 0.625rem 1.25rem;
}

.btn-primary:hover {
    background-color: hsl(var(--primary) / 0.9);
}

.btn-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    padding: 0.625rem 1.25rem;
}

.btn-secondary:hover {
    background-color: hsl(var(--secondary) / 0.8);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid hsl(var(--border));
    color: hsl(var(--foreground));
    padding: 0.625rem 1.25rem;
}

.btn-outline:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.btn-ghost {
    background-color: transparent;
    color: hsl(var(--foreground));
    padding: 0.625rem 1.25rem;
}

.btn-ghost:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.btn-link {
    background-color: transparent;
    color: hsl(var(--primary));
    text-decoration: underline;
    text-underline-offset: 4px;
    padding: 0;
}

.btn-link:hover {
    color: hsl(var(--primary) / 0.8);
}

/* Button Sizes */
.btn-sm {
    height: 2.25rem;
    padding: 0 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    height: 2.75rem;
    padding: 0 2rem;
    font-size: 1rem;
}

.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
}

/* ========================================
   CARDS
   ======================================== */
.card {
    background-color: hsl(var(--card));
    color: hsl(var(--card-foreground));
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.card-header {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 1.5rem;
}

.card-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.025em;
}

.card-description {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.card-content {
    padding: 1.5rem;
    padding-top: 0;
}

.card-footer {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    padding-top: 0;
}

/* Card with hover effect */
.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

/* Article card variant */
.card-article {
    overflow: hidden;
}

.card-article-image {
    width: 100%;
    height: 12rem;
    object-fit: cover;
}

.card-article-content {
    padding: 1.25rem;
}

.card-article-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: hsl(var(--foreground));
}

.card-article-description {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    line-height: 1.5;
}

/* ========================================
   BADGES
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    transition: colors 0.2s ease;
}

.badge-primary {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.badge-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}

.badge-outline {
    background-color: transparent;
    border: 1px solid hsl(var(--border));
    color: hsl(var(--foreground));
}

.badge-sage {
    background-color: hsl(var(--sage-light));
    color: hsl(var(--sage-dark));
}

.badge-rose {
    background-color: hsl(var(--rose));
    color: hsl(var(--rose-dark));
}

/* ========================================
   ACCORDION
   ======================================== */
.accordion {
    width: 100%;
}

.accordion-item {
    border-bottom: 1px solid hsl(var(--border));
}

.accordion-trigger {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1rem;
    font-weight: 500;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    color: hsl(var(--foreground));
}

.accordion-trigger:hover {
    text-decoration: underline;
}

.accordion-trigger[aria-expanded="true"] .accordion-chevron {
    transform: rotate(180deg);
}

.accordion-chevron {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.accordion-content {
    overflow: hidden;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    max-height: 0;
    transition: max-height 0.3s ease;
}

.accordion-content.open {
    max-height: 1000px;
}

.accordion-content-inner {
    padding-bottom: 1rem;
    line-height: 1.75;
}

/* ========================================
   TABLES
   ======================================== */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

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

.table caption {
    margin-bottom: 1rem;
    text-align: left;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.table thead {
    border-bottom: 1px solid hsl(var(--border));
}

.table th {
    height: 3rem;
    padding: 0.5rem 1rem;
    text-align: left;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    white-space: nowrap;
}

.table td {
    padding: 1rem;
    vertical-align: middle;
}

.table tbody tr {
    border-bottom: 1px solid hsl(var(--border));
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: hsl(var(--muted) / 0.5);
}

.table tfoot {
    border-top: 1px solid hsl(var(--border));
    background-color: hsl(var(--muted) / 0.5);
    font-weight: 500;
}

/* Comparison Table specific */
.comparison-table {
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid hsl(var(--border));
}

.comparison-table th {
    background-color: hsl(var(--secondary));
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.comparison-table td {
    background-color: hsl(var(--background));
}

.comparison-table tr:nth-child(even) td {
    background-color: hsl(var(--muted) / 0.3);
}

/* Check/X marks for comparison tables */
.check-icon {
    color: hsl(var(--sage));
    font-size: 1.25rem;
}

.x-icon {
    color: hsl(var(--rose-dark));
    font-size: 1.25rem;
}

/* ========================================
   FORMS
   ======================================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: hsl(var(--foreground));
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--background));
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: hsl(var(--muted-foreground));
}

.form-textarea {
    min-height: 6rem;
    resize: vertical;
}

.form-error {
    font-size: 0.75rem;
    color: hsl(var(--destructive));
    margin-top: 0.375rem;
}

.form-hint {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.375rem;
}

/* Checkbox & Radio */
.form-checkbox,
.form-radio {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-checkbox input,
.form-radio input {
    width: 1rem;
    height: 1rem;
    accent-color: hsl(var(--primary));
    cursor: pointer;
}

/* ========================================
   SEPARATOR
   ======================================== */
.separator {
    background-color: hsl(var(--border));
}

.separator-horizontal {
    height: 1px;
    width: 100%;
}

.separator-vertical {
    width: 1px;
    height: 100%;
}

/* ========================================
   HIGHLIGHT BOX
   ======================================== */
.highlight-box {
    background-color: hsl(var(--sage-light));
    border-left: 4px solid hsl(var(--sage));
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.highlight-box-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: hsl(var(--sage-dark));
}

.highlight-box-content {
    color: hsl(var(--foreground));
    line-height: 1.75;
}

/* Rose variant */
.highlight-box-rose {
    background-color: hsl(var(--rose));
    border-left-color: hsl(var(--rose-dark));
}

.highlight-box-rose .highlight-box-title {
    color: hsl(var(--rose-dark));
}

/* ========================================
   PULL QUOTE
   ======================================== */
.pull-quote {
    border-left: 4px solid hsl(var(--primary) / 0.3);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    font-size: 1.25rem;
    color: hsl(var(--muted-foreground));
}

.pull-quote cite {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.875rem;
    font-style: normal;
    color: hsl(var(--muted-foreground));
}

/* ========================================
   ARTICLE SUMMARY BOX
   ======================================== */
/* ========================================
   ARTICLE SUMMARY (INTERACTIVE)
   ======================================== */
.article-summary {
    margin-bottom: 2rem;
}

.summary-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.summary-grid {
    display: grid;
    gap: 1rem;
}

.summary-card {
    background-color: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.summary-card:hover {
    border-color: hsl(var(--primary));
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.summary-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.summary-icon {
    font-size: 1.25rem;
}

/* Mobile: Stack vertically */
@media (max-width: 479px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .summary-card {
        padding: 1rem;
    }
}

/* Tablet: 2 columns */
@media (min-width: 480px) and (max-width: 767px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .summary-card {
        padding: 1.25rem;
    }
}

/* Desktop: 3 columns */
@media (min-width: 768px) {
    .summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .summary-card {
        padding: 1.5rem;
    }
}

/* ========================================
   TLDR BOX
   ======================================== */
.tldr-box {
    background: hsl(var(--muted));
    border-left: 4px solid hsl(var(--accent));
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 2rem 0;
}

.tldr-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.tldr-icon {
    font-size: 1.5rem;
}

.tldr-box h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
}

.tldr-content p {
    margin-bottom: 1rem;
    font-size: 1rem;
    line-height: 1.6;
}

.tldr-actions {
    display: flex;
    gap: 0.75rem;
}

.tldr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    background: hsl(var(--background));
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 0.5rem;
}

.tldr-btn:hover {
    background: hsl(var(--secondary));
    border-color: hsl(var(--accent));
}

/* Mobile Tldr Responsive */
@media (max-width: 479px) {
    .tldr-box {
        padding: 1rem;
        margin: 1.5rem -16px;
        /* Full bleed on mobile */
        border-radius: 0;
    }

    .tldr-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .tldr-btn {
        width: 100%;
    }
}

/* Tablet */
@media (min-width: 480px) and (max-width: 767px) {
    .tldr-box {
        padding: 1.25rem;
    }

    .tldr-actions {
        flex-direction: row;
        gap: 0.75rem;
    }
}

/* Desktop */
@media (min-width: 768px) {
    .tldr-box {
        padding: 1.5rem 2rem;
    }

    .tldr-actions {
        flex-direction: row;
        gap: 1rem;
    }
}

/* ========================================
   TABLE OF CONTENTS (DROPDOWN)
   ======================================== */
.toc-dropdown {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin: 1.5rem 0;
    border: 1px solid hsl(var(--border));
}

.toc-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    cursor: pointer;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
    list-style: none;
    /* Hide default triangle */
}

.toc-summary::-webkit-details-marker {
    display: none;
}

.toc-icon {
    transition: transform 0.2s ease;
}

details[open] .toc-icon {
    transform: rotate(180deg);
}

.toc-content {
    border-top: 1px solid hsl(var(--border));
    padding: 1rem;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    margin-bottom: 0.5rem;
}

.toc-link {
    display: block;
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.toc-link:hover {
    color: hsl(var(--primary));
    background-color: hsl(var(--secondary));
}

/* Responsive TOC */
@media (max-width: 479px) {
    .toc-dropdown {
        margin: 1rem -16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

@media (min-width: 480px) {
    .toc-dropdown {
        max-width: 400px;
    }
}

/* ========================================
   RELATED ARTICLES GRID
   ======================================== */
.related-articles {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid hsl(var(--border));
}

.related-articles-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: hsl(var(--foreground));
}

.related-articles-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .related-articles-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .related-articles-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ========================================
   SOURCES LIST
   ======================================== */
.sources-list {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid hsl(var(--border));
}

.sources-list-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: hsl(var(--foreground));
}

.sources-list ol {
    list-style: decimal;
    padding-left: 1.5rem;
}

.sources-list li {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.sources-list a {
    color: hsl(var(--primary));
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero {
    position: relative;
    padding: 0;
    overflow: hidden;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 768px) {
    .hero {
        min-height: 400px;
    }
}

@media (min-width: 1024px) {
    .hero {
        min-height: 500px;
        justify-content: flex-start;
        padding: 4rem 0;
    }

    .hero .container {
        width: 100%;
    }
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: -1;
}

.hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 48rem;
    margin: 0 auto;
}

.hero-badge {
    display: inline-block;
    margin-bottom: 1rem;
}

.hero-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: hsl(var(--foreground));
    line-height: 1.1;
}

@media (min-width: 768px) {
    .hero-title {
        font-size: 3rem;
    }
}

@media (min-width: 1024px) {
    .hero-title {
        font-size: 3.5rem;
    }
}

.hero-subtitle {
    font-size: 1.125rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 2rem;
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
}

.hero-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.hero-meta-divider {
    width: 4px;
    height: 4px;
    background-color: hsl(var(--border));
    border-radius: 50%;
}

/* ========================================
   NAVIGATION COMPONENTS
   ======================================== */
.nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: calc(var(--radius) - 2px);
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: hsl(var(--foreground));
    background-color: hsl(var(--secondary));
}

.nav-link.active {
    color: hsl(var(--primary));
    background-color: hsl(var(--sage-light));
}

/* ========================================
   BACK TO TOP BUTTON
   ======================================== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    z-index: 50;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: hsl(var(--sage-dark));
    transform: translateY(-2px);
}

.back-to-top svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* ========================================
   TABS
   ======================================== */
.tabs {
    width: 100%;
}

.tabs-list {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: hsl(var(--muted));
    border-radius: var(--radius);
    padding: 0.25rem;
}

.tabs-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border-radius: calc(var(--radius) - 2px);
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tabs-trigger:hover {
    color: hsl(var(--foreground));
}

.tabs-trigger.active {
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.tabs-content {
    margin-top: 0.5rem;
}

.tabs-panel {
    display: none;
}

.tabs-panel.active {
    display: block;
}

/* ========================================
   ALERT / CALLOUT
   ======================================== */
.alert {
    position: relative;
    padding: 1rem;
    border-radius: var(--radius);
    display: flex;
    gap: 0.75rem;
}

.alert-icon {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    margin-top: 0.125rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.alert-description {
    font-size: 0.875rem;
}

.alert-default {
    background-color: hsl(var(--secondary));
    color: hsl(var(--foreground));
}

.alert-destructive {
    background-color: hsl(var(--destructive) / 0.1);
    border: 1px solid hsl(var(--destructive) / 0.3);
    color: hsl(var(--destructive));
}

/* ========================================
   SKELETON / LOADING STATE
   ======================================== */
.skeleton {
    background-color: hsl(var(--muted));
    border-radius: var(--radius);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ========================================
   TOOLTIP
   ======================================== */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip-content {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 0.5rem;
    padding: 0.375rem 0.75rem;
    background-color: hsl(var(--foreground));
    color: hsl(var(--background));
    font-size: 0.75rem;
    border-radius: calc(var(--radius) - 2px);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 50;
}

.tooltip:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   PROGRESS BAR
   ======================================== */
.progress {
    position: relative;
    height: 0.75rem;
    width: 100%;
    overflow: hidden;
    border-radius: 9999px;
    background-color: hsl(var(--secondary));
}

.progress-bar {
    height: 100%;
    width: 0;
    background-color: hsl(var(--primary));
    transition: width 0.3s ease;
}