/* Aqua Dashboard Styles - Light, Clean, Professional */

:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo svg {
    color: var(--primary);
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

.status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-muted);
}

.live-indicator {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

/* Tanks Grid */
.tanks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.tank-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.tank-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.tank-name {
    font-size: 20px;
    font-weight: 600;
}

.tank-location {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.tank-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-normal {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
    animation: danger-pulse 1.5s infinite;
}

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

/* Water Tank Visual */
.tank-visual {
    position: relative;
    height: 200px;
    background: #f1f5f9;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    border: 2px solid var(--border);
}

.water-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    transition: height 0.8s ease, background 0.5s ease;
    border-radius: 0 0 10px 10px;
}

.water-fill::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 20px;
    background: inherit;
    border-radius: 50%;
    opacity: 0.3;
}

.water-fill.normal {
    background: linear-gradient(180deg, #34d399 0%, #10b981 100%);
}

.water-fill.warning {
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
}

.water-fill.danger {
    background: linear-gradient(180deg, #f87171 0%, #ef4444 100%);
}

.water-percent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 42px;
    font-weight: 700;
    color: var(--text);
    text-shadow: 0 2px 4px rgba(255,255,255,0.8);
    z-index: 10;
}

/* Sensor Indicators */
.sensors {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.sensor {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid var(--border);
}

.sensor-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.sensor-status {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin: 0 auto;
    transition: background 0.3s;
}

.sensor-on {
    background: var(--success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.sensor-off {
    background: #cbd5e1;
}

/* Tank Info */
.tank-info {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text-muted);
}

.tank-info strong {
    color: var(--text);
    font-weight: 600;
}

/* Sparkline */
.sparkline-container {
    height: 40px;
    margin-top: 12px;
}

/* Alerts Section */
.alerts-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.alerts-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    transition: background 0.2s;
}

.alert-item:hover {
    background: #f8fafc;
}

.alert-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.alert-icon.critical {
    background: #fee2e2;
    color: #dc2626;
}

.alert-icon.warning {
    background: #fef3c7;
    color: #d97706;
}

.alert-icon.sent {
    background: #d1fae5;
    color: #059669;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    color: var(--text);
}

.alert-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.alert-status {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
}

.status-sent {
    background: #d1fae5;
    color: #065f46;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .tanks-grid {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .tank-visual {
        height: 160px;
    }
    
    .water-percent {
        font-size: 32px;
    }
}
/* Add these to the END of your existing style.css */

/* iOS PWA Install Prompt */
.ios-prompt {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    padding: 16px 20px;
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

.ios-prompt-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-size: 14px;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    padding-right: 30px;
}

.ios-prompt-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.ios-prompt-hint {
    display: block;
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}

.share-icon {
    display: inline-block;
    font-size: 16px;
    margin: 0 2px;
}

.ios-prompt-close {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ios-prompt-close:active {
    background: rgba(255,255,255,0.3);
}

/* iOS PWA mode adjustments */
body.ios-pwa .header {
    padding-top: 40px; /* Space for status bar */
}

body.ios-pwa {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1e293b;
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1001;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* iOS Safe Area support */
@supports (padding-top: env(safe-area-inset-top)) {
    body.ios-pwa .header {
        padding-top: calc(env(safe-area-inset-top) + 12px);
    }
    
    .app {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Smooth scrolling for iOS */
.dashboard {
    -webkit-overflow-scrolling: touch;
}

/* Prevent callout menu on long press */
.tank-card, .alert-item {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
}