:root {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-nav: rgba(15, 23, 42, 0.95);
    --bg-input: #0f172a;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --primary: #38bdf8;
    --primary-2: #0ea5e9;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #eab308;
}
[data-theme="light"] {
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-nav: rgba(255, 255, 255, 0.95);
    --bg-input: #f1f5f9;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --primary: #0ea5e9;
    --primary-2: #0284c7;
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', -apple-system, sans-serif; }
body {
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: 0.3s;
    min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; transition: 0.2s; }
a:hover { opacity: 0.8; }

/* NAVBAR */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-nav);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
}
.navbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.hamburger {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.5em;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    transition: 0.2s;
}
.hamburger:hover { background: var(--bg-card); }
.logo {
    font-size: 1.25em;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}
.logo-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1em;
    box-shadow: 0 4px 15px rgba(56,189,248,0.4);
}
.logo-text span { color: var(--primary); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}
.icon-btn:hover { background: var(--bg-card); }

/* SIDEBAR MENU */
.sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    z-index: 1000;
    transition: 0.3s;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
}
.sidebar.open { left: 0; }
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 999;
    display: none;
    backdrop-filter: blur(4px);
}
.sidebar-overlay.open { display: block; }
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sidebar-title { font-weight: 800; font-size: 1.1em; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.sidebar-close { background: transparent; border: none; color: var(--text-muted); font-size: 1.3em; cursor: pointer; padding: 5px; }
.sidebar-nav { padding: 15px; }
.sidebar-label {
    font-size: 0.75em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    padding: 10px 15px 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-label i { color: var(--primary); }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: 10px;
    color: var(--text);
    font-weight: 500;
    font-size: 0.95em;
    transition: 0.2s;
    margin-bottom: 2px;
    cursor: pointer;
}
.sidebar-link:hover { background: rgba(56,189,248,0.1); color: var(--primary); }
.sidebar-link i { width: 20px; text-align: center; color: var(--text-muted); font-size: 1.1em; }
.sidebar-link:hover i { color: var(--primary); }

/* NEWS */
.news-item {
    padding: 12px 15px;
    border-radius: 10px;
    background: rgba(56,189,248,0.05);
    margin-bottom: 8px;
    border-left: 3px solid var(--primary);
    display: block;
    color: inherit;
    transition: 0.2s;
}
.news-item:hover { background: rgba(56,189,248,0.1); opacity: 1; }
.news-item h4 { font-size: 0.85em; margin-bottom: 4px; line-height: 1.35; font-weight: 600; }
.news-item small { font-size: 0.72em; color: var(--text-muted); }

/* MAIN */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}
.hero {
    text-align: center;
    padding: 40px 20px 30px;
}
.hero h1 {
    font-size: 2.8em;
    font-weight: 800;
    margin-bottom: 10px;
    line-height: 1.2;
}
.hero h1 span {
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero p { color: var(--text-muted); font-size: 1.1em; max-width: 600px; margin: 0 auto; }

/* SPEEDTEST */
.speedtest-card {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 40px 30px;
    border: 1px solid var(--border);
    max-width: 700px;
    margin: 0 auto 40px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}
.speedtest-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(56,189,248,0.08), transparent 60%);
    pointer-events: none;
}
.speedtest-gauge {
    width: 220px;
    height: 220px;
    margin: 0 auto 30px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) 0%, var(--border) 0%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 0.3s;
}
.speedtest-gauge::before {
    content: '';
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    background: var(--bg-card);
    z-index: 0;
}
.speedtest-gauge-inner {
    position: relative;
    z-index: 1;
    text-align: center;
}
.speedtest-value {
    font-size: 3.5em;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}
.speedtest-unit {
    font-size: 1em;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 600;
}
.speedtest-btn {
    padding: 16px 48px;
    border-radius: 50px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    font-size: 1.1em;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: 0.3s;
    box-shadow: 0 8px 30px rgba(56,189,248,0.4);
    position: relative;
    z-index: 2;
}
.speedtest-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(56,189,248,0.6);
}
.speedtest-btn:disabled { opacity: 0.7; cursor: wait; }

.speedtest-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 30px;
    text-align: left;
    position: relative;
    z-index: 2;
}
.std-item {
    background: rgba(0,0,0,0.15);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border);
}
[data-theme="light"] .std-item { background: rgba(0,0,0,0.03); }
.std-item .label {
    font-size: 0.75em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}
.std-item .label i { color: var(--primary); }
.std-item .value {
    font-size: 1.15em;
    font-weight: 800;
    color: var(--text);
    word-break: break-word;
    margin-top: 4px;
}

/* GRID TOOLS */
.grid-title {
    font-size: 1.4em;
    font-weight: 800;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.grid-title i { color: var(--primary); }
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}
.tool-card {
    background: var(--bg-card);
    padding: 22px;
    border-radius: 16px;
    border: 1px solid var(--border);
    transition: 0.3s;
    cursor: pointer;
    display: block;
    color: var(--text);
}
.tool-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(56,189,248,0.15);
}
.tool-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4em;
    color: #fff;
    margin-bottom: 15px;
}
.tool-card h3 { font-size: 1.05em; margin-bottom: 6px; font-weight: 700; }
.tool-card p { font-size: 0.85em; color: var(--text-muted); line-height: 1.4; }

/* PANELS (Modal) */
.panel {
    display: none;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 30px;
    border: 1px solid var(--border);
    margin-bottom: 40px;
    animation: slideDown 0.3s;
}
.panel.active { display: block; }
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.panel h2 {
    font-size: 1.3em;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.panel h2 i { color: var(--primary); }
.form-group { margin-bottom: 15px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9em;
    font-weight: 600;
}
.form-group input, .form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-input);
    color: var(--text);
    font-size: 0.95em;
    font-family: inherit;
    outline: none;
}
.form-group input:focus { border-color: var(--primary); }
.btn {
    padding: 12px 24px;
    border-radius: 10px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-family: inherit;
    font-size: 0.95em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}
.btn:hover { background: var(--primary-2); }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg); }
.result-box {
    background: rgba(0,0,0,0.2);
    padding: 18px;
    border-radius: 12px;
    margin-top: 18px;
    font-family: 'Courier New', monospace;
    font-size: 0.88em;
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 80px;
    color: var(--text);
    border: 1px solid var(--border);
    line-height: 1.6;
}

/* IMEI Result Card */
.imei-result {
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: 16px;
    padding: 20px;
    margin-top: 15px;
    animation: slideDown 0.3s;
}
.imei-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.imei-row:last-child { border-bottom: none; }
.imei-row .k { color: var(--text-muted); font-weight: 600; }
.imei-row .v { font-weight: 800; text-align: right; }

/* FOOTER */
.footer {
    text-align: center;
    padding: 30px 20px;
    border-top: 1px solid var(--border);
    margin-top: 60px;
    color: var(--text-muted);
    font-size: 0.85em;
}

@media (max-width: 768px) {
    .hero h1 { font-size: 1.9em; }
    .speedtest-details { grid-template-columns: 1fr; }
    .speedtest-gauge { width: 180px; height: 180px; }
    .speedtest-value { font-size: 2.8em; }
    .panel { padding: 20px; }
    .tools-grid { grid-template-columns: 1fr 1fr; }
}
