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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
    height: 100vh;
    overflow: hidden;
}

/* Screen Management */
.screen {
    display: none;
    width: 100%;
    height: 100vh;
}

.screen.active {
    display: flex;
}

/* Login Screen */
#loginScreen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
}

.login-container {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    color: #00ff88;
    margin-bottom: 10px;
    text-align: center;
}

.login-container h2 {
    color: #e0e0e0;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 400;
}

#loginForm {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#loginForm input {
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 14px;
}

#loginForm input:focus {
    outline: none;
    border-color: #00ff88;
    background: rgba(255, 255, 255, 0.08);
}

#loginForm button {
    padding: 12px;
    background: #00ff88;
    color: #0a0a0a;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#loginForm button:hover {
    background: #00cc6a;
    transform: translateY(-1px);
}

.error-message {
    color: #ff4444;
    margin-top: 15px;
    text-align: center;
    font-size: 14px;
}

/* Dashboard Screen */
#dashboardScreen {
    flex-direction: column;
}

header {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: #00ff88;
    font-size: 24px;
}

.header-controls {
    display: flex;
    gap: 10px;
}

.header-controls button {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.header-controls button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #00ff88;
}

#logoutBtn {
    background: rgba(255, 68, 68, 0.1);
    border-color: rgba(255, 68, 68, 0.3);
}

#logoutBtn:hover {
    background: rgba(255, 68, 68, 0.2);
    border-color: #ff4444;
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Configuration Editor */
.config-editor {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background: #1a1a1a;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.config-editor.hidden {
    transform: translateX(100%);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.editor-header h3 {
    color: #00ff88;
}

#closeEditorBtn {
    background: none;
    border: none;
    color: #e0e0e0;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#closeEditorBtn:hover {
    color: #ff4444;
}

.monaco-editor {
    flex: 1;
    width: 100%;
}

.editor-controls {
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 10px;
}

.editor-controls button {
    padding: 8px 16px;
    background: #00ff88;
    color: #0a0a0a;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.editor-controls button:hover {
    background: #00cc6a;
}

#validateConfigBtn {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
}

#validateConfigBtn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Dashboard Grid */
.dashboard-grid, #dashboardGrid {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(8, minmax(120px, 1fr));
    grid-auto-rows: minmax(120px, 1fr);
    gap: 16px;
    min-height: calc(100vh - 140px);
}

/* Chart Container */
.chart-container {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    min-height: 0;
}

.chart-header {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chart-title {
    color: #e0e0e0;
    font-size: 16px;
    font-weight: 500;
}

.chart-content {
    flex: 1;
    min-height: 200px;
    position: relative;
    overflow: hidden;
}

/* Stats Panel */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 10px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-label {
    color: #888;
    font-size: 12px;
    margin-bottom: 5px;
}

.stat-value {
    color: #e0e0e0;
    font-size: 20px;
    font-weight: 600;
}

.stat-value.positive {
    color: #00ff88;
}

.stat-value.negative {
    color: #ff4444;
}

/* Status Bar */
.status-bar {
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 30px;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #888;
}

#statusMessage {
    color: #00ff88;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: #00ff88;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .config-editor {
        width: 100%;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .header-controls {
        flex-wrap: wrap;
    }
}

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

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}