/* ========================================
   Result Page - Additional Styles
   ======================================== */

/* ----- Result Main ----- */
.result-main {
    max-width: 1100px;
}

/* ----- No Data State ----- */
.no-data-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    animation: fadeInUp 0.6s ease;
}

.no-data-card {
    text-align: center;
    padding: 60px 40px;
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-xl);
    max-width: 480px;
}

.no-data-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.no-data-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.no-data-desc {
    font-size: 0.92rem;
    color: var(--text-secondary);
    margin-bottom: 28px;
    line-height: 1.6;
}

/* ----- Result Section ----- */
.result-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    animation: fadeInUp 0.5s ease;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.section-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-icon {
    font-size: 1.3rem;
}

.section-title-sm {
    font-size: 1rem;
    font-weight: 700;
}

.btn-outline {
    padding: 7px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: var(--font-body);
}

.btn-outline:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.06);
}

/* ----- Source Display ----- */
.source-display {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.source-code {
    padding: 16px 20px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-primary);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ----- Tabs ----- */
.result-tabs {
    display: flex;
    gap: 4px;
    padding: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    animation: fadeInUp 0.5s ease 0.1s both;
}

.result-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: var(--font-body);
}

.result-tab:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.06);
}

.result-tab.active {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.1);
}

.tab-icon {
    font-size: 1rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ----- Tree Container ----- */
.tree-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: auto;
    min-height: 350px;
    max-height: 600px;
    position: relative;
}

.tree-canvas {
    padding: 40px 20px;
    min-width: 100%;
    width: max-content;
    display: flex;
    justify-content: center;
    transform-origin: top center;
}

.tree-controls {
    display: flex;
    gap: 4px;
}

.btn-icon-sm {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-body);
}

.btn-icon-sm:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.08);
}

/* AST Tree Nodes */
.ast-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ast-node-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.ast-node {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: center;
    cursor: default;
    min-width: 60px;
    position: relative;
    transition: all var(--transition-normal);
    white-space: nowrap;
    border: 1.5px solid transparent;
    animation: nodeAppear 0.4s ease both;
    z-index: 2;
}

.ast-node:hover {
    transform: scale(1.08);
    z-index: 10;
}

@keyframes nodeAppear {
    from {
        opacity: 0;
        transform: scale(0.7) translateY(-8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Node color categories */
.ast-node.node-program,
.ast-node.node-statement {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(99, 102, 241, 0.12));
    border-color: rgba(99, 102, 241, 0.4);
    color: #a5b4fc;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.15);
}

.ast-node.node-declaration {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(245, 158, 11, 0.12));
    border-color: rgba(245, 158, 11, 0.4);
    color: #fcd34d;
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.15);
}

.ast-node.node-expression,
.ast-node.node-operator {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(16, 185, 129, 0.12));
    border-color: rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
    box-shadow: 0 2px 12px rgba(16, 185, 129, 0.15);
}

.ast-node.node-literal,
.ast-node.node-identifier {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.25), rgba(236, 72, 153, 0.12));
    border-color: rgba(236, 72, 153, 0.4);
    color: #f9a8d4;
    box-shadow: 0 2px 12px rgba(236, 72, 153, 0.15);
}

/* Tree branches */
.ast-children {
    display: flex;
    gap: 16px;
    position: relative;
    padding-top: 28px;
}

/* SVG lines are drawn via Javascript, so no CSS straight lines are needed here */

/* Tree Legend */
.tree-legend {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

/* ----- Token Table ----- */
.token-count {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

.table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

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

.token-table thead {
    background: var(--bg-elevated);
}

.token-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-color);
}

.token-table td {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(42, 42, 61, 0.5);
    vertical-align: middle;
}

.token-table tbody tr {
    transition: background var(--transition-fast);
}

.token-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

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

.token-type {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
}

.token-value {
    font-family: var(--font-mono);
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-primary);
}

.token-category {
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.cat-keyword {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
}

.cat-identifier {
    background: rgba(236, 72, 153, 0.15);
    color: #f9a8d4;
}

.cat-number {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
}

.cat-operator {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
}

.cat-punctuation {
    background: rgba(6, 182, 212, 0.15);
    color: #67e8f9;
}

.cat-string {
    background: rgba(168, 85, 247, 0.15);
    color: #c4b5fd;
}

/* ----- JSON Output ----- */
.json-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: auto;
    max-height: 500px;
}

.json-output {
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre;
}

.json-key {
    color: #a5b4fc;
}

.json-string {
    color: #6ee7b7;
}

.json-number {
    color: #fcd34d;
}

.json-null {
    color: var(--text-muted);
}

.json-bracket {
    color: var(--text-secondary);
}

/* ----- Stats Section ----- */
.stats-section {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 24px;
    animation: fadeInUp 0.5s ease 0.3s both;
}

.stat-card {
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
    transition: all var(--transition-normal);
}

.stat-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 900;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
    .result-tabs {
        flex-direction: column;
    }

    .stats-section {
        grid-template-columns: repeat(2, 1fr);
    }

    .tree-legend {
        gap: 12px;
    }

    .result-section {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .stats-section {
        grid-template-columns: 1fr 1fr;
    }
}
