:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #10b981;
    --danger: #ef4444;
    --bg-dark: #1e293b;
    --bg-light: #f8fafc;
    --border: #e2e8f0;
    --text-dark: #0f172a;
    --text-light: #64748b;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Login Screen */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    margin-bottom: 30px;
    text-align: center;
    color: var(--text-dark);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Main App */
.main-app {
    display: none;
}

.header {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 24px;
}

.status {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.status-indicator.connected {
    background: #d1fae5;
    color: var(--success);
}

.status-indicator.disconnected {
    background: #fee2e2;
    color: var(--danger);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    width: auto;
}

.grid {
    display: grid;
    grid-template-columns: 300px 1fr 350px;
    gap: 20px;
    margin-bottom: 20px;
}

/* Client List */
.client-list {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.client-list h2 {
    font-size: 18px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.refresh-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--primary);
    font-size: 18px;
}

.client-item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}

.client-id {
    font-weight: 600;
    color: var(--text-dark);
}

.client-ip {
    color: var(--text-light);
    font-size: 12px;
}

/* Command Tiles */
.command-tiles {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.command-tiles h2 {
    font-size: 18px;
    margin-bottom: 15px;
}

.tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.tile {
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
    color: white;
    padding: 24px 16px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.tile:active {
    transform: translateY(0);
}

/* Log Area */
.log-area {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.log-area h2 {
    font-size: 18px;
    margin-bottom: 15px;
}

.log-content {
    background: var(--bg-dark);
    color: #e2e8f0;
    padding: 15px;
    border-radius: 8px;
    height: 400px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.log-entry {
    margin-bottom: 8px;
    padding: 4px 0;
}

.log-time {
    color: #94a3b8;
    margin-right: 8px;
}

.log-entry.outgoing {
    color: #60a5fa;
}

.log-entry.incoming {
    color: #34d399;
}

.log-entry.system {
    color: #fbbf24;
    font-weight: 600;
}

.log-entry.error {
    color: #f87171;
}

.client-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 12px;
}

.client-table th,
.client-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #334155;
}

.client-table th {
    color: #94a3b8;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 1200px) {
    .grid {
        grid-template-columns: 1fr;
    }
    
    .tiles-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}
