* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* Login Section */
.login-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header h1 {
    color: #2e7d32;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.login-header p {
    color: #666;
    margin-bottom: 30px;
}

.login-form {
    text-align: left;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #2e7d32;
}

.login-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #2e7d32, #4caf50);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.login-btn:hover {
    transform: translateY(-2px);
}

/* Main Application */
.main-app {
    background: #f8f9fa;
    min-height: 100vh;
}

/* Header */
header {
    background: linear-gradient(135deg, #2e7d32 0%, #4caf50 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h1 {
    font-size: 2rem;
    margin-bottom: 5px;
}

.app-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Status Bar */
.status-bar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.voltage-section h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.voltage-readings {
    display: flex;
    gap: 15px;
}

.voltage-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    text-align: center;
    flex: 1;
}

.voltage-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #2e7d32;
    margin-bottom: 5px;
}

.voltage-label {
    color: #666;
    font-size: 0.9rem;
}

.control-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.motor-status-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.motor-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
}

.motor-light {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ccc;
    position: relative;
}

.motor-light.on {
    background: #4caf50;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
    animation: pulse 2s infinite;
}

.motor-light.off {
    background: #f44336;
    box-shadow: 0 0 15px rgba(244, 67, 54, 0.5);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.motor-text {
    font-weight: 600;
    font-size: 1.1rem;
    color: #333;
}

.motor-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.start-btn {
    background: #4caf50;
    color: white;
}

.start-btn:hover {
    background: #3d8b40;
    transform: translateY(-2px);
}

.stop-btn {
    background: #f44336;
    color: white;
}

.stop-btn:hover {
    background: #d32f2f;
    transform: translateY(-2px);
}

.active-valves-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    min-height: 120px;
}

.active-valves-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    color: #333;
    font-weight: 600;
}

.active-valves-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 40px;
    align-items: center;
}

.active-valve-tag {
    background: #4caf50;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: pulse 2s infinite;
}

.no-active, .no-valves {
    color: #666;
    font-style: italic;
    text-align: center;
    width: 100%;
}

/* Navigation */
.main-nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.nav-btn {
    flex: 1;
    padding: 20px;
    border: none;
    background: transparent;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #666;
}

.nav-btn:hover {
    background: #f8f9fa;
}

.nav-btn.active {
    background: #2e7d32;
    color: white;
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    margin-bottom: 30px;
    text-align: center;
}

.section-header h2 {
    color: #333;
    font-size: 2rem;
    margin-bottom: 10px;
}

.section-header p {
    color: #666;
    font-size: 1.1rem;
}

/* Valves Grid */
.valves-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

.valve-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-left: 5px solid #2e7d32;
}

.valve-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.valve-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.valve-title {
    font-size: 1.4rem;
    font-weight: bold;
    color: #2e7d32;
}

.valve-status {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
}

.valve-active {
    background: #e8f5e9;
    color: #2e7d32;
}

.valve-inactive {
    background: #ffebee;
    color: #c62828;
}

.valve-timing {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border: 2px solid #e9ecef;
}

.timing-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.timing-slot {
    text-align: center;
    padding: 8px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.timing-label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 4px;
}

.timing-value {
    font-weight: 600;
    color: #333;
    font-family: 'Courier New', monospace;
}

.valve-duration {
    background: #e8f5e9;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    color: #2e7d32;
    margin-top: 10px;
}

.timer-display {
    text-align: center;
    font-size: 2.2rem;
    font-weight: bold;
    margin: 25px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    color: #2e7d32;
    border: 3px solid #e9ecef;
}

.valve-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.valve-btn {
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.valve-btn.start {
    background: #4caf50;
    color: white;
}

.valve-btn.start:hover {
    background: #3d8b40;
}

.valve-btn.pause {
    background: #ff9800;
    color: white;
}

.valve-btn.pause:hover {
    background: #f57c00;
}

.valve-btn.reset {
    background: #f44336;
    color: white;
}

.valve-btn.reset:hover {
    background: #d32f2f;
}

.valve-btn.edit {
    background: #2196f3;
    color: white;
}

.valve-btn.edit:hover {
    background: #0b7dda;
}

/* Schedule Container */
.schedule-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.running-valves h3, .scheduled-valves h3 {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333;
}

.running-valves h3 {
    color: #2e7d32;
    border-bottom-color: #2e7d32;
}

.scheduled-valves h3 {
    color: #2196f3;
    border-bottom-color: #2196f3;
}

.valves-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.schedule-item {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    border-left: 4px solid #2e7d32;
}

.schedule-item.scheduled {
    border-left-color: #2196f3;
}

.schedule-info h4 {
    color: #333;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.schedule-time {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.time-slot {
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    text-align: center;
}

.time-label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 4px;
}

.time-value {
    font-weight: 600;
    color: #333;
    font-family: 'Courier New', monospace;
}

.schedule-duration {
    background: #e8f5e9;
    padding: 8px 12px;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    color: #2e7d32;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h3 {
    color: #333;
    font-size: 1.5rem;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: #f44336;
}

.duration-display {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
    border: 2px solid #e9ecef;
}

.duration-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.duration-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #2e7d32;
    font-family: 'Courier New', monospace;
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #2e7d32;
    color: white;
}

.btn-primary:hover {
    background: #1b5e20;
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 2px solid #e0e0e0;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: #4caf50;
}

.notification.error {
    background: #f44336;
}

.notification.warning {
    background: #ff9800;
}

.notification.info {
    background: #2196f3;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .status-bar {
        grid-template-columns: 1fr;
    }
    
    .schedule-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .voltage-readings {
        flex-direction: column;
    }
    
    .motor-status-card {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .valves-grid {
        grid-template-columns: 1fr;
    }
    
    .main-nav {
        flex-direction: column;
    }
    
    .valve-controls {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .timing-row {
        grid-template-columns: 1fr;
    }
    
    .schedule-time {
        grid-template-columns: 1fr;
    }
    
    .active-valves-list {
        justify-content: center;
    }

    /* AM/PM Time Input Styles */
.time-input-group {
    margin-bottom: 20px;
}

.time-input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.time-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-hour, .time-minute, .time-period {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
}

.time-hour {
    width: 80px;
}

.time-minute {
    width: 80px;
}

.time-period {
    width: 100px;
}

.time-inputs span {
    font-weight: 600;
    color: #666;
}

/* Voltage warning colors */
.voltage-warning {
    color: #f44336 !important;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Motor status for voltage issues */
.motor-voltage-warning {
    color: #ff9800;
    font-weight: 600;
}




}