/* ═══════════════════════════════════════════════════════════
   tenderTabBar.css — Tab Bar + Tender Detail View styles
   ProstyPrzetarg.pl
   ═══════════════════════════════════════════════════════════ */

/* ─── Tab Bar ─────────────────────────────────────────────── */
.tab-bar {
    display: flex;
    align-items: center;
    background: var(--bg-card, #fff);
    border-bottom: 1px solid var(--border, #e5e7eb);
    padding: 0 8px;
    min-height: 36px;
    overflow-x: auto;
    scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-bar-tabs {
    display: flex;
    gap: 2px;
    align-items: center;
}

.tab-bar-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.15s;
    background: transparent;
    font-family: inherit;
}

.tab-bar-tab:hover {
    background: var(--bg-warm, #f9fafb);
    color: var(--text-primary, #111827);
}

.tab-bar-tab.active {
    background: var(--bg-card, #fff);
    color: var(--text-primary, #111827);
    font-weight: 600;
    border-color: var(--border, #e5e7eb);
    position: relative;
}

.tab-bar-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--bg-card, #fff);
}

.tab-bar-tab i {
    font-size: 11px;
    flex-shrink: 0;
}

.tab-bar-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-bar-close {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: none;
    background: transparent;
    color: var(--text-secondary, #9ca3af);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}
.tab-bar-close:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* ─── Tender Detail View (inside #tenderTabContent) ───────── */
.tv-detail {
    max-width: 100%;
    margin: 0;
    padding: 24px 32px 60px;
}

/* Header */
.tv-header {
    margin-bottom: 20px;
}

.tv-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary, #111827);
    line-height: 1.3;
    margin: 0 0 10px 0;
}

.tv-header-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tv-meta-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.tv-badge-red { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.tv-badge-orange { background: #fff7ed; color: #ea580c; border: 1px solid #fed7aa; }
.tv-badge-yellow { background: #fefce8; color: #ca8a04; border: 1px solid #fef08a; }
.tv-badge-green { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.tv-badge-gray { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }

.tv-meta-type {
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
}

.tv-source-link {
    font-size: 12px;
    color: #6366f1;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.tv-source-link:hover { text-decoration: underline; }

/* Quick Facts */
.tv-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.tv-fact {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: var(--bg-warm, #f9fafb);
    border-radius: 8px;
    border: 1px solid var(--border, #e5e7eb);
}

.tv-fact-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #ede9fe;
    color: #7c3aed;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.tv-fact-label {
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tv-fact-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #111827);
    word-break: break-word;
}

.tv-distance-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 8px;
    background: #dbeafe;
    color: #2563eb;
    font-size: 11px;
    font-weight: 500;
}

/* Details Grid */
.tv-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
    padding: 14px;
    background: var(--bg-warm, #f9fafb);
    border-radius: 8px;
    border: 1px solid var(--border, #e5e7eb);
}

.tv-detail-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tv-detail-label {
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tv-detail-value {
    font-size: 13px;
    color: var(--text-primary, #111827);
    font-weight: 500;
}

/* Description */
.tv-description {
    margin-bottom: 20px;
}

.tv-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #111827);
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tv-section-title i {
    color: #7c3aed;
    font-size: 13px;
}

.tv-desc-text,
.tv-desc-full {
    font-size: 13px;
    color: var(--text-secondary, #374151);
    line-height: 1.6;
    white-space: pre-wrap;
}

.tv-desc-toggle {
    background: none;
    border: none;
    color: #6366f1;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
}
.tv-desc-toggle:hover { text-decoration: underline; }

/* AI Analysis Banner */
.tv-ki-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    border: 1px solid #ddd6fe;
    border-radius: 10px;
    margin-bottom: 20px;
}

.tv-ki-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #7c3aed;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.tv-ki-body { flex: 1; }

.tv-ki-title {
    font-size: 14px;
    font-weight: 600;
    color: #4c1d95;
}

.tv-ki-subtitle {
    font-size: 12px;
    color: #6d28d9;
    margin-top: 2px;
}

.tv-ki-btn {
    padding: 8px 16px;
    background: #7c3aed;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: background 0.2s;
}
.tv-ki-btn:hover { background: #6d28d9; }

/* AI Result */
.tv-ki-result {
    border: 1px solid #ddd6fe;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
}

.tv-ki-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f5f3ff;
    font-size: 13px;
    font-weight: 600;
    color: #4c1d95;
}

.tv-ki-refresh {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 2px;
}

.tv-ki-result-content {
    padding: 14px;
}

.tv-ki-result-meta {
    display: flex;
    gap: 14px;
    padding: 8px 14px;
    background: #faf5ff;
    font-size: 11px;
    color: #7c3aed;
    border-top: 1px solid #ede9fe;
}

.tv-ki-text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary, #111827);
}

.tv-ki-text pre {
    background: #f3f4f6;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 12px;
}

/* Sections */
.tv-sections {
    margin-bottom: 20px;
}

.tv-sections-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.tv-view-toggle {
    display: flex;
    gap: 4px;
}

.tv-view-btn {
    padding: 5px 10px;
    font-size: 12px;
    background: var(--bg-warm, #f3f4f6);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary, #6b7280);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
}
.tv-view-btn.active {
    background: #7c3aed;
    color: white;
    border-color: #7c3aed;
}
.tv-view-btn:hover:not(.active) {
    background: #e5e7eb;
}

/* Accordion */
.tv-accordion {
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    margin-bottom: 6px;
    overflow: hidden;
}

.tv-accordion-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    background: var(--bg-warm, #f9fafb);
    transition: background 0.15s;
    user-select: none;
}
.tv-accordion-header:hover { background: #f3f4f6; }
.tv-accordion-header.open { background: #f0f0ff; }

.tv-accordion-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #7c3aed;
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tv-accordion-title {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #111827);
}

.tv-accordion-count {
    font-size: 11px;
    color: var(--text-secondary, #9ca3af);
    background: #e5e7eb;
    padding: 1px 7px;
    border-radius: 10px;
}

.tv-accordion-arrow {
    color: #9ca3af;
    font-size: 11px;
    transition: transform 0.2s;
}

.tv-accordion-body {
    padding: 12px 14px;
    border-top: 1px solid var(--border, #e5e7eb);
}

.tv-field {
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}
.tv-field:last-child { border-bottom: none; }

.tv-field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 3px;
}

.tv-field-num {
    color: #7c3aed;
    font-weight: 700;
    margin-right: 4px;
}

.tv-field-value {
    font-size: 13px;
    color: var(--text-primary, #111827);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Volltext view */
.tv-volltext-section {
    margin-bottom: 20px;
}

.tv-volltext-title {
    font-size: 14px;
    font-weight: 700;
    color: #4c1d95;
    padding: 8px 0;
    border-bottom: 2px solid #7c3aed;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tv-vt-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #7c3aed;
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tv-volltext-field {
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
}

.tv-volltext-field-label {
    font-size: 12px;
    font-weight: 600;
    color: #7c3aed;
    margin-bottom: 2px;
}

.tv-volltext-field-value {
    font-size: 13px;
    color: var(--text-primary, #111827);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* No data / Loading */
.tv-no-data {
    font-size: 13px;
    color: var(--text-secondary, #9ca3af);
    text-align: center;
    padding: 16px;
    font-style: italic;
}

.tv-loading {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary, #6b7280);
}

.tv-loading .spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #e5e7eb;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: tv-spin 0.7s linear infinite;
    margin: 0 auto 10px;
}

.tv-loading p {
    font-size: 13px;
    margin: 4px 0;
}

.tv-hint {
    font-size: 11px;
    color: #9ca3af;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: tv-spin 0.7s linear infinite;
}

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

/* Footer Actions */
.tv-actions {
    display: flex;
    gap: 8px;
    padding: 14px 0;
    border-top: 1px solid var(--border, #e5e7eb);
    margin-top: 20px;
    flex-wrap: wrap;
}

.tv-action-btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border, #e5e7eb);
    background: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    transition: all 0.15s;
    color: var(--text-primary, #111827);
}
.tv-action-btn:hover { background: #f3f4f6; }

.tv-action-calendar:hover { border-color: #7c3aed; color: #7c3aed; }
.tv-action-watch:hover { border-color: #eab308; color: #ca8a04; }
.tv-action-hide:hover { border-color: #ef4444; color: #dc2626; }

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .tv-detail {
        padding: 16px 12px 40px;
    }

    .tv-title {
        font-size: 1.1rem;
    }

    .tv-facts {
        grid-template-columns: 1fr;
    }

    .tv-details-grid {
        grid-template-columns: 1fr;
    }

    .tab-bar-tab {
        max-width: 140px;
        padding: 5px 8px;
        font-size: 11px;
    }

    .tv-sections-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ─── Dark Mode ───────────────────────────────────────────── */
body.dark-theme .tab-bar {
    background: #1a1a2e;
    border-bottom-color: #2a2a3e;
}

body.dark-theme .tab-bar-tab {
    color: #9ca3af;
}

body.dark-theme .tab-bar-tab:hover {
    background: #252540;
    color: #e5e7eb;
}

body.dark-theme .tab-bar-tab.active {
    background: #1a1a2e;
    color: #f3f4f6;
    border-color: #2a2a3e;
}

body.dark-theme .tab-bar-tab.active::after {
    background: #1a1a2e;
}

body.dark-theme .tab-bar-close:hover {
    background: #4a1a1a;
    color: #ef4444;
}

/* Header & title */
body.dark-theme .tv-title {
    color: #f3f4f6;
}

body.dark-theme .tv-meta-type {
    color: #9ca3af;
}

body.dark-theme .tv-source-link {
    color: #a78bfa;
}

/* Badges in dark */
body.dark-theme .tv-badge-red { background: #3b1111; color: #f87171; border-color: #5c1d1d; }
body.dark-theme .tv-badge-orange { background: #3b2106; color: #fb923c; border-color: #5c3510; }
body.dark-theme .tv-badge-yellow { background: #3b3006; color: #facc15; border-color: #5c4a10; }
body.dark-theme .tv-badge-green { background: #0b2e1a; color: #4ade80; border-color: #164a2e; }
body.dark-theme .tv-badge-gray { background: #1f2937; color: #9ca3af; border-color: #374151; }

/* Quick Facts */
body.dark-theme .tv-fact {
    background: #1e1e32;
    border-color: #2a2a3e;
}

body.dark-theme .tv-fact-icon {
    background: #2d1b69;
    color: #a78bfa;
}

body.dark-theme .tv-fact-label {
    color: #9ca3af;
}

body.dark-theme .tv-fact-value {
    color: #e5e7eb;
}

body.dark-theme .tv-distance-badge {
    background: #1e3a5f;
    color: #60a5fa;
}

/* Details Grid */
body.dark-theme .tv-details-grid {
    background: #1e1e32;
    border-color: #2a2a3e;
}

body.dark-theme .tv-detail-label {
    color: #9ca3af;
}

body.dark-theme .tv-detail-value {
    color: #e5e7eb;
}

/* Description */
body.dark-theme .tv-section-title {
    color: #f3f4f6;
}

body.dark-theme .tv-desc-text,
body.dark-theme .tv-desc-full {
    color: #d1d5db;
}

body.dark-theme .tv-desc-toggle {
    color: #a78bfa;
}

/* AI Analysis Banner */
body.dark-theme .tv-ki-banner {
    background: linear-gradient(135deg, #1e1b3a, #2d1b69);
    border-color: #3b2d7a;
}

body.dark-theme .tv-ki-title {
    color: #c4b5fd;
}

body.dark-theme .tv-ki-subtitle {
    color: #a78bfa;
}

/* AI Result */
body.dark-theme .tv-ki-result {
    border-color: #3b2d7a;
}

body.dark-theme .tv-ki-result-header {
    background: #1e1b3a;
    color: #c4b5fd;
}

body.dark-theme .tv-ki-result-content {
    background: #141425;
}

body.dark-theme .tv-ki-result-meta {
    background: #1a1830;
    color: #a78bfa;
    border-top-color: #2d1b69;
}

body.dark-theme .tv-ki-text {
    color: #e5e7eb;
}

body.dark-theme .tv-ki-text pre {
    background: #1e1e32;
    color: #d1d5db;
}

/* Sections */
body.dark-theme .tv-accordion {
    border-color: #2a2a3e;
}

body.dark-theme .tv-accordion-header {
    background: #1e1e32;
}

body.dark-theme .tv-accordion-header:hover {
    background: #252540;
}

body.dark-theme .tv-accordion-header.open {
    background: #1e1b3a;
}

body.dark-theme .tv-accordion-title {
    color: #e5e7eb;
}

body.dark-theme .tv-accordion-count {
    background: #374151;
    color: #9ca3af;
}

body.dark-theme .tv-accordion-body {
    border-top-color: #2a2a3e;
    background: #141425;
}

body.dark-theme .tv-field {
    border-bottom-color: #1e1e32;
}

body.dark-theme .tv-field-label {
    color: #9ca3af;
}

body.dark-theme .tv-field-value {
    color: #d1d5db;
}

/* Volltext view */
body.dark-theme .tv-volltext-title {
    color: #c4b5fd;
    border-bottom-color: #7c3aed;
}

body.dark-theme .tv-volltext-field {
    border-bottom-color: #1e1e32;
}

body.dark-theme .tv-volltext-field-value {
    color: #d1d5db;
}

/* View toggle buttons */
body.dark-theme .tv-view-btn {
    background: #1e1e32;
    border-color: #2a2a3e;
    color: #9ca3af;
}

body.dark-theme .tv-view-btn:hover:not(.active) {
    background: #252540;
}

/* Footer action buttons */
body.dark-theme .tv-action-btn {
    background: #1e1e32;
    border-color: #2a2a3e;
    color: #e5e7eb;
}

body.dark-theme .tv-action-btn:hover {
    background: #252540;
}

/* Loading & no data */
body.dark-theme .tv-no-data {
    color: #6b7280;
}

body.dark-theme .tv-loading {
    color: #9ca3af;
}

body.dark-theme .tv-loading .spinner {
    border-color: #374151;
    border-top-color: #7c3aed;
}
