/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #1e1e1e;
    color: #ffffff;
    overflow: hidden;
    user-select: none;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: linear-gradient(135deg, #2d2d2d 0%, #1e1e1e 100%);
    border-radius: 12px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    margin: 8px;
    max-height: calc(100vh - 16px);
    overflow: hidden;
}

/* Title Bar */
.title-bar {
    display: flex;
    align-items: center;
    height: 52px;
    background: linear-gradient(180deg, #3c3c3c 0%, #2d2d2d 100%);
    border-bottom: 1px solid #1a1a1a;
    padding: 0 16px;
    border-radius: 12px 12px 0 0;
    position: relative;
}

.traffic-lights {
    display: flex;
    gap: 8px;
    margin-right: 16px;
}

.traffic-light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.traffic-light.close {
    background: #ff5f57;
    border: 1px solid #e0443e;
}

.traffic-light.minimize {
    background: #ffbd2e;
    border: 1px solid #dea123;
}

.traffic-light.maximize {
    background: #28ca42;
    border: 1px solid #1aac32;
}

.traffic-light:hover {
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.title {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    flex: 1;
    text-align: center;
    letter-spacing: 0.5px;
}

.toolbar {
    display: flex;
    gap: 8px;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(180deg, #4a4a4a 0%, #3a3a3a 100%);
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toolbar-btn:hover {
    background: linear-gradient(180deg, #5a5a5a 0%, #4a4a4a 100%);
    border-color: #007acc;
    box-shadow: 0 0 8px rgba(0, 122, 204, 0.3);
}

.toolbar-btn:active {
    transform: translateY(1px);
}

.toolbar-btn svg {
    opacity: 0.9;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* Editor Panel */
.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
    border-right: 1px solid #2d2d2d;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 36px;
    background: #2d2d2d;
    border-bottom: 1px solid #3c3c3c;
    padding: 0 12px;
}

.panel-title {
    font-size: 12px;
    font-weight: 600;
    color: #cccccc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.file-name {
    font-size: 12px;
    color: #888888;
    background: #3c3c3c;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #4a4a4a;
}

.editor-container {
    flex: 1;
    position: relative;
}

/* Divider */
.divider {
    width: 1px;
    background: linear-gradient(180deg, #3c3c3c 0%, #2d2d2d 50%, #3c3c3c 100%);
    cursor: col-resize;
    transition: background 0.2s ease;
}

.divider:hover {
    background: #007acc;
    box-shadow: 0 0 4px rgba(0, 122, 204, 0.5);
}

/* Output Panel */
.output-panel {
    width: 400px;
    display: flex;
    flex-direction: column;
    background: #252525;
}

.panel-tabs {
    display: flex;
    background: #2d2d2d;
    border-bottom: 1px solid #3c3c3c;
}

.tab-btn {
    padding: 12px 16px;
    background: none;
    border: none;
    color: #888888;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab-btn:hover {
    color: #cccccc;
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: #ffffff;
    border-bottom-color: #007acc;
    background: rgba(0, 122, 204, 0.1);
}

.tab-content {
    flex: 1;
    position: relative;
}

.tab-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
}

.tab-panel.active {
    display: flex;
}

.tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 36px;
    background: #2d2d2d;
    border-bottom: 1px solid #3c3c3c;
    padding: 0 12px;
}

.tab-title {
    font-size: 12px;
    font-weight: 600;
    color: #cccccc;
}

.status-indicator {
    font-size: 11px;
    padding: 2px 6px;
    background: #007acc;
    color: #ffffff;
    border-radius: 10px;
    font-weight: 500;
}

.content-area {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.4;
    user-select: text;
}

.placeholder {
    color: #666666;
    font-style: italic;
    text-align: center;
    margin-top: 40px;
}

/* Output Content Styles */
.output-line {
    margin-bottom: 4px;
    white-space: pre-wrap;
}

.output-error {
    color: #f85149;
    background: rgba(248, 81, 73, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    border-left: 3px solid #f85149;
}

.output-success {
    color: #56d364;
}

/* Token Styles */
.token-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    margin-bottom: 2px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    border-left: 3px solid #007acc;
}

.token-type {
    font-weight: 600;
    color: #79c0ff;
    min-width: 80px;
    margin-right: 12px;
}

.token-value {
    color: #a5a5a5;
    font-family: inherit;
}

/* AST Styles */
.ast-tree {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
}

.ast-node {
    margin-left: 16px;
    padding: 2px 0;
}

.ast-node-type {
    color: #ffa657;
    font-weight: 600;
}

.ast-node-value {
    color: #a5a5a5;
    margin-left: 8px;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border: 1px solid #3c3c3c;
}

.info-label {
    font-size: 11px;
    color: #888888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.info-value {
    font-size: 14px;
    color: #ffffff;
    font-weight: 500;
}

/* Status Bar */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 24px;
    background: #2d2d2d;
    border-top: 1px solid #3c3c3c;
    padding: 0 12px;
    font-size: 11px;
    color: #888888;
    border-radius: 0 0 12px 12px;
}

.status-left, .status-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1e1e1e;
}

::-webkit-scrollbar-thumb {
    background: #4a4a4a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5a5a5a;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

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

.pulse {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        margin: 4px;
        border-radius: 8px;
    }
    
    .output-panel {
        width: 300px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}

/* Error Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.error-modal {
    background: linear-gradient(135deg, #2d2d2d 0%, #1e1e1e 100%);
    border: 1px solid #3c3c3c;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.show .error-modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.modal-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ff5f57;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: bold;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.modal-message {
    color: #cccccc;
    line-height: 1.5;
    margin-bottom: 20px;
    font-size: 14px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn.primary {
    background: #007acc;
    color: white;
}

.modal-btn.primary:hover {
    background: #0086e6;
}

.modal-btn.secondary {
    background: #3c3c3c;
    color: #cccccc;
    border: 1px solid #4a4a4a;
}

.modal-btn.secondary:hover {
    background: #4a4a4a;
    color: #ffffff;
}