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

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: block;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 600px;
    animation: slideIn 0.3s ease;
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    opacity: 0.8;
}

.modal-body {
    padding: 20px;
}

.calibration-status {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 10px 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.calibration-status.success {
    background: #e8f5e9;
    border-color: #4caf50;
}

.calibration-status.warning {
    background: #fff3cd;
    border-color: #ff9800;
}

.calibration-info {
    text-align: center;
    margin-bottom: 30px;
}

.current-factor {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
    margin: 10px 0;
}

.calibration-steps {
    margin-bottom: 30px;
}

.calibration-step {
    display: none;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 15px;
}

.calibration-step.active {
    display: block;
}

.calibration-step h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.pulse-monitor {
    background: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    font-size: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.volume-input {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
}

.volume-input input {
    flex: 1;
    padding: 10px;
    font-size: 1.2rem;
    border: 2px solid #ddd;
    border-radius: 4px;
}

.manual-calibration {
    border-top: 1px solid #ddd;
    padding-top: 20px;
    margin-top: 30px;
}

.manual-input {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.manual-input input {
    flex: 1;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 4px;
}

.btn-warning {
    background: #ff9800;
    color: white;
}

.btn-warning:hover {
    background: #f57c00;
}

.btn-success {
    background: #4caf50;
    color: white;
}

.btn-success:hover {
    background: #45a049;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Version info */
.version-info {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-top: 5px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    margin-bottom: 30px;
    color: white;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.title-section {
    flex: 1;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.language-selector select {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.language-selector select:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
}

.language-selector option {
    background: #333;
    color: white;
}

.device-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.device-card:hover {
    transform: translateY(-5px);
}

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 20px;
}

.device-header h2 {
    font-size: 1.8rem;
    color: #333;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
}

.status-indicator.online {
    background: #d4edda;
    color: #155724;
}

.status-indicator.offline {
    background: #f8d7da;
    color: #721c24;
}

.status-indicator i {
    animation: pulse 2s infinite;
}

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

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.metric-card.current-flow {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.metric-card.total-volume {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #333;
}

.metric-card.today-total {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #333;
}

.metric-card.pulse-count {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #333;
}

.metric-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.metric-content h3 {
    font-size: 0.9rem;
    margin-bottom: 5px;
    opacity: 0.9;
}

.metric-value {
    font-size: 2.2rem;
    font-weight: bold;
    line-height: 1;
}

.metric-unit {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 2px;
}

.metric-subtext {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 2px;
}

.device-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666;
}

.info-item i {
    color: #667eea;
    width: 20px;
}

.actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

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

.flow-visualization, .daily-history {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.flow-visualization h3, .daily-history h3 {
    margin-bottom: 20px;
    color: #333;
}

#flowChart, #dailyChart {
    width: 100%;
    background: #f8f9fa;
    border-radius: 10px;
}

#flowChart {
    height: 300px;
}

#dailyChart {
    height: 400px;
}

footer {
    text-align: center;
    color: white;
    opacity: 0.8;
    margin-top: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .device-card {
        padding: 20px;
    }
    
    .device-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .device-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .metric-value {
        font-size: 1.8rem;
    }
}

/* Animation for flowing beer */
.flowing {
    animation: flow 0.5s ease-in-out;
}

@keyframes flow {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}