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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    margin-bottom: 1.5rem;
    text-align: center;
    color: #333;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group button {
    width: 100%;
    padding: 0.75rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.form-group button:hover {
    background: #5a67d8;
}

.error-message {
    color: #e74c3c;
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
}

/* Dashboard */
.dashboard {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 1.5rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-connected {
    color: #2ecc71;
    font-weight: bold;
}

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

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.left-panel, .right-panel {
    padding: 1rem;
    overflow-y: auto;
}

.left-panel {
    flex: 1;
    max-width: 600px;
    border-right: 1px solid #ddd;
}

.right-panel {
    flex: 1.5;
}

/* Panels */
.panel {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.panel h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #444;
}

/* Connection Form */
.connection-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.form-row label {
    min-width: 100px;
    font-size: 0.9rem;
    color: #666;
}

.form-row input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

button {
    padding: 0.5rem 1rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

button:hover:not(:disabled) {
    background: #5a67d8;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Command Form */
.command-form input {
    width: 100%;
    padding: 0.75rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 1.1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.decoded-message {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    font-size: 0.9rem;
    min-height: 50px;
}

/* Tables */
.components-table, .history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.components-table th, .history-table th {
    background: #f8f9fa;
    padding: 0.5rem;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
}

.components-table td, .history-table td {
    padding: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.history-table tbody tr:hover {
    background: #f8f9fa;
    cursor: pointer;
}

.history-table tbody tr.selected {
    background: #e3f2fd;
}

/* Traffic Monitor */
.traffic-panel {
    height: 500px;
    display: flex;
    flex-direction: column;
}

.traffic-monitor {
    flex: 1;
    background: #1e1e1e;
    color: #e0e0e0;
    padding: 1rem;
    border-radius: 4px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.traffic-controls {
    margin-bottom: 1rem;
}

/* Example Commands */
.example-commands {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.example-commands button {
    text-align: left;
    padding: 0.75rem;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .left-panel, .right-panel {
        max-width: 100%;
    }

    .left-panel {
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    .example-commands {
        grid-template-columns: 1fr;
    }
}