/* NexaTools Admin Panel Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --admin-bg: #0a0e1a;
    --admin-sidebar: #0d1221;
    --admin-card: #111827;
    --admin-card-hover: #1a2235;
    --admin-border: rgba(255,255,255,0.07);
    --admin-accent: #6366f1;
    --admin-accent2: #8b5cf6;
    --admin-success: #10b981;
    --admin-warning: #f59e0b;
    --admin-danger: #ef4444;
    --admin-text: #e2e8f0;
    --admin-text-muted: #64748b;
    --admin-input-bg: #1e293b;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--admin-bg);
    color: var(--admin-text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Login Screen ── */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at 50% 0%, rgba(99,102,241,0.15) 0%, transparent 60%), var(--admin-bg);
}

.login-card {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0,0,0,0.5);
}

.login-logo { font-size: 2rem; font-weight: 800; margin-bottom: 0.5rem; }
.login-logo span { color: var(--admin-accent); }
.login-subtitle { color: var(--admin-text-muted); font-size: 0.9rem; margin-bottom: 2rem; }

.login-form { display: flex; flex-direction: column; gap: 1rem; }

.form-group { text-align: left; }
.form-group label { font-size: 0.8rem; font-weight: 600; color: var(--admin-text-muted); display: block; margin-bottom: 0.4rem; letter-spacing: 0.05em; }
.form-group input {
    width: 100%;
    background: var(--admin-input-bg);
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    color: var(--admin-text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--admin-accent); }

.btn-login {
    background: linear-gradient(135deg, var(--admin-accent), var(--admin-accent2));
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.85rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: opacity 0.2s, transform 0.1s;
}
.btn-login:hover { opacity: 0.9; transform: translateY(-1px); }

.login-error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: #fca5a5;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    display: none;
}
.login-error.show { display: block; }

/* ── Admin Layout ── */
#admin-panel { display: none; }

.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background: var(--admin-sidebar);
    border-right: 1px solid var(--admin-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 1.5rem;
    border-bottom: 1px solid var(--admin-border);
    font-size: 1.3rem;
    font-weight: 800;
}
.sidebar-brand span { color: var(--admin-accent); }
.sidebar-brand small { display: block; font-size: 0.7rem; color: var(--admin-text-muted); font-weight: 400; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--admin-text-muted);
    padding: 0.75rem 1.25rem 0.3rem;
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.25rem;
    color: var(--admin-text-muted);
    cursor: pointer;
    border-radius: 0;
    transition: all 0.15s;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    margin: 1px 0;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--admin-text); }
.nav-item.active { background: rgba(99,102,241,0.1); color: var(--admin-accent); border-left-color: var(--admin-accent); }
.nav-item i { width: 18px; text-align: center; font-size: 0.95rem; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--admin-border);
}
.btn-logout {
    width: 100%;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.2);
    color: #fca5a5;
    border-radius: 8px;
    padding: 0.6rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-logout:hover { background: rgba(239,68,68,0.2); }

/* Main Content */
.admin-main {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.admin-topbar {
    background: var(--admin-sidebar);
    border-bottom: 1px solid var(--admin-border);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title { font-size: 1.1rem; font-weight: 700; }
.topbar-meta { font-size: 0.8rem; color: var(--admin-text-muted); margin-top: 1px; }
.topbar-actions { display: flex; gap: 0.75rem; align-items: center; }

.badge-online {
    background: rgba(16,185,129,0.15);
    border: 1px solid rgba(16,185,129,0.3);
    color: #6ee7b7;
    font-size: 0.75rem;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
}

.admin-content {
    padding: 2rem;
    flex: 1;
}

/* Sections */
.admin-section { display: none; }
.admin-section.active { display: block; }

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

.stat-card {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 14px;
    padding: 1.25rem;
    transition: transform 0.2s, border-color 0.2s;
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--admin-accent); }

.stat-card-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}
.stat-card-icon.purple { background: rgba(99,102,241,0.15); color: var(--admin-accent); }
.stat-card-icon.green { background: rgba(16,185,129,0.15); color: var(--admin-success); }
.stat-card-icon.yellow { background: rgba(245,158,11,0.15); color: var(--admin-warning); }
.stat-card-icon.red { background: rgba(239,68,68,0.15); color: var(--admin-danger); }
.stat-card-icon.blue { background: rgba(59,130,246,0.15); color: #60a5fa; }

.stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1; margin-bottom: 0.25rem; }
.stat-label { font-size: 0.8rem; color: var(--admin-text-muted); font-weight: 500; }

/* Cards */
.admin-card {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--admin-border);
}
.admin-card-title { font-size: 1rem; font-weight: 700; }
.admin-card-subtitle { font-size: 0.8rem; color: var(--admin-text-muted); margin-top: 2px; }

/* Search & Filter Bar */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.admin-search {
    flex: 1;
    min-width: 200px;
    background: var(--admin-input-bg);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    color: var(--admin-text);
    font-size: 0.9rem;
    outline: none;
}
.admin-search:focus { border-color: var(--admin-accent); }

.admin-select {
    background: var(--admin-input-bg);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    color: var(--admin-text);
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
}

/* Tools Table */
.tools-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.tools-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    color: var(--admin-text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--admin-border);
}
.tools-table td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    vertical-align: middle;
}
.tools-table tr:hover td { background: rgba(255,255,255,0.02); }

.tool-name-cell { font-weight: 500; max-width: 280px; }
.tool-id-cell { font-family: monospace; font-size: 0.75rem; color: var(--admin-text-muted); }

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}
.badge-financial { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-developer { background: rgba(99,102,241,0.15); color: #818cf8; }
.badge-text { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-converter { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-math { background: rgba(139,92,246,0.15); color: #a78bfa; }
.badge-design { background: rgba(236,72,153,0.15); color: #f472b6; }
.badge-pdf { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-image { background: rgba(6,182,212,0.15); color: #22d3ee; }
.badge-security { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.badge-utility { background: rgba(107,114,128,0.15); color: #9ca3af; }

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 38px; height: 22px;
}
.toggle-switch input { display: none; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #374151;
    border-radius: 22px;
    transition: 0.2s;
}
.toggle-slider:before {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: white;
    left: 3px; top: 3px;
    transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--admin-success); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(16px); }

/* Buttons */
.btn-admin {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.btn-primary { background: var(--admin-accent); color: white; }
.btn-primary:hover { background: #4f46e5; }
.btn-success { background: var(--admin-success); color: white; }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--admin-warning); color: #1a1a1a; }
.btn-danger { background: var(--admin-danger); color: white; }
.btn-ghost {
    background: transparent;
    border: 1px solid var(--admin-border);
    color: var(--admin-text-muted);
}
.btn-ghost:hover { border-color: var(--admin-accent); color: var(--admin-accent); }

/* Settings Form */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
.settings-grid.full { grid-template-columns: 1fr; }

.settings-field { display: flex; flex-direction: column; gap: 0.4rem; }
.settings-field label { font-size: 0.8rem; font-weight: 600; color: var(--admin-text-muted); }
.settings-field input,
.settings-field select,
.settings-field textarea {
    background: var(--admin-input-bg);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    padding: 0.65rem 1rem;
    color: var(--admin-text);
    font-size: 0.9rem;
    outline: none;
    font-family: inherit;
}
.settings-field input:focus,
.settings-field select:focus,
.settings-field textarea:focus { border-color: var(--admin-accent); }
.settings-field textarea { min-height: 90px; resize: vertical; }

/* Category Cards */
.category-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.category-manage-card {
    background: var(--admin-input-bg);
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    padding: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.cat-info { display: flex; align-items: center; gap: 0.75rem; }
.cat-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1rem; background: rgba(99,102,241,0.15); color: var(--admin-accent); }
.cat-name { font-weight: 600; font-size: 0.9rem; }
.cat-count { font-size: 0.75rem; color: var(--admin-text-muted); }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--admin-border);
    margin-top: 0.5rem;
    font-size: 0.82rem;
    color: var(--admin-text-muted);
}
.page-btns { display: flex; gap: 0.4rem; }
.page-btn {
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    border: 1px solid var(--admin-border);
    background: transparent;
    color: var(--admin-text-muted);
    cursor: pointer;
    font-size: 0.8rem;
}
.page-btn:hover, .page-btn.active { background: var(--admin-accent); color: white; border-color: var(--admin-accent); }

/* Activity Feed */
.activity-feed { display: flex; flex-direction: column; gap: 0.75rem; }
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--admin-input-bg);
    border-radius: 10px;
}
.activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.activity-dot.green { background: var(--admin-success); }
.activity-dot.blue { background: #60a5fa; }
.activity-dot.yellow { background: var(--admin-warning); }
.activity-text { font-size: 0.83rem; }
.activity-time { font-size: 0.74rem; color: var(--admin-text-muted); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

@media (max-width: 768px) {
    .admin-sidebar { width: 0; overflow: hidden; }
    .admin-main { margin-left: 0; }
    .settings-grid { grid-template-columns: 1fr; }
}
