/* Reset و پایه */
* {
    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;
    direction: rtl;
    line-height: 1.6;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* هدر */
.header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 25px;
    text-align: center;
    border-bottom: 4px solid #3498db;
}

.header h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    font-weight: 300;
}

.status-bar {
    font-size: 1.1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* وضعیت‌ها */
.status-connected {
    color: #2ecc71;
    font-weight: bold;
}

.status-disconnected {
    color: #e74c3c;
    font-weight: bold;
}

.status-unknown {
    color: #f39c12;
    font-weight: bold;
}

.status-on {
    color: #27ae60;
    font-weight: bold;
}

.status-off {
    color: #c0392b;
    font-weight: bold;
}

/* بخش کنترل */
.control-section {
    padding: 30px;
    border-bottom: 2px solid #ecf0f1;
}

.control-section h2 {
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 1.8rem;
    text-align: center;
}

.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.device-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #ecf0f1;
    transition: all 0.3s ease;
}

.device-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-color: #3498db;
}

.device-card h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.device-status {
    margin: 15px 0;
    font-size: 1.1rem;
}

.device-info {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ecf0f1;
}

.device-info small {
    color: #7f8c8d;
    font-family: monospace;
}

/* دکمه‌ها */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    margin: 5px;
    min-width: 140px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #219a52;
    transform: scale(1.05);
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c0392b;
    transform: scale(1.05);
}

.btn-waiting {
    background: #95a5a6;
    color: white;
    cursor: wait;
}

.btn-secondary {
    background: #7f8c8d;
    color: white;
}

.btn-secondary:hover {
    background: #636e72;
}

/* کنترل گروهی */
.group-control {
    text-align: center;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-top: 20px;
}

.group-control h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.group-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* بخش لاگ */
.logs-section {
    padding: 30px;
}

.logs-section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.logs-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.log-container {
    background: #2c3e50;
    color: white;
    padding: 20px;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.log-entry {
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 4px;
    border-right: 4px solid;
}

.log-info {
    background: #34495e;
    border-right-color: #3498db;
}

.log-success {
    background: #27ae60;
    border-right-color: #2ecc71;
}

.log-error {
    background: #c0392b;
    border-right-color: #e74c3c;
}

.log-warning {
    background: #d35400;
    border-right-color: #e67e22;
}

.log-time {
    color: #bdc3c7;
    margin-left: 10px;
}

.log-message {
    color: #ecf0f1;
}

/* فوتر */
.footer {
    background: #34495e;
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 30px;
}

.footer p {
    font-size: 0.9rem;
}

/* رسپانسیو */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 10px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .devices-grid {
        grid-template-columns: 1fr;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .group-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* اسکرول بار سفارشی */
.log-container::-webkit-scrollbar {
    width: 8px;
}

.log-container::-webkit-scrollbar-track {
    background: #34495e;
    border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 4px;
}

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