/**
 * Faceplate Modal Styles
 * HVAC Component Parameter Editor
 */

/* ============================================
   Overlay
   ============================================ */

.faceplate-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

/* ============================================
   Modal Container
   ============================================ */

.faceplate-modal {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    min-width: 400px;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: faceplateSlideIn 0.2s ease-out;
}

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

/* ============================================
   Header
   ============================================ */

.faceplate-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1F94B9, #167a96);
    color: white;
    border-radius: 8px 8px 0 0;
}

.faceplate-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.faceplate-close {
    font-size: 28px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.15s;
    line-height: 1;
}

.faceplate-close:hover {
    opacity: 1;
}

/* ============================================
   Body
   ============================================ */

.faceplate-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    max-height: 60vh;
}

.faceplate-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.faceplate-loading::before {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 3px solid #e0e0e0;
    border-top-color: #1F94B9;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.faceplate-empty {
    text-align: center;
    padding: 40px;
    color: #888;
}

/* ============================================
   Section Title
   ============================================ */

.faceplate-section-title {
    font-weight: 600;
    font-size: 14px;
    color: #1F94B9;
    margin: 20px 0 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e0e0e0;
}

.faceplate-section-title:first-child {
    margin-top: 0;
}

/* ============================================
   Parameter Control
   ============================================ */

.faceplate-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s;
}

.faceplate-control:last-child {
    border-bottom: none;
}

.faceplate-control:hover {
    background-color: #f8f9fa;
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
}

.faceplate-control.modified {
    background-color: #fff8e6;
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
    border-left: 3px solid #ffc107;
}

.faceplate-label {
    font-weight: 500;
    color: #333;
    flex: 0 0 45%;
    font-size: 14px;
}

.faceplate-input {
    flex: 0 0 55%;
    text-align: right;
}

/* ============================================
   Button Groups
   ============================================ */

.faceplate-input .btn-group {
    display: inline-flex;
}

.faceplate-input .btn-group .btn {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 0;
}

.faceplate-input .btn-group .btn:first-child {
    border-radius: 4px 0 0 4px;
}

.faceplate-input .btn-group .btn:last-child {
    border-radius: 0 4px 4px 0;
}

.faceplate-input .btn.active {
    font-weight: 600;
}

/* ============================================
   Slider
   ============================================ */

.slider-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.slider-btn-dec,
.slider-btn-inc {
    width: 28px;
    height: 28px;
    padding: 0;
    line-height: 1;
    font-size: 18px;
    font-weight: bold;
}

.faceplate-slider {
    flex: 1;
    min-width: 100px;
    cursor: pointer;
}

.slider-value {
    min-width: 70px;
    text-align: right;
    font-family: monospace;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

/* ============================================
   Footer
   ============================================ */

.faceplate-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    border-top: 1px solid #e0e0e0;
}

.faceplate-footer .btn {
    padding: 8px 20px;
    font-size: 14px;
}

/* ============================================
   Progress Indicator
   ============================================ */

.faceplate-progress {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    border-top: 1px solid #e0e0e0;
}

.progress-container {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #1F94B9, #28a745);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-bar.progress-bar-warning {
    background: linear-gradient(90deg, #ffc107, #fd7e14);
    animation: pulse 1s infinite;
}

.progress-bar.progress-bar-success {
    background: #28a745;
}

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

.progress-status {
    text-align: center;
    font-size: 14px;
    color: #666;
}

/* ============================================
   Error Display
   ============================================ */

.faceplate-error {
    background: #fff5f5;
    border: 1px solid #f8d7da;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
}

.faceplate-error h5 {
    color: #c82333;
    margin: 0 0 8px;
}

.faceplate-error p {
    margin: 8px 0;
    color: #721c24;
}

.faceplate-error.faceplate-critical {
    background: #fff3cd;
    border-color: #ffc107;
}

.faceplate-error.faceplate-critical h5 {
    color: #856404;
}

.faceplate-error.faceplate-critical p {
    color: #856404;
}

.faceplate-error ul {
    margin: 8px 0;
    padding-left: 20px;
}

.faceplate-error li {
    color: #856404;
    margin: 4px 0;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 600px) {
    .faceplate-modal {
        min-width: 95%;
        max-width: 95%;
        margin: 10px;
        max-height: 90vh;
    }
    
    .faceplate-control {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .faceplate-label {
        flex: none;
        width: 100%;
    }
    
    .faceplate-input {
        flex: none;
        width: 100%;
        text-align: left;
    }
    
    .slider-container {
        width: 100%;
    }
    
    .faceplate-slider {
        min-width: 60%;
    }
}

/* ============================================
   Dark Mode Support
   ============================================ */

@media (prefers-color-scheme: dark) {
    .faceplate-modal {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .faceplate-header {
        background: linear-gradient(135deg, #1a7a96, #156278);
    }
    
    .faceplate-body {
        background: #2d2d2d;
    }
    
    .faceplate-section-title {
        color: #5cc4e0;
        border-bottom-color: #444;
    }
    
    .faceplate-control {
        border-bottom-color: #444;
    }
    
    .faceplate-control:hover {
        background-color: #383838;
    }
    
    .faceplate-control.modified {
        background-color: #3d3820;
        border-left-color: #ffc107;
    }
    
    .faceplate-label {
        color: #e0e0e0;
    }
    
    .slider-value {
        color: #e0e0e0;
    }
    
    .faceplate-footer {
        background: #252525;
        border-top-color: #444;
    }
    
    .faceplate-progress {
        background: #252525;
        border-top-color: #444;
    }
    
    .progress-container {
        background: #444;
    }
}
