:root {
    --bg-dark: #121212;
    --bg-panel: #1e1e1e;
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --accent-red: #ff4a4a;
    --accent-blue: #00bceb;
    --accent-green: #74b82d;
    --border-color: #333333;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    height: 70px;
}

.header-left h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.header-left h1 i {
    color: var(--accent-blue);
    margin-right: 0.5rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.status-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-badge.connected {
    background-color: rgba(116, 184, 45, 0.2);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

.time-display {
    font-family: monospace;
    font-size: 1.2rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left: 3D Map Section */
.map-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    position: relative;
}

.section-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, rgba(30,30,30,0.8), transparent);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    pointer-events: none;
}

.section-header h2 {
    font-size: 1.2rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.map-controls {
    pointer-events: auto;
}

.btn-icon {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255,255,255,0.2);
}

.canvas-container {
    flex: 1;
    position: relative;
    background-color: #0a0a0a;
}

.loading-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 5;
}

/* Right: Dashboard Panel */
.dashboard-panel {
    width: 400px;
    background-color: var(--bg-panel);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.5rem;
    overflow-y: auto;
}

.panel-card {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.2rem;
}

.panel-card h3 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Sensor Grid */
.sensor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.sensor-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0,0,0,0.2);
    padding: 0.8rem;
    border-radius: 8px;
}

.sensor-item i {
    font-size: 1.5rem;
    color: var(--accent-blue);
}

.sensor-info {
    display: flex;
    flex-direction: column;
}

.sensor-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sensor-value {
    font-size: 1.1rem;
    font-weight: 700;
}

.sensor-value.safe { color: var(--accent-green); }
.sensor-value.active { color: var(--accent-blue); }
.sensor-value.danger { color: var(--accent-red); }

/* AI Insights */
.insight-card {
    border-left: 4px solid #f39c12;
}

.insight-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #e0e0e0;
}

.insight-text i {
    color: #f39c12;
}

/* Alerts List */
.alerts-card {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    overflow-y: auto;
    flex: 1;
    padding-right: 0.5rem;
}

.alerts-list::-webkit-scrollbar {
    width: 6px;
}
.alerts-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.alert-item {
    background: rgba(255, 74, 74, 0.1);
    border-left: 4px solid var(--accent-red);
    padding: 1rem;
    border-radius: 0 8px 8px 0;
    animation: slideIn 0.3s ease-out;
}

.alert-item.info {
    background: rgba(0, 188, 235, 0.1);
    border-left-color: var(--accent-blue);
}

.alert-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.alert-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--accent-red);
}

.alert-item.info .alert-title {
    color: var(--accent-blue);
}

.alert-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.alert-desc {
    font-size: 0.85rem;
    color: #e0e0e0;
}

.empty-state {
    background: transparent;
    border: none;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}