/* Container Isolation */
#spss-lite-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    margin: 20px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    color: #333;
    position: relative;
}

#spss-lite-wrapper * {
    box-sizing: border-box;
}

/* Toolbar */
.spss-toolbar {
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.spss-toolbar .brand {
    font-weight: bold;
    color: #2271b1;
    margin-right: 15px;
}

.spss-toolbar nav {
    display: flex;
    gap: 5px;
    overflow-x: auto;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    color: #555;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: #e2e6ea;
}

.tab-btn.active {
    background: #2271b1;
    color: #fff;
}

/* Content Areas */
.spss-content {
    padding: 0;
    min-height: 400px;
    position: relative;
}

.tab-content {
    display: none;
    padding: 15px;
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Tables (Data & Variable View) */
.table-responsive {
    overflow-x: auto;
    max-height: 600px;
    border: 1px solid #eee;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    font-size: 13px;
}

th {
    background: #f1f1f1;
    position: sticky;
    top: 0;
    z-index: 2;
}

td[contenteditable="true"]:focus {
    outline: 2px solid #2271b1;
    background: #fff;
}

/* Analyze View Layout */
.analyze-layout {
    display: flex;
    gap: 20px;
    height: 100%;
}

.analyze-layout .sidebar {
    width: 200px;
    border-right: 1px solid #eee;
    flex-shrink: 0;
}

.analyze-layout .sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.analyze-layout .sidebar li {
    padding: 10px;
    cursor: pointer;
    border-radius: 4px;
}

.analyze-layout .sidebar li:hover {
    background: #f0f0f0;
}

.analyze-layout .sidebar li.active {
    background: #e7f1ff;
    color: #2271b1;
    font-weight: 500;
}

.analyze-layout .main-panel {
    flex-grow: 1;
}

.output-box {
    background: #fafafa;
    border: 1px solid #eee;
    padding: 15px;
    margin-top: 15px;
    font-family: monospace;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
}

/* Controls */
button {
    cursor: pointer;
}

.grid-controls, .chart-controls {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

select, input[type="text"], button {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#spss-toast {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: #333;
    color: #fff;
    padding: 10px 20px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .analyze-layout {
        flex-direction: column;
    }
    .analyze-layout .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eee;
        margin-bottom: 15px;
    }
    .spss-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}