/* Tuya Water Sensor Styles */

/* Wrapper for the entire plugin output */
.tuya-water-sensor-wrapper {
    max-width: 1200px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Header Section */
.tuya-sensor-header {
    background: #fff;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    text-align: center;
}

.tuya-sensor-header h1 {
    margin: 0;
    color: #333;
    font-size: 28px;
}

.tuya-sensor-header p {
    margin: 10px 0 0 0;
    color: #666;
    font-size: 16px;
}

.tuya-water-sensor-container {
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Error Messages */
.tuya-water-sensor-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
}

/* Water Visualization */
.tuya-water-visualization {
    background: #fff;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.tuya-water-visualization h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
    text-align: center;
}

.water-tank-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.water-tank {
    width: 300px;
    height: 400px;
    border: 3px solid #333;
    border-radius: 10px;
    background: linear-gradient(to bottom, #e8f4f8 0%, #f0f8fc 100%);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.water-level {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to bottom, #4a90e2 0%, #2171d4 100%);
    transition: height 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
}

.water-level-text {
    color: white;
    font-size: 32px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.water-info {
    flex: 1;
    min-width: 250px;
}

.water-info p {
    font-size: 18px;
    margin: 15px 0;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 5px;
    border-left: 4px solid #4a90e2;
}

.liquid-depth-value {
    color: #333;
}

.last-update-time {
    color: #666;
    font-size: 14px;
}

/* Information Cards */
.tuya-info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.tuya-card {
    background: #fff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tuya-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.tuya-card.card-alert {
    background: #dc3545;
    color: white;
}

.tuya-card.card-alert h4,
.tuya-card.card-alert .card-value {
    color: white;
}

.card-icon {
    font-size: 48px;
    opacity: 0.8;
}

.card-content {
    flex: 1;
}

.card-content h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #666;
    font-weight: 500;
}

.tuya-card.card-alert .card-content h4 {
    color: rgba(255, 255, 255, 0.9);
}

.card-value {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin: 0;
}

/* Sensor Configuration */
.tuya-sensor-config {
    background: #fff;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.tuya-sensor-config h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
    text-align: center;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #4a90e2;
}

.config-label {
    font-weight: 500;
    color: #555;
}

.config-value {
    font-weight: bold;
    color: #333;
    font-size: 18px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tuya-water-sensor-container {
        padding: 0 15px;
    }
    
    .water-tank-container {
        flex-direction: column;
    }
    
    .water-tank {
        width: 100%;
        max-width: 300px;
        height: 350px;
    }
    
    .tuya-info-cards {
        grid-template-columns: 1fr;
    }
    
    .config-grid {
        grid-template-columns: 1fr;
    }
    
    .water-level-text {
        font-size: 24px;
    }
    
    .card-value {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .water-tank {
        height: 300px;
    }
    
    .water-level-text {
        font-size: 20px;
    }
    
    .card-icon {
        font-size: 36px;
    }
    
    .card-value {
        font-size: 20px;
    }
}

/* Chart Section */
.tuya-chart-section {
    background: #fff;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 30px;
}

.tuya-chart-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
    text-align: center;
}

/* Chart Controls */
.chart-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.chart-select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    background: #fff;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.chart-select:hover {
    border-color: #4a90e2;
}

.chart-select:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

.chart-container canvas {
    max-height: 400px;
}

@media (max-width: 768px) {
    .tuya-sensor-header h1 {
        font-size: 22px;
    }
    
    .tuya-sensor-header p {
        font-size: 14px;
    }
    
    .chart-container {
        height: 300px;
    }
    
    .chart-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group {
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .tuya-sensor-header h1 {
        font-size: 18px;
    }
    
    .tuya-sensor-header {
        padding: 20px;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .control-group label {
        font-size: 13px;
    }
    
    .chart-select {
        font-size: 13px;
        padding: 6px 10px;
    }
}
