/* WattVault Custom Styles */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
}

/* Main Layout */
.sidebar {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.content-wrapper {
    padding: 20px;
    min-height: 100vh;
    background-color: #f5f6fa;
}

/* Device Cards */
.device-card {
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: none;
    background: white;
}

.device-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.device-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 15px 15px 0 0;
    padding: 15px 20px;
}

.device-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
}

.status-online { 
    background-color: var(--success-color);
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.6);
}

.status-offline { 
    background-color: var(--danger-color);
    animation: none;
}

.status-warning { 
    background-color: var(--warning-color);
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.6);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* Metric Displays */
.metric-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
}

.metric-value {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.metric-label {
    font-size: 0.9rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.metric-unit {
    font-size: 1.2rem;
    color: #6c757d;
    margin-left: 5px;
}

/* Battery specific styling */
.metric-battery .metric-value {
    color: var(--success-color);
}

.metric-battery.low .metric-value {
    color: var(--danger-color);
}

.metric-battery.medium .metric-value {
    color: var(--warning-color);
}

/* Voltage styling */
.metric-voltage .metric-value {
    color: var(--info-color);
}

/* Power styling */
.metric-power .metric-value {
    color: var(--primary-color);
}

/* Temperature styling */
.metric-temperature .metric-value {
    color: var(--secondary-color);
}

/* Chart Containers */
.chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chart-container.large {
    height: 400px;
}

.chart-container.small {
    height: 200px;
}

.gauge-container {
    position: relative;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Alert Notifications */
.alert-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    min-width: 300px;
    border-radius: 10px;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert-critical {
    background-color: var(--danger-color);
    color: white;
    border: none;
}

.alert-warning {
    background-color: var(--warning-color);
    color: var(--dark-color);
    border: none;
}

.alert-info {
    background-color: var(--info-color);
    color: white;
    border: none;
}

/* Navigation Enhancements */
.nav-link {
    transition: background-color 0.3s ease;
    border-radius: 8px;
    margin: 2px 0;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: bold;
}

/* Form Enhancements */
.form-control {
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    transform: translateY(-1px);
}

/* Modal Enhancements */
.modal-content {
    border-radius: 15px;
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    border-radius: 15px 15px 0 0;
}

/* Table Enhancements */
.table {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table thead th {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    font-weight: 600;
}

.table tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

/* Loading Indicators */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .device-card {
        margin-bottom: 20px;
    }
    
    .metric-value {
        font-size: 2rem;
    }
    
    .chart-container {
        height: 250px;
        padding: 15px;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 250px;
        height: 100vh;
        transition: left 0.3s ease;
        z-index: 1040;
    }
    
    .sidebar.show {
        left: 0;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .content-wrapper {
        background-color: #1a1a1a;
        color: white;
    }
    
    .device-card,
    .metric-card,
    .chart-container {
        background-color: #2d2d2d;
        color: white;
    }
    
    .table {
        background-color: #2d2d2d;
        color: white;
    }
    
    .modal-content {
        background-color: #2d2d2d;
        color: white;
    }
}