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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #f0f0f0;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#server-status {
    color: #4ade80;
    font-size: 0.9em;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-button {
    flex: 1;
    min-width: 120px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 8px;
    color: #fff;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.tab-button.active {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    border-color: #ff6b35;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.section {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.section h2 {
    margin-bottom: 20px;
    font-size: 1.8em;
    color: #ff6b35;
}

/* Power Section */
.power-card {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.1), rgba(34, 197, 94, 0.1));
    border: 2px solid #4ade80;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
}

.power-card.warning {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(245, 158, 11, 0.1));
    border-color: #fbbf24;
}

.power-card.critical {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1));
    border-color: #ef4444;
    animation: pulse 2s infinite;
}

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

.power-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.power-stat {
    text-align: center;
}

.power-stat-value {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.power-stat-label {
    font-size: 0.9em;
    color: #aaa;
}

.power-bar {
    width: 100%;
    height: 40px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}

.power-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #22c55e);
    transition: width 0.5s ease, background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1em;
}

.power-bar-inner.warning {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.power-bar-inner.critical {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* Production Grid */
.production-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.production-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #ff6b35;
    transition: all 0.2s ease;
    cursor: pointer;
}

.production-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
}

.production-item.expanded {
    grid-column: 1 / -1;
}

.production-details {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: none;
}

.production-item.expanded .production-details {
    display: block;
}

.building-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.building-item {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 5px;
    font-size: 0.85em;
}

.production-item h3 {
    font-size: 1em;
    margin-bottom: 10px;
    color: #fff;
}

.production-efficiency {
    font-size: 2em;
    font-weight: bold;
    margin: 10px 0;
}

.production-efficiency.good { color: #4ade80; }
.production-efficiency.medium { color: #fbbf24; }
.production-efficiency.poor { color: #ef4444; }

/* Train List */
.train-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.train-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #3b82f6;
}

.train-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.train-name {
    font-size: 1.3em;
    font-weight: bold;
}

.train-status {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.train-status.idle { background: #6b7280; }
.train-status.loading { background: #3b82f6; }
.train-status.unloading { background: #8b5cf6; }

.train-cargo {
    margin-top: 10px;
    font-size: 0.9em;
    color: #aaa;
}

/* Storage Grid */
.storage-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.storage-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 10px;
}

.storage-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.storage-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 107, 53, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
}

.storage-info {
    flex: 1;
}

.storage-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.storage-amount {
    font-size: 0.9em;
    color: #aaa;
}

.progress-bar {
    width: 100%;
    height: 25px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.progress-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    font-weight: bold;
}

/* Alerts */
.alert-item {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid #ef4444;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.alert-icon {
    font-size: 2em;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.alert-message {
    font-size: 0.9em;
    color: #aaa;
}

/* Quick Stats */
.quick-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.quick-stat {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.quick-stat-value {
    font-size: 2.5em;
    font-weight: bold;
    color: #ff6b35;
    margin-bottom: 5px;
}

.quick-stat-label {
    font-size: 0.9em;
    color: #aaa;
}



/* Production Cards (Expandable) */
.production-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #ff6b35;
    transition: all 0.3s ease;
    cursor: pointer;
}

.production-card:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.08);
}

.production-card.expanded {
    grid-column: 1 / -1;
    border-color: #4ade80;
}

.production-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.production-header h3 {
    font-size: 1.2em;
    color: #fff;
    margin: 0;
}

.production-stats {
    display: flex;
    gap: 20px;
    font-size: 0.9em;
    color: #aaa;
    margin-bottom: 10px;
}

.production-details {
    display: none;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid rgba(255, 255, 255, 0.2);
}

.production-card.expanded .production-details {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

.production-details h4 {
    margin-bottom: 15px;
    color: #ff6b35;
}

.building-detail {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.9em;
    line-height: 1.6;
}

/* Battery Details */
.battery-details {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 0.9em;
}

.battery-details span {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 15px;
    border-radius: 5px;
}

/* Stat Cards */
.stat-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: #ff6b35;
}

.stat-card.critical {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    animation: pulse 2s infinite;
}

.stat-value {
    font-size: 2.5em;
    font-weight: bold;
    color: #ff6b35;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9em;
    color: #aaa;
}

/* Train Cards */
.trains-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.train-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #3b82f6;
}

.train-card h3 {
    margin-bottom: 10px;
    color: #fff;
}

.train-card p {
    margin: 5px 0;
    font-size: 0.9em;
    color: #aaa;
}

/* Alert Cards */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.alert-card {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid #ef4444;
    border-radius: 10px;
    padding: 20px;
}

.alert-card h3 {
    margin-bottom: 10px;
    color: #ef4444;
}

.alert-card p {
    margin-bottom: 10px;
    color: #fff;
}

.alert-card small {
    color: #aaa;
}

