/* ================================================================
   Yedidya Analyzer – עיצוב
   ================================================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    padding: 12px;
    direction: rtl;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: #1e2937;
    border-radius: 28px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #16294a 0%, #1e5799 55%, #2e9bf6 100%);
    padding: 24px 24px;
}

.brand-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    flex-wrap: wrap;
    max-width: 1100px;
    margin: 0 auto;
}

.brand-logo-chip {
    background: #ffffff;
    border-radius: 18px;
    padding: 10px 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    flex: 0 0 auto;
}

.brand-logo-chip img {
    height: 84px;
    display: block;
}

.brand-text {
    text-align: right;
}

.brand-text h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.brand-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #bfe0ff;
    margin-top: 2px;
}

.brand-sep {
    color: #7cc0ff;
    margin: 0 4px;
}

.brand-sub {
    opacity: 0.85;
    font-size: 0.85rem;
    margin-top: 4px;
}

@media (max-width: 700px) {
    .brand-row { gap: 12px; }
    .brand-logo-chip img { height: 56px; }
    .brand-text { text-align: center; }
}

/* ---------- העלאת קבצים ---------- */

.upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    padding: 20px;
}

.upload-card {
    background: #1e2937;
    border: 2px dashed #475569;
    border-radius: 16px;
    padding: 20px 12px;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
}

.upload-card:hover,
.upload-card.dragover {
    border-color: #60a5fa;
    background: #2d3a4f;
}

.upload-card label {
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    display: block;
}

.upload-card input {
    display: none;
}

.upload-card .hint {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 4px;
}

body.dragover .upload-card {
    border-color: #22c55e;
}

/* ---------- לוג ---------- */

.log-area {
    background: #0f172a;
    padding: 12px 16px;
    border-radius: 12px;
    max-height: 180px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.75rem;
    color: #60a5fa;
    margin: 0 20px 20px 20px;
    border: 1px solid #334155;
}

.log-entry {
    padding: 2px 0;
    border-bottom: 1px solid #1e2937;
}

.log-entry.ok { color: #22c55e; }
.log-entry.err { color: #ef4444; }
.log-entry.warn { color: #f59e0b; }

/* ---------- טאבים ---------- */

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    background: #334155;
    padding: 8px 16px 0 16px;
    border-bottom: 2px solid #475569;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 16px 16px 0 0;
    font-weight: 600;
    font-size: 0.85rem;
    background: transparent;
    color: #94a3b8;
    border: none;
    transition: 0.2s;
    white-space: nowrap;
}

.tab:hover {
    background: #475569;
    color: #f1f5f9;
}

.tab.active {
    background: #1e2937;
    color: #f1f5f9;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
}

/* ---------- פאנלים ---------- */

.panel {
    padding: 20px;
    display: none;
    animation: fadeIn 0.3s ease;
}

.panel.active {
    display: block;
}

.panel h2 {
    margin-bottom: 12px;
}

.sub-title {
    margin: 18px 0 8px 0;
    color: #93c5fd;
    font-size: 1rem;
}

@keyframes fadeIn {
    from { opacity: 0.2; transform: translateY(10px); }
    to   { opacity: 1;   transform: translateY(0); }
}

/* ---------- KPI ---------- */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.kpi-card {
    background: #334155;
    padding: 14px 10px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid #475569;
}

.kpi-card .num {
    font-size: 2rem;
    font-weight: 700;
    color: #60a5fa;
    display: block;
    line-height: 1.2;
}

.kpi-card .label {
    font-size: 0.75rem;
    color: #cbd5e1;
    margin-top: 2px;
}

/* ---------- גרפים ---------- */

.chart-container {
    background: #1e2937;
    border-radius: 16px;
    padding: 16px;
    margin: 16px 0;
    border: 1px solid #334155;
    position: relative;
    height: 300px;
}

.chart-container canvas {
    width: 100% !important;
    max-height: 260px;
}

/* ---------- תובנות ---------- */

.insight-box {
    background: #1e2937;
    border-right: 6px solid #60a5fa;
    padding: 14px 18px;
    border-radius: 14px;
    margin: 14px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.insight-box h3 {
    color: #60a5fa;
    font-size: 1rem;
    margin-bottom: 4px;
}

.insight-box p {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ---------- כפתורים ---------- */

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0;
    justify-content: center;
}

.btn {
    background: #3b82f6;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
}

.btn:hover { background: #2563eb; }

.btn-success { background: #22c55e; }
.btn-success:hover { background: #16a34a; }

.btn-outline {
    background: transparent;
    border: 2px solid #60a5fa;
    color: #60a5fa;
}

.btn-outline:hover {
    background: #60a5fa;
    color: #0f172a;
}

/* ---------- Timeline ---------- */

.timeline-container {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 12px;
}

.timeline-row {
    display: flex;
    gap: 8px;
    padding: 4px 8px;
    background: #1e2937;
    border-radius: 8px;
    border-bottom: 1px solid #334155;
    font-size: 0.8rem;
}

.timeline-row .t-time {
    color: #94a3b8;
    min-width: 140px;
    direction: ltr;
    text-align: right;
}

.timeline-row .t-detail {
    color: #cbd5e1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- HeatMap ---------- */

.heatmap-legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: 0.75rem;
}

.heatmap-legend .swatch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.heatmap-legend .swatch i {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    display: inline-block;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(53, 1fr);
    gap: 3px;
    direction: ltr;
    margin: 12px 0;
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    background: #1e2937;
    border: 1px solid #334155;
    position: relative;
    cursor: pointer;
}

.heatmap-cell:hover {
    transform: scale(1.3);
    z-index: 10;
    border-color: #60a5fa;
}

.heatmap-cell .tooltip {
    display: none;
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #e2e8f0;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.6rem;
    white-space: nowrap;
    z-index: 20;
    border: 1px solid #475569;
}

.heatmap-cell:hover .tooltip {
    display: block;
}

/* ---------- פילטרים ---------- */

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.filter-tag {
    padding: 4px 14px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #334155;
    color: #cbd5e1;
    cursor: pointer;
    border: none;
}

.filter-tag:hover { background: #475569; }

.filter-tag.active {
    background: #3b82f6;
    color: #fff;
}

/* ---------- טבלאות (Tabulator override) ---------- */

.table-holder {
    margin: 12px 0;
}

.tabulator {
    background: #1e2937;
    border: 1px solid #334155;
    border-radius: 12px;
}

.tabulator .tabulator-header {
    background: #334155;
    color: #e2e8f0;
    border-bottom: 1px solid #475569;
}

.tabulator .tabulator-header .tabulator-col {
    background: #334155;
    color: #e2e8f0;
}

.tabulator-row {
    background: #1e2937;
    color: #cbd5e1;
    border-bottom: 1px solid #2b3a50;
}

.tabulator-row.tabulator-row-even {
    background: #223046;
}

.tabulator-row:hover {
    background: #2d3a4f !important;
}

/* ---------- שורת גרפים כפולה ---------- */

.chart-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
}

.chart-row .chart-container {
    margin: 16px 0;
}

@media (max-width: 900px) {
    .chart-row { grid-template-columns: 1fr; }
}

/* ---------- Timeline controls ---------- */

.timeline-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.timeline-controls input {
    background: #0f172a;
    border: 1px solid #475569;
    color: #e2e8f0;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-family: inherit;
}

.timeline-controls input[type="text"] {
    flex: 1 1 220px;
}

.timeline-controls input:focus {
    outline: none;
    border-color: #60a5fa;
}

/* ---------- Hour heatmap (שעה × יום) ---------- */

.hour-heatmap {
    display: grid;
    grid-template-columns: 60px repeat(24, 1fr);
    gap: 2px;
    direction: rtl;
    margin: 12px 0;
    font-size: 0.6rem;
}

.hour-heatmap .hh-label {
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-inline-start: 4px;
}

.hour-heatmap .hh-head {
    color: #94a3b8;
    text-align: center;
}

.hour-heatmap .hh-cell {
    aspect-ratio: 1.4;
    border-radius: 3px;
    background: #1e2937;
    border: 1px solid #2b3a50;
    position: relative;
    cursor: pointer;
}

.hour-heatmap .hh-cell:hover {
    border-color: #60a5fa;
}

.hour-heatmap .hh-cell .tooltip {
    display: none;
    position: absolute;
    bottom: 120%;
    right: 0;
    background: #0f172a;
    color: #e2e8f0;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.65rem;
    white-space: nowrap;
    z-index: 20;
    border: 1px solid #475569;
}

.hour-heatmap .hh-cell:hover .tooltip {
    display: block;
}

/* ---------- פרופיל כישורים ---------- */

.skill-hero {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 16px;
    margin: 16px 0 20px 0;
    align-items: center;
}

.skill-quote {
    background: linear-gradient(135deg, #1e40af22, #60a5fa11);
    border: 1px solid #3b82f6;
    border-radius: 20px;
    padding: 26px 22px;
    text-align: center;
    position: relative;
}

.skill-quote .quote-mark {
    font-size: 3.2rem;
    color: #60a5fa;
    line-height: 0.6;
    margin-bottom: 8px;
}

.skill-quote .quote-text {
    font-size: 1.6rem;
    font-weight: 800;
    color: #f1f5f9;
    line-height: 1.35;
}

.skill-quote .quote-author {
    margin-top: 12px;
    color: #93c5fd;
    font-weight: 600;
    font-size: 0.95rem;
}

.skill-quote .quote-echo {
    margin-top: 6px;
    color: #94a3b8;
    font-size: 0.78rem;
}

.skill-screenshot {
    width: 100%;
    border-radius: 16px;
    border: 1px solid #334155;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
    margin: 16px 0;
}

.skill-card {
    background: #1e2937;
    border: 1px solid #334155;
    border-radius: 18px;
    padding: 18px 16px;
    position: relative;
    overflow: hidden;
}

.skill-card::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #3b82f6, #8b5cf6);
    border-radius: 4px;
}

.skill-card .sk-icon {
    font-size: 1.5rem;
}

.skill-card .sk-title {
    font-weight: 700;
    color: #93c5fd;
    font-size: 0.9rem;
    margin: 6px 0 4px 0;
}

.skill-card .sk-num {
    font-size: 1.9rem;
    font-weight: 800;
    color: #f1f5f9;
    line-height: 1.15;
}

.skill-card .sk-desc {
    color: #94a3b8;
    font-size: 0.78rem;
    margin-top: 6px;
    line-height: 1.5;
}

.skill-card .sk-bar {
    height: 6px;
    background: #0f172a;
    border-radius: 6px;
    margin-top: 10px;
    overflow: hidden;
}

.skill-card .sk-bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 6px;
}

@media (max-width: 900px) {
    .skill-hero { grid-template-columns: 1fr; }
}

/* ---------- ווידג'ט דינמיקה ---------- */

.relationship-card .rel-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.relationship-card p {
    font-size: 0.92rem;
    line-height: 1.75;
}

.relationship-card .rel-note {
    color: #64748b;
    font-size: 0.72rem;
    margin-top: 8px;
}

.tl-clear {
    background: #7f1d1d;
    color: #fecaca;
}

.tl-clear:hover {
    background: #991b1b;
}

/* ---------- הערכת עומק ---------- */

.deep-review {
    background: #1e2937;
    border: 1px solid #334155;
    border-radius: 18px;
    padding: 20px 24px;
    margin: 20px 0;
    line-height: 1.75;
}

.deep-review h4 {
    color: #93c5fd;
    font-size: 1.02rem;
    margin: 18px 0 6px 0;
    border-bottom: 1px solid #2b3a50;
    padding-bottom: 4px;
}

.deep-review p {
    font-size: 0.92rem;
    color: #d6deea;
    margin: 8px 0;
}

.deep-review b {
    color: #f1f5f9;
}

.review-verify {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 4px 0;
}

.review-verify span {
    background: #0f172a;
    border: 1px solid #3b82f6;
    color: #93c5fd;
    border-radius: 30px;
    padding: 4px 14px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ---------- הערת מתודולוגיה ---------- */

.hint-box {
    background: #0f172a;
    border: 1px dashed #475569;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.75rem;
    color: #94a3b8;
    margin: 10px 0;
}

/* ---------- פוטר ---------- */

.footer {
    padding: 14px 20px;
    border-top: 1px solid #334155;
    font-size: 0.7rem;
    color: #94a3b8;
    text-align: center;
}

/* ---------- דוח הדפסה ---------- */

.print-report {
    display: none;
}

@media print {
    body {
        background: #fff;
        color: #000;
        padding: 0;
    }

    .container {
        display: none;
    }

    .print-report {
        display: block;
        direction: rtl;
        font-family: 'Segoe UI', system-ui, sans-serif;
        color: #000;
        padding: 20px;
    }

    .print-report h1 {
        font-size: 1.6rem;
        margin-bottom: 4px;
    }

    .print-report .meta {
        color: #444;
        font-size: 0.85rem;
        margin-bottom: 16px;
    }

    .print-report table {
        width: 100%;
        border-collapse: collapse;
        margin: 10px 0 18px 0;
        font-size: 0.85rem;
    }

    .print-report th,
    .print-report td {
        border: 1px solid #999;
        padding: 6px 10px;
        text-align: right;
    }

    .print-report th {
        background: #eee;
    }

    .print-report h2 {
        font-size: 1.1rem;
        margin: 14px 0 6px 0;
        border-bottom: 2px solid #1e40af;
        padding-bottom: 2px;
    }
}

/* ---------- רספונסיבי ---------- */

@media (max-width: 700px) {
    .kpi-grid { grid-template-columns: 1fr 1fr; }

    .tab {
        padding: 8px 12px;
        font-size: 0.75rem;
        flex: 1 0 auto;
        text-align: center;
    }

    header h1 { font-size: 1.5rem; }
    .panel { padding: 12px; }
    .upload-grid { grid-template-columns: 1fr 1fr; }
    .heatmap-grid { gap: 2px; }
}

@media (max-width: 450px) {
    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .kpi-card .num { font-size: 1.5rem; }
    .upload-grid { grid-template-columns: 1fr; }
    .heatmap-grid { gap: 1px; }
}
