/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.app-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 500;
}

.app-title .material-icons {
    font-size: 2rem;
}

/* Status Bar */
.status-bar {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.status-bar.online {
    background: #f1f8e9;
    border-color: #c8e6c9;
}

.status-bar.offline {
    background: #ffebee;
    border-color: #ffcdd2;
}

.status-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-indicator .material-icons {
    font-size: 20px;
}

.status-indicator.online .material-icons {
    color: #4caf50;
}

.status-indicator.offline .material-icons {
    color: #f44336;
}

.status-text {
    font-weight: 500;
}

.refresh-btn {
    background: #4caf50;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    background: #45a049;
    transform: translateY(-1px);
}

.refresh-btn .material-icons {
    font-size: 16px;
}

/* Tab Navigation */
.tab-container {
    flex: 1;
}

.tab-header {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 16px;
    color: #666;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: #f5f5f5;
    color: #4caf50;
}

.tab-btn.active {
    color: #4caf50;
    border-bottom-color: #4caf50;
    background: #f9f9f9;
}

.tab-btn .material-icons {
    font-size: 20px;
}

.tab-content {
    display: none;
    padding: 20px;
    min-height: 500px;
}

.tab-content.active {
    display: block;
}

/* Control Section */
.control-section {
    max-width: 600px;
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 30px;
}

.section-header h2 {
    color: #4caf50;
    margin-bottom: 8px;
    font-size: 1.8rem;
}

.section-header p {
    color: #666;
    font-size: 1rem;
}

.water-header h2 {
    color: #2196f3;
}

/* Light Controls Grid */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.light-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.light-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.light-card.online {
    border-color: #4caf50;
}

.light-card.offline {
    opacity: 0.6;
    pointer-events: none;
}

.light-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.light-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.light-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd54f, #ffb300);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.light-details h3 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 2px;
}

.light-status {
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
}

.light-status.on {
    color: #4caf50;
}

.light-status.off {
    color: #f44336;
}

/* Water Control Card */
.water-control-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.water-control-card.online {
    border-color: #2196f3;
}

.water-control-card.offline {
    opacity: 0.6;
    pointer-events: none;
}

.water-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #42a5f5, #1976d2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.water-icon .material-icons {
    font-size: 30px;
}

.water-info {
    flex: 1;
}

.water-info h3 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 5px;
}

.water-status {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 5px;
}

.water-status.on {
    color: #4caf50;
}

.water-status.off {
    color: #f44336;
}

.auto-off-info {
    color: #666;
    font-size: 0.9rem;
}

/* Switch Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4caf50;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Large Switch for Water Control */
.water-switch .switch {
    width: 60px;
    height: 30px;
}

.water-switch .slider:before {
    height: 24px;
    width: 24px;
    left: 3px;
    bottom: 3px;
}

.water-switch input:checked + .slider:before {
    transform: translateX(30px);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.loading-overlay.hidden {
    display: none;
}

.loading-content {
    text-align: center;
    color: #4caf50;
}

.loading-content h3 {
    margin: 20px 0 10px 0;
    font-size: 1.3rem;
}

.loading-content p {
    color: #666;
    font-size: 1rem;
}

/* Spinner Animation */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4caf50;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Snackbar */
.snackbar {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: white;
    text-align: center;
    border-radius: 25px;
    padding: 16px;
    position: fixed;
    z-index: 1001;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 17px;
}

.snackbar.show {
    visibility: visible;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

.snackbar.warning {
    background-color: #ff9800;
}

.snackbar.error {
    background-color: #f44336;
}

.snackbar.success {
    background-color: #4caf50;
}

@keyframes fadein {
    from {bottom: 0; opacity: 0;}
    to {bottom: 30px; opacity: 1;}
}

@keyframes fadeout {
    from {bottom: 30px; opacity: 1;}
    to {bottom: 0; opacity: 0;}
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        box-shadow: none;
    }
    
    .app-title {
        font-size: 1.3rem;
    }
    
    .controls-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .water-control-card {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .water-info {
        order: 1;
    }
    
    .water-switch {
        order: 2;
    }
    
    .tab-btn {
        font-size: 14px;
        padding: 12px 10px;
    }
    
    .status-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* Additional Animations */
.fade-in {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}