:root {
    --bg-color: #0F172A;
    --card-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --accent-color: #38BDF8;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 480px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #38BDF8, #818CF8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Connection Status */
#connection-status {
    font-size: 14px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 12px;
    display: inline-block;
    transition: all 0.3s ease;
}

.status-disconnected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.status-connected {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

/* Buttons */
button {
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    padding: 14px;
}

button:active {
    transform: scale(0.96);
}

.btn-primary {
    background: linear-gradient(135deg, #38BDF8, #2563EB);
    color: white;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

/* Color specific buttons */
.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-text {
    background: transparent;
    color: var(--accent-color);
    width: auto;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 500;
}

/* Grids */
.button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
}

/* Overlay to disable controls when disconnected */
.disabled-overlay {
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.disabled-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Speed Controls */
.speed-display {
    text-align: center;
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 20px;
}

.speed-display .unit {
    font-size: 16px;
    color: var(--text-secondary);
    margin-left: 4px;
}

.styled-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
    margin: 20px 0;
}

.styled-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.quick-speeds {
    margin-bottom: 16px;
}

/* Inputs */
.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

input[type="text"] {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    border-color: var(--accent-color);
}

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }

/* Collapsible */
.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.collapsible-header h2 {
    margin-bottom: 0;
}

.collapsible-content {
    margin-top: 16px;
    transition: all 0.3s ease;
}

.hidden {
    display: none;
}

/* Console Log */
.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.log-window {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 12px;
    height: 120px;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: #A0AEC0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-entry.tx { color: #818CF8; }
.log-entry.rx { color: #34D399; }
.log-entry.error { color: #EF4444; }
.log-entry.info { color: #94A3B8; }

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.toast {
    background: var(--text-primary);
    color: var(--bg-color);
    padding: 12px 24px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.3s ease forwards;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(-10px); }
}
