:root {
    --bg: #0b0f15;
    --text: #e9eef6;
    --muted: #9fb0c2;
    --accent: #4d8de0;
    --accent-light: #6ba0ff;
    --accent-dark: #2c5aa0;
    --secondary: #ff8cc8;
    --border: rgba(255, 255, 255, 0.14);
    --glass: rgba(255, 255, 255, 0.06);
    --glass-dark: rgba(10, 12, 16, 0.7);
    --blur: 14px;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    --shadow-accent: 0 0 32px rgba(77, 141, 224, 0.3);
}

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

html, body {
    height: 100%;
    margin: 0;
    color: var(--text);
    background: radial-gradient(1200px 600px at 15% -10%, #132032, #0b0f15 50%),
        radial-gradient(900px 400px at 100% 10%, rgba(77, 141, 224, 0.18), transparent 60%);
    background-attachment: fixed;
    background-repeat: no-repeat;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

/* Header */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: linear-gradient(180deg, rgba(10, 12, 16, 0.85), rgba(10, 12, 16, 0.6));
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    text-align: center;
}

header h1 {
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 1.8rem;
    font-weight: 800;
}

/* Main Container */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Dashboard Grid */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Cards */
.card {
    background: linear-gradient(180deg, var(--glass), rgba(255, 255, 255, 0.04));
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-3px);
    border-color: rgba(77, 141, 224, 0.35);
}

.card h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
}

.device-count {
    font-size: 2rem;
    font-weight: bold;
    margin-top: 1rem;
    background: linear-gradient(90deg, var(--accent), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Buttons */
button {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    color: var(--text);
    padding: 10px 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95rem;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: rgba(77, 141, 224, 0.35);
}

button:active {
    transform: translateY(0);
}

#refresh-devices {
    background: linear-gradient(180deg, rgba(77, 141, 224, 0.25), rgba(77, 141, 224, 0.15));
    border-color: rgba(77, 141, 224, 0.55);
    color: white;
    width: 100%;
}

#get-info {
    background: linear-gradient(180deg, rgba(77, 141, 224, 0.25), rgba(77, 141, 224, 0.15));
    border-color: rgba(77, 141, 224, 0.55);
    color: white;
    margin-right: 0.5rem;
}

/* Device List */
.device-list {
    background: linear-gradient(180deg, var(--glass), rgba(255, 255, 255, 0.04));
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.list-container {
    max-height: 400px;
    overflow-y: auto;
}

ul#devices {
    list-style-type: none;
}

#devices li {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: var(--radius-sm);
    margin-bottom: 0.3rem;
}

#devices li:hover {
    background-color: rgba(77, 141, 224, 0.1);
}

#devices li.active {
    background: linear-gradient(135deg, rgba(77, 141, 224, 0.2), rgba(120, 180, 255, 0.1));
    border: 1px solid rgba(77, 141, 224, 0.4);
    font-weight: bold;
}

/* Device Details */
#device-details {
    background: linear-gradient(180deg, var(--glass), rgba(255, 255, 255, 0.04));
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

#device-details h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
}

#selected-device {
    color: var(--accent-light);
}

.action-buttons {
    margin: 1rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

#command-log {
    margin-top: 1.5rem;
}

#command-log h3 {
    font-size: 1.1rem;
    margin-bottom: 0.7rem;
    color: var(--text);
}

#command-history {
    background: linear-gradient(135deg, rgba(10, 12, 16, 0.5), rgba(20, 30, 48, 0.3));
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-family: monospace;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
    color: var(--muted);
    border: 1px solid var(--border);
    font-size: 0.9rem;
}

/* Utility Classes */
.hidden {
    display: none;
}

/* Visual Effects */
.floating-orb {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(77, 141, 224, 0.3), transparent 70%);
    filter: blur(40px);
    animation: float 15s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(20px, -20px) scale(1.05); }
    66% { transform: translate(-15px, 15px) scale(0.95); }
}

/* Footer */
footer {
    text-align: center;
    padding: 1rem;
    color: var(--muted);
    font-size: 0.8rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard {
        grid-template-columns: 1fr;
    }
    
    #device-details, .device-list, .card {
        padding: 1rem;
    }
    
    button {
        width: 100%;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}