:root {
    --bg-color: #0d0e15;
    --card-bg: rgba(30, 31, 42, 0.6);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-color: #e2e8f0;
    --text-muted: #94a3b8;
    --primary: #8b5cf6;
    --primary-hover: #a78bfa;
    --primary-glow: rgba(139, 92, 246, 0.4);
    --secondary: #3b82f6;
    --secondary-hover: #60a5fa;
    --border: rgba(255, 255, 255, 0.1);
    --error: #ef4444;
    --success: #10b981;
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glass-blur: blur(16px);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

header {
    background: rgba(13, 14, 21, 0.8);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #a78bfa, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

nav {
    display: flex;
    background: rgba(30, 31, 42, 0.4);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    padding: 0 2rem;
    gap: 1rem;
    scrollbar-width: none;
}
nav::-webkit-scrollbar { display: none; }

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 1.25rem 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
}

.tab-btn:hover {
    color: var(--text-color);
}

.tab-btn.active {
    color: var(--primary-hover);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    box-shadow: 0 -2px 10px var(--primary-glow);
    border-radius: 2px 2px 0 0;
}

main {
    flex: 1;
    padding: 2.5rem 2rem;
    max-width: 860px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.tab-content {
    display: none;
    animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.tab-content.active {
    display: block;
}

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

h2, h3 {
    color: #fff;
    margin-top: 0;
    font-weight: 600;
    letter-spacing: -0.01em;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}

.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-color);
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

.checkbox-group label {
    margin-bottom: 0;
    margin-left: 0.75rem;
    cursor: pointer;
}

input[type="checkbox"] {
    accent-color: var(--primary);
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
}

input[type="text"],
input[type="password"],
input[type="url"],
select,
textarea {
    background-color: rgba(15, 16, 22, 0.7);
    border: 1px solid var(--border);
    color: var(--text-color);
    padding: 0.85rem 1rem;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2), inset 0 2px 4px rgba(0,0,0,0.2);
}

input:disabled, select:disabled, textarea:disabled {
    background-color: rgba(30, 31, 42, 0.3);
    color: var(--text-muted);
    cursor: not-allowed;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
    margin-top: 0.5rem;
}

small {
    color: var(--text-muted);
    margin-top: 0.4rem;
    display: block;
    font-size: 0.85rem;
}

.btn {
    padding: 0.85rem 1.75rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:active {
    transform: scale(0.97);
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    box-shadow: 0 4px 12px var(--primary-glow);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.btn.primary:hover:not(:disabled) {
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.6);
    transform: translateY(-1px);
}

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

.btn.secondary:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.1);
}

.btn.warning {
    background: linear-gradient(135deg, #ef4444, #f87171);
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn.warning:hover:not(:disabled) {
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--border);
    box-shadow: none;
    color: var(--text-muted);
}

.actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.card {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

pre {
    background-color: rgba(0, 0, 0, 0.4);
    padding: 1.25rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    overflow-x: auto;
    font-size: 0.85rem;
    color: #a9b7c6;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px) scale(0.9);
    background: rgba(16, 185, 129, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    padding: 1rem 2rem;
    border-radius: 100px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
}

.ota-progress-bar {
    width: 100%;
    height: 14px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 100px;
    overflow: hidden;
    margin: 0.75rem 0;
    border: 1px solid var(--border);
}

.ota-progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #10b981, #34d399);
    border-radius: 100px;
    transition: width 0.3s ease;
}

.test-result {
    margin-top: 1.25rem;
    font-weight: 600;
    padding: 1rem;
    border-radius: 10px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border);
}

.success { color: var(--success); border-color: rgba(16, 185, 129, 0.3); background: rgba(16, 185, 129, 0.1); }
.error { color: var(--error); border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.1); }

.centered-card {
    max-width: 450px;
    margin: 5rem auto;
    text-align: center;
}
.centered-card h2 {
    margin-bottom: 1rem;
    font-size: 2rem;
}
.centered-card p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}
.view {
    display: none;
    flex-direction: column;
    min-height: 100vh;
}

.badge {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 100px;
    margin-left: 0.75rem;
    vertical-align: middle;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 2px 8px var(--primary-glow);
}
