/**
 * YTFlash - Tools Specific Styling
 * Result cards, download tables, AI markdown outputs, tag clouds, thumbnail cards.
 */

.tool-view-header {
    text-align: center;
    margin: 40px auto 30px;
    max-width: 780px;
}

.tool-view-header .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--badge-bg);
    color: var(--badge-text);
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.tool-view-header h1 {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 10px;
}

.tool-view-header p {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

/* -------------------------------------------------------------
 * RESULTS CONTAINER
 * ------------------------------------------------------------- */
.result-container {
    max-width: 900px;
    margin: 40px auto 0;
    display: none; /* Shown dynamically via JS */
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 28px;
    margin-bottom: 30px;
}

/* Video Header Card in Result */
.video-meta-summary {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 24px;
}

.video-thumb-preview {
    position: relative;
    width: 220px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.video-thumb-preview img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.video-duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.video-details-col {
    flex: 1;
}

.video-result-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.video-channel-row {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.video-stats-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-muted);
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* -------------------------------------------------------------
 * DOWNLOAD FORMATS TABLE
 * ------------------------------------------------------------- */
.formats-table {
    width: 100%;
    border-collapse: collapse;
}

.formats-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
}

.formats-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.95rem;
    color: var(--text-primary);
    vertical-align: middle;
}

.formats-table tr:last-child td {
    border-bottom: none;
}

.format-badge {
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--badge-bg);
    color: var(--brand-primary);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    margin-left: 8px;
}

.btn-download-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--brand-gradient);
    color: #fff;
    padding: 8px 18px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--trans-fast);
    box-shadow: 0 2px 8px var(--brand-glow);
}

.btn-download-action:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* -------------------------------------------------------------
 * AI MARKDOWN OUTPUT STYLING
 * ------------------------------------------------------------- */
.ai-output-box {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 0.98rem;
    max-height: 600px;
    overflow-y: auto;
}

.ai-output-box h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--brand-primary);
    margin: 20px 0 10px;
}

.ai-output-box h3:first-child {
    margin-top: 0;
}

.ai-output-box p {
    margin-bottom: 12px;
}

.ai-output-box ul, .ai-output-box ol {
    margin: 10px 0 16px 24px;
}

.ai-output-box li {
    margin-bottom: 8px;
}

.ai-output-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

/* -------------------------------------------------------------
 * TAGS CLOUD
 * ------------------------------------------------------------- */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.tag-chip {
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--trans-fast);
}

.tag-chip:hover {
    background: var(--badge-bg);
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

/* -------------------------------------------------------------
 * THUMBNAIL DOWNLOAD CARDS
 * ------------------------------------------------------------- */
.thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.thumb-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.thumb-card-img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #000;
}

.thumb-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.thumb-card-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.thumb-card-res {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

/* -------------------------------------------------------------
 * LOADING SPINNER & STATES
 * ------------------------------------------------------------- */
.loading-indicator {
    display: none;
    text-align: center;
    padding: 50px 0;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message-box {
    display: none;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    margin: 20px auto;
    max-width: 820px;
    text-align: center;
    font-size: 0.95rem;
}

/* -------------------------------------------------------------
 * RESPONSIVENESS FOR TOOLS
 * ------------------------------------------------------------- */
@media (max-width: 640px) {
    .video-meta-summary {
        flex-direction: column;
    }
    
    .video-thumb-preview {
        width: 100%;
    }
    
    .formats-table th:nth-child(2),
    .formats-table td:nth-child(2) {
        display: none;
    }
}

/* -------------------------------------------------------------
 * ARTICLE & INFORMATIONAL CONTENT STYLES
 * ------------------------------------------------------------- */
.page-article-container {
    max-width: 920px;
    margin: 60px auto 40px;
    padding: 0 16px;
}

.article-section {
    margin-bottom: 48px;
}

.article-h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.4rem, 3vw, 1.85rem);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.article-h2 i {
    color: var(--brand-primary);
    font-size: 1.2rem;
}

.article-lead {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.75;
    margin-bottom: 24px;
}

.article-steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin: 28px 0;
}

.article-step-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    position: relative;
    transition: transform var(--trans-fast), box-shadow var(--trans-fast);
}

.article-step-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: rgba(239, 68, 68, 0.3);
}

.step-num-pill {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-pill);
    background: var(--brand-gradient);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: 14px;
    box-shadow: 0 4px 12px var(--brand-glow);
}

.step-card-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.step-card-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.article-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin: 28px 0;
}

.article-feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 22px;
    transition: all var(--trans-fast);
}

.article-feature-card:hover {
    border-color: var(--border-color);
    background: var(--bg-muted);
}

.feature-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: rgba(239, 68, 68, 0.12);
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 14px;
}

.article-faq-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 24px 0;
}

.article-faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    transition: border-color var(--trans-fast);
}

.article-faq-item:hover {
    border-color: var(--border-color);
}

.article-faq-q {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.article-faq-q i {
    color: var(--brand-primary);
    font-size: 0.95rem;
}

.article-faq-a {
    color: var(--text-secondary);
    font-size: 0.94rem;
    line-height: 1.65;
}

.article-callout-box {
    background: var(--bg-input);
    border-left: 4px solid var(--brand-primary);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin: 28px 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}

