﻿/* PLC Device Control Styles */
.plc-control-container {
    padding: 20px;
    background: #f5f8fa;
    min-height: 100vh;
}

/* Header */
.plc-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.plc-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.plc-title {
    color: white;
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
}

.plc-subtitle {
    color: rgba(255, 255, 255, 0.8);
    margin: 5px 0 0 0;
    font-size: 1.1rem;
}

/* Connection Status */
.plc-connection-status {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 15px 25px;
    border-radius: 15px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #dc3545;
    animation: pulse 2s infinite;
}

.status-indicator.connected .status-dot {
    background: #28a745;
}

.status-text {
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Cards */
.card-custom {
    border: none;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

    .card-custom:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    }

.card-header {
    background: transparent;
    border-bottom: 2px solid #f1f3f4;
    padding: 20px 25px;
}

.card-title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: #181C32;
    display: flex;
    align-items: center;
}

/* Sensors Grid */
.sensors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.sensor-item {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

    .sensor-item:hover {
        transform: scale(1.05);
    }

.sensor-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.sensor-name {
    font-weight: 600;
    color: #5e6278;
}

.sensor-register {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #7e8299;
}

.sensor-value {
    margin: 15px 0;
}

.value-display {
    font-size: 2rem;
    font-weight: 700;
    color: #181C32;
}

.value-unit {
    font-size: 1.2rem;
    color: #7e8299;
    margin-right: 5px;
}

.sensor-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

    .sensor-status.active {
        background: rgba(40, 167, 69, 0.1);
        color: #28a745;
    }

    .sensor-status .status-indicator {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: currentColor;
    }

/* Commands Grid */
.commands-grid {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.command-group {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
}

.command-group-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #5e6278;
    margin-bottom: 15px;
}

.command-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-command {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px 25px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 100px;
}

    .btn-command:hover {
        transform: translateY(-3px);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    }

.btn-start {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-stop {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-fan {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-gas {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

/* Temperature Controls */
.temperature-controls {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.temp-control-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

    .temp-control-item label {
        font-size: 0.9rem;
        font-weight: 600;
        color: #5e6278;
    }

.temp-input-group {
    display: flex;
    gap: 5px;
}

    .temp-input-group input {
        flex: 1;
        border-radius: 8px;
        border: 2px solid #e4e6ef;
        padding: 8px 12px;
    }

        .temp-input-group input:focus {
            border-color: #009EF7;
            outline: none;
        }

/* Outputs Grid */
.outputs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.output-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

    .output-item.active {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
    }

        .output-item.active .output-icon,
        .output-item.active .output-info {
            color: white;
        }

.output-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
}

.output-item.active .output-icon {
    background: rgba(255, 255, 255, 0.2);
}

.output-info {
    flex: 1;
}

.output-name {
    display: block;
    font-weight: 600;
    font-size: 1rem;
}

.output-status {
    display: block;
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Log Container */
.log-container {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
}

.log-item {
    display: flex;
    gap: 15px;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: white;
    border-right: 4px solid #e4e6ef;
}

    .log-item.success {
        border-right-color: #28a745;
    }

    .log-item.error {
        border-right-color: #dc3545;
    }

    .log-item.info {
        border-right-color: #17a2b8;
    }

.log-time {
    color: #7e8299;
    font-size: 0.85rem;
    font-weight: 600;
}

.log-message {
    flex: 1;
    color: #181C32;
}

/* Animations */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .plc-header-content {
        flex-direction: column;
        gap: 20px;
    }

    .plc-title {
        font-size: 1.5rem;
    }

    .sensors-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .command-buttons {
        flex-direction: column;
    }

    .btn-command {
        width: 100%;
    }
}

/* Custom Scrollbar */
.log-container::-webkit-scrollbar {
    width: 8px;
}

.log-container::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 10px;
}

.log-container::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

    .log-container::-webkit-scrollbar-thumb:hover {
        background: #a0aec0;
    }
