/**
 * io-module.html specific styles
 * Modbus I/O Module Control Panel
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

h1 {
    color: white;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    color: rgba(255,255,255,0.9);
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.config-panel {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.config-panel h3 {
    margin-bottom: 15px;
    color: #333;
}

.config-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 15px;
}

.config-row label {
    font-weight: 600;
    color: #333;
    min-width: 150px;
}

.config-row input {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.config-row button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.3s;
}

.config-row button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(600px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.panel {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.panel h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

/* Digital Inputs (LEDs/Lampen) */
.input-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.input-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.3s;
}

.input-led {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-bottom: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s;
    border: 3px solid #ddd;
}

.input-led.active {
    background: #28a745;
    box-shadow: 0 0 20px #28a745, 0 0 40px #28a745;
    border-color: #28a745;
}

.input-led.inactive {
    background: #6c757d;
    border-color: #6c757d;
}

.input-label {
    font-weight: 600;
    color: #333;
    font-size: 0.9em;
}

.input-status {
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
}

/* Digital Outputs (Switches) */
.output-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.output-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.3s;
}

.output-item:hover {
    background: #e9ecef;
}

.output-info {
    display: flex;
    flex-direction: column;
}

.output-label {
    font-weight: 600;
    color: #333;
    font-size: 1em;
}

.output-status {
    font-size: 0.85em;
    color: #666;
    margin-top: 3px;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.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: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #28a745;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8em;
    font-weight: 600;
    margin-left: 10px;
}

.status-badge.online {
    background: #d4edda;
    color: #155724;
}

.status-badge.offline {
    background: #f8d7da;
    color: #721c24;
}

/* Loading */
.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: 1fr;
    }

    .input-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .output-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 1.8em;
    }
}
