/* =============================================================================
   Q10 API Explorer — CSS v2.0
   Dark glassmorphism theme with login, admin, and code examples
   ============================================================================= */

/* ─── Google Fonts ──────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── Custom Properties ────────────────────────────────────────────────── */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-hover: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.12);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-blue: #6366f1;
    --accent-blue-hover: #818cf8;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    --accent-purple: #a855f7;
    --accent-cyan: #06b6d4;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset ────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(16, 185, 129, 0.06) 0%, transparent 50%);
}

/* ─── LOGIN ────────────────────────────────────────────────────────────── */

.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font-sans);
    transition: border-color var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ─── BUTTONS ──────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

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

.btn-accent:hover {
    background: rgba(16, 185, 129, 0.25);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 16px;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* ─── HEADER ───────────────────────────────────────────────────────────── */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: rgba(17, 24, 39, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-icon {
    font-size: 22px;
}

.header-badge {
    padding: 3px 10px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-blue-hover);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.header-version {
    font-size: 12px;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-stats {
    font-size: 13px;
    color: var(--text-secondary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.user-role {
    padding: 2px 8px;
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-purple);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

/* ─── LAYOUT ───────────────────────────────────────────────────────────── */

.layout {
    display: flex;
    height: calc(100vh - 57px);
}

/* ─── SIDEBAR ──────────────────────────────────────────────────────────── */

.sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.search-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.sidebar-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

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

.nav-group {
    margin-bottom: 4px;
}

.nav-group-header {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-count {
    padding: 1px 6px;
    background: var(--bg-glass);
    border-radius: 10px;
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px 7px 24px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    border-left: 2px solid transparent;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-blue-hover);
    border-left-color: var(--accent-blue);
}

.nav-method {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border-radius: 3px;
}

.perm-badge {
    margin-left: auto;
    font-size: 11px;
    opacity: 0.6;
}

/* ─── CONTENT ──────────────────────────────────────────────────────────── */

.content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

/* Welcome */
.welcome {
    text-align: center;
    padding: 80px 20px;
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 24px;
}

.welcome h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

.welcome p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 32px;
}

.welcome-stats {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.stat-card {
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
}

.stat-count {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-blue-hover);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ─── ENDPOINT PANEL ───────────────────────────────────────────────────── */

.endpoint-panel {
    max-width: 900px;
}

.ep-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ep-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ep-method {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border-radius: var(--radius-sm);
}

.ep-title {
    font-size: 22px;
    font-weight: 700;
}

.ep-category {
    padding: 4px 12px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-blue-hover);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.ep-permission {
    padding: 4px 12px;
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-yellow);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.ep-description {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 16px;
    line-height: 1.6;
}

.ep-path-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

.ep-path {
    font-family: var(--font-mono);
    font-size: 14px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--accent-cyan);
    flex: 1;
}

/* ─── PARAMS ───────────────────────────────────────────────────────────── */

.ep-params {
    margin-bottom: 24px;
}

.ep-params h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.param-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.param-row label {
    min-width: 160px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.param-row .req {
    color: var(--accent-red);
}

.param-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
}

.param-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.ep-actions {
    margin-bottom: 32px;
}

/* ─── CODE SECTION ─────────────────────────────────────────────────────── */

.code-section {
    margin-top: 32px;
    border-top: 1px solid var(--border);
    padding-top: 24px;
}

.code-section h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.code-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.code-tab {
    padding: 8px 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    margin-bottom: -1px;
}

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

.code-tab.active {
    color: var(--accent-blue-hover);
    border-bottom-color: var(--accent-blue);
}

.code-block {
    background: #0d1117;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    padding: 20px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    color: #c9d1d9;
    max-height: 400px;
    tab-size: 4;
    white-space: pre;
}

/* ─── RESPONSE ─────────────────────────────────────────────────────────── */

.response-panel {
    margin-top: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.response-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--bg-glass);
    border-bottom: 1px solid var(--border);
}

.response-header h3 {
    font-size: 14px;
    font-weight: 600;
}

.response-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
}

.response-status {
    font-weight: 600;
}

.response-status.ok {
    color: var(--accent-green);
}

.response-status.error {
    color: var(--accent-red);
}

.response-status.loading {
    color: var(--accent-yellow);
}

.response-time {
    color: var(--text-muted);
}

.response-count {
    color: var(--accent-cyan);
}

.response-body {
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    color: #c9d1d9;
    background: #0d1117;
    overflow-x: auto;
    max-height: 500px;
    white-space: pre;
    margin: 0;
}

/* ─── TEST RESULTS ─────────────────────────────────────────────────────── */

.test-results h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
}

.test-summary {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.test-stat {
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 18px;
    font-weight: 700;
}

.test-stat.ok {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.test-stat.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.test-stat.total {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.test-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.test-item:last-child {
    border-bottom: none;
}

.test-icon {
    font-size: 16px;
}

.test-name {
    font-weight: 500;
    min-width: 200px;
}

.test-records {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 13px;
}

.loading-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.error-text {
    color: var(--accent-red);
}

/* ─── ADMIN PAGE ───────────────────────────────────────────────────────── */

.admin-layout {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.admin-header h1 {
    font-size: 24px;
    font-weight: 700;
}

.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.admin-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    margin-bottom: -1px;
}

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

.admin-tab.active {
    color: var(--accent-blue-hover);
    border-bottom-color: var(--accent-blue);
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.admin-table th {
    background: var(--bg-card);
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: var(--bg-hover);
}

.role-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.role-badge.admin {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-red);
}

.role-badge.developer {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-blue-hover);
}

.role-badge.viewer {
    background: rgba(100, 116, 139, 0.12);
    color: var(--text-muted);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.active {
    background: var(--accent-green);
}

.status-dot.inactive {
    background: var(--accent-red);
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.setting-key {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 500;
    min-width: 200px;
    color: var(--accent-cyan);
}

.setting-value {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
}

.setting-value:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.setting-desc {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 160px;
}

/* ─── MODAL ────────────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
}

.modal-card h2 {
    font-size: 20px;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}

/* ─── SCROLLBAR ────────────────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
    height: 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);
}

/* ─── RESPONSIVE ───────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .sidebar {
        width: 240px;
        min-width: 240px;
    }

    .header {
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-stats {
        display: none;
    }

    .content {
        padding: 20px;
    }

    .welcome-stats {
        flex-direction: column;
        align-items: center;
    }
}

/* ─── HTTP METHODS BADGES ──────────────────────────────────────────────── */

.nav-method {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 8px;
    text-transform: uppercase;
    background: var(--bg-hover);
    color: var(--text-muted);
    min-width: 45px;
    text-align: center;
    display: inline-block;
}

.nav-item[data-method="GET"] .nav-method {
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.nav-item[data-method="POST"] .nav-method {
    color: var(--accent-yellow);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.nav-item[data-method="PUT"] .nav-method {
    color: var(--accent-blue);
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.nav-item[data-method="DELETE"] .nav-method {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.param-input[data-param="Body"] {
    height: 120px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.4;
}