/* Dark theme for AID System App */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: #16213e;
    border-bottom: 1px solid #0f3460;
}

header h1 {
    font-size: 1.5rem;
    color: #e94560;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.status-indicator .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.connected .dot {
    background-color: #4ecca3;
    box-shadow: 0 0 6px #4ecca3;
}

.status-indicator.disconnected .dot {
    background-color: #e94560;
    box-shadow: 0 0 6px #e94560;
}

/* Main */
main {
    padding: 1.5rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Card */
.card {
    background-color: #16213e;
    border-radius: 8px;
    padding: 1.25rem;
    border: 1px solid #0f3460;
}

.card h3 {
    font-size: 0.85rem;
    color: #a0a0b0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #e0e0e0;
}

.sub-value {
    font-size: 0.85rem;
    color: #a0a0b0;
    margin-top: 0.25rem;
}

/* Connection Panel */
.connection-panel {
    margin-bottom: 1.5rem;
}

.connection-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.url-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.url-row input {
    flex: 1;
}

.conn-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    background-color: #555;
    flex-shrink: 0;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.conn-dot.connected {
    background-color: #4ecca3;
    box-shadow: 0 0 6px #4ecca3;
}

.conn-dot.disconnected {
    background-color: #e94560;
    box-shadow: 0 0 6px #e94560;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Glucose Panel */
.glucose-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.glucose-current {
    text-align: center;
}

.glucose-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
}

.glucose-value {
    font-size: 4rem;
    font-weight: 700;
    color: #4ecca3;
    line-height: 1;
}

.glucose-unit {
    font-size: 1.2rem;
    color: #a0a0b0;
}

.trend-arrow {
    font-size: 2.5rem;
    margin-left: 0.5rem;
}

.glucose-trend {
    font-size: 0.95rem;
    color: #a0a0b0;
    margin-top: 0.5rem;
}

/* Glucose ranges */
.glucose-value.low { color: #e94560; }
.glucose-value.normal { color: #4ecca3; }
.glucose-value.high { color: #ffa726; }
.glucose-value.very-high { color: #e94560; }

/* Chart */
.chart-container {
    height: 300px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Pump Panel */
.pump-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pump-status-badge {
    font-size: 1.2rem;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-align: center;
    background-color: #555;
    color: #e0e0e0;
}

.pump-status-badge.active {
    background-color: rgba(78, 204, 163, 0.2);
    color: #4ecca3;
    border: 1px solid #4ecca3;
}

.pump-status-badge.suspended {
    background-color: rgba(255, 167, 38, 0.2);
    color: #ffa726;
    border: 1px solid #ffa726;
}

.pump-status-badge.error,
.pump-status-badge.empty,
.pump-status-badge.low-battery {
    background-color: rgba(233, 69, 96, 0.2);
    color: #e94560;
    border: 1px solid #e94560;
}

/* Progress Bars */
.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #1a1a2e;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #0f3460;
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease, background-color 0.5s ease;
}

.reservoir-fill {
    background-color: #4ecca3;
}

.battery-fill {
    background-color: #4ecca3;
}

.battery-fill.low {
    background-color: #ffa726;
}

.battery-fill.critical {
    background-color: #e94560;
}

.progress-label {
    font-size: 0.85rem;
    color: #a0a0b0;
    margin-top: 0.3rem;
    text-align: center;
}

/* Controls Grid */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.control-row {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
}

.control-row .form-group {
    flex: 1;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Relay Status */
.relay-status {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #a0a0b0;
}

.relay-status.active {
    color: #4ecca3;
}

/* Form Elements */
.form-group {
    margin-bottom: 0.75rem;
}

.form-group.compact {
    margin-bottom: 0.5rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: #a0a0b0;
    margin-bottom: 0.25rem;
}

.form-group input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    border: 1px solid #0f3460;
    background-color: #1a1a2e;
    color: #e0e0e0;
    font-size: 0.95rem;
}

.form-group input:focus {
    outline: none;
    border-color: #4ecca3;
}

/* Buttons */
.btn {
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
    white-space: nowrap;
}

.btn:hover {
    opacity: 0.85;
}

.btn:active {
    opacity: 0.7;
}

.btn-primary {
    background-color: #e94560;
    color: #fff;
}

.btn-success {
    background-color: #4ecca3;
    color: #1a1a2e;
}

.btn-warning {
    background-color: #ffa726;
    color: #1a1a2e;
}

.btn-secondary {
    background-color: #0f3460;
    color: #e0e0e0;
    border: 1px solid #4ecca3;
}

/* Responsive */
@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .pump-panel {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    .glucose-value {
        font-size: 3rem;
    }

    main {
        padding: 1rem;
    }

    header {
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 600px) {
    .connection-inputs {
        grid-template-columns: 1fr;
    }

    .controls-grid {
        grid-template-columns: 1fr;
    }

    .control-row {
        flex-direction: column;
        align-items: stretch;
    }
}
