:root {
    --primary: #F59E0B;
    --secondary: #FBBF24;
    --accent: #6366F1;
    --bg-color: #1A1408;
    --surface: rgba(255, 255, 255, 0.05);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --border: rgba(245, 158, 11, 0.15);
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.6);
    
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --timeout: #6B7280;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: 200ms ease;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

body.fullscreen .app-container {
    padding: 1rem;
    max-width: none;
    height: 100vh;
}

body.fullscreen .globe-panel {
    grid-column: 1 / -1;
    height: 60vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 2rem;
    color: var(--primary);
    font-weight: 700;
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.header p {
    color: var(--text-secondary);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    grid-template-rows: auto auto;
    gap: 1.5rem;
}

.globe-panel {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    min-height: 500px;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at center, rgba(30, 24, 10, 0.8), rgba(26, 20, 8, 1));
}

.stats-panel {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}

.table-panel {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
}

/* Panels */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.panel h2 {
    font-size: 1.25rem;
    color: var(--secondary);
    font-weight: 600;
}

/* Globe Canvas */
.canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
}

#globe-canvas {
    width: 100%;
    height: 100%;
    cursor: grab;
}

#globe-canvas:active {
    cursor: grabbing;
}

.globe-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
}

.globe-overlay .btn {
    pointer-events: auto;
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.5);
}

.globe-overlay.hidden {
    display: none;
}

/* Stats */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats-cards .stat-card:first-child {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0) 100%);
    border-color: rgba(245, 158, 11, 0.3);
}

.stat-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.trend-chart-container {
    margin-bottom: 1.5rem;
}

.trend-chart-container h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

#trend-canvas {
    width: 100%;
    height: 120px;
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.recommendation-box {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.recommendation-box h3 {
    color: var(--accent);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.recommendation-box p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Table */
.table-container {
    flex: 1;
    overflow-y: auto;
    margin-top: 1rem;
    padding-right: 0.5rem;
}

.table-container::-webkit-scrollbar {
    width: 6px;
}
.table-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}
.table-container::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
    position: sticky;
    top: 0;
    background: var(--surface);
    backdrop-filter: blur(10px);
}

td {
    font-size: 0.9rem;
}

.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-good { background-color: var(--success); box-shadow: 0 0 8px var(--success); }
.status-warn { background-color: var(--warning); box-shadow: 0 0 8px var(--warning); }
.status-bad { background-color: var(--danger); box-shadow: 0 0 8px var(--danger); }
.status-none { background-color: var(--timeout); }

/* Buttons & UI Elements */
.btn {
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: var(--bg-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
}

.btn-primary:not(:disabled):hover {
    background: var(--secondary);
    transform: translateY(-2px);
}

.btn-large {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    border-radius: var(--radius-md);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
}

.btn-outline {
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

.btn-icon {
    color: var(--text-secondary);
    background: rgba(255,255,255,0.05);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
}

.btn-icon:hover {
    color: var(--primary);
    background: rgba(255,255,255,0.1);
}

/* Modals */
.modal {
    background: transparent;
    border: none;
    margin: auto;
}

.modal::backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-color);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 2rem;
    color: var(--text-primary);
    max-width: 400px;
    width: 100%;
}

.modal-content h2 {
    margin-bottom: 1rem;
    color: var(--primary);
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .globe-panel {
        min-height: 400px;
        grid-row: auto;
    }
    .stats-panel, .table-panel {
        grid-column: 1 / -1;
    }
}
