:root {
    --surface: #ffffff;
    --surface-muted: #f4f6fb;
    --border: #e3e8f2;
    --text-main: #1c2333;
    --text-muted: #5f6b85;
    --primary: #f39c12;
    --primary-dark: #e67e22;
    --accent: #36cfc9;
    --shadow-soft: 0 20px 45px rgba(15, 23, 42, 0.08);
    --gradient: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

/* Viewer Interface */
.viewer-interface {
    margin-bottom: 3rem;
}

.tool-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
    padding: 32px;
    transition: background 0.3s ease, border 0.3s ease;
}

.panel-head {
    margin-bottom: 24px;
}

.panel-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.panel-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
}

/* Editor Styles */
.editor-wrapper {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-muted);
    min-height: 400px;
}

.ace-editor {
    width: 100%;
    min-height: 400px;
}

.editor-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.btn-action:hover {
    background: rgba(243, 156, 18, 0.08);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.btn-action i {
    font-size: 14px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--surface-muted);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: var(--primary);
}

.stat-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient);
    border-radius: 10px;
    color: #ffffff;
    font-size: 18px;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Structure Panel */
.structure-panel {
    margin-top: 24px;
}

.structure-container {
    min-height: 300px;
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-muted);
    padding: 20px;
}

.code-outline {
    
    font-size: 13px;
    line-height: 1.6;
}

.outline-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.outline-placeholder i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.outline-placeholder p {
    margin: 0;
    font-size: 14px;
}

/* Structure Tree */
.structure-item {
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.structure-item:hover {
    background: rgba(243, 156, 18, 0.08);
    border-left-color: var(--primary);
}

.structure-item.function {
    border-left-color: #3498db;
}

.structure-item.class {
    border-left-color: #9b59b6;
}

.structure-item.variable {
    border-left-color: #2ecc71;
}

.structure-item.method {
    border-left-color: #e67e22;
    padding-left: 24px;
}

.structure-item.property {
    border-left-color: #95a5a6;
    padding-left: 36px;
}

.structure-name {
    font-weight: 600;
    color: var(--text-main);
    display: inline-block;
    margin-right: 8px;
}

.structure-type {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    background: var(--surface);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

.structure-location {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Content Section */
.content-section {
    margin-top: 3rem;
    padding-top: 2rem;
}

.content-block h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 16px;
    margin-top: 32px;
}

.content-block h2:first-child {
    margin-top: 0;
}

.content-block h3 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-main);
    margin-top: 24px;
    margin-bottom: 12px;
}

.content-block p {
    font-size: 16px;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 16px;
}

.content-block ul,
.content-block ol {
    margin-bottom: 20px;
    padding-left: 24px;
}

.content-block li {
    margin-bottom: 10px;
    color: var(--text-muted);
    line-height: 1.7;
    font-size: 16px;
}

.content-block li strong {
    color: var(--text-main);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .tool-wrapper {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 767px) {
    .panel {
        padding: 24px;
    }

    .panel-title {
        font-size: 20px;
    }

    .editor-wrapper {
        min-height: 300px;
    }

    .ace-editor {
        min-height: 300px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 20px;
    }

    .editor-actions {
        flex-direction: column;
    }

    .btn-action {
        width: 100%;
    }

    .structure-container {
        min-height: 250px;
        max-height: 400px;
    }
}

/* Custom ACE Editor Theme Adjustments */
.ace-xcode .ace_content .ace_variable {
    color: #2d5ada;
}

.ace-xcode .ace_content .ace_string {
    color: #cc5b5c;
}

.ace-xcode .ace_content .ace_constant.ace_numeric {
    color: #008100;
}

.ace-xcode .ace_content .ace_boolean {
    color: #0b7500;
}

.ace-xcode .ace_content .ace_keyword {
    color: #a300b5;
}

.ace-xcode .ace_content .ace_function {
    color: #0000a2;
}

.ace-xcode {
    background: #ffffff;
}

.ace-xcode .ace_gutter {
    background: #f8f9fa;
    color: #6c757d;
}

