/* ==========================================
   AI API Relay - 用户控制台样式 v3
   简洁大气 · 现代图标 · 微交互
   ========================================== */

/* ---------- CSS 变量 ---------- */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-glow: rgba(79, 70, 229, 0.2);

    --accent: #0ea5e9;
    --accent-hover: #0284c7;

    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #3b82f6;
    --info-light: #eff6ff;

    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.06), 0 4px 6px -4px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 40px -8px rgba(0,0,0,0.08);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;

    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

img { max-width: 100%; height: auto; }

code {
    font-family: var(--font-mono);
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    color: var(--primary);
    border: 1px solid var(--border);
}

small, .text-muted { color: var(--text-muted); font-size: 0.85em; }

/* ---------- SVG Icon System ---------- */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.25em;
    height: 1.25em;
    vertical-align: -0.2em;
}

.icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-sm { width: 1em; height: 1em; }
.icon-lg { width: 1.5em; height: 1.5em; }
.icon-xl { width: 2em; height: 2em; }

.icon-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    flex-shrink: 0;
}

.icon-box svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-box-sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-box-sm svg { width: 16px; height: 16px; }
.icon-box-lg { width: 48px; height: 48px; border-radius: var(--radius-lg); }
.icon-box-lg svg { width: 24px; height: 24px; }

.icon-primary { background: var(--primary-light); color: var(--primary); }
.icon-success { background: var(--success-light); color: var(--success); }
.icon-warning { background: var(--warning-light); color: var(--warning); }
.icon-danger  { background: var(--danger-light); color: var(--danger); }
.icon-info    { background: var(--info-light); color: var(--info); }
.icon-accent  { background: rgba(14, 165, 233, 0.08); color: var(--accent); }

/* ---------- Layout ---------- */
.container {
    max-width: 1480px;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

main.container {
    flex: 1;
    padding: 2.5rem 1.5rem 3rem;
    animation: fadeIn 0.3s ease;
}

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

/* ---------- Navbar ---------- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.navbar-brand {
    display: inline-flex;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.navbar-nav {
    display: flex;
    gap: 0.25rem;
}

.navbar-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.navbar-nav a:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.navbar-nav a.active {
    color: var(--primary);
    background: var(--primary-light);
}

.navbar-nav a .nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.navbar-nav a .nav-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.menu-toggle {
    display: none;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    font-size: 1.2rem;
}

/* ---------- Alerts ---------- */
.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    border: 1px solid transparent;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
    background-size: contain;
    background-repeat: no-repeat;
}

.alert-error {
    background: var(--danger-light);
    color: #991b1b;
    border-color: #fecaca;
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
    border-color: #a7f3d0;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border-color: #fde68a;
}

.alert-info {
    background: var(--info-light);
    color: #1e40af;
    border-color: #bfdbfe;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.5;
    transition: all var(--transition);
    white-space: nowrap;
    user-select: none;
    font-family: inherit;
}

.btn:hover {
    background: var(--bg-hover);
    border-color: #cbd5e1;
}

.btn .icon {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2);
}

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border-color: var(--border);
}

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

.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
    border-color: #fecaca;
}

.btn-danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.btn-success {
    background: var(--success-light);
    color: #059669;
    border-color: #a7f3d0;
}

.btn-success:hover {
    background: #d1fae5;
    border-color: #6ee7b7;
}

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

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

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary-light);
}

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; border-radius: 6px; }
.btn-lg { padding: 0.7rem 1.5rem; font-size: 0.95rem; }
.btn-block { display: flex; width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text);
    background: var(--bg-card);
    transition: all var(--transition);
    font-family: inherit;
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); }

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.2rem;
    padding-right: 2.25rem;
}

.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }

.form-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    font-size: 0.875rem;
}

.form-links a { color: var(--primary); font-weight: 500; }
.form-links a:hover { color: var(--primary-hover); text-decoration: underline; }

.inline-form { display: flex; gap: 0.75rem; align-items: flex-end; }
.inline-form .form-group { margin-bottom: 0; }

.search-form { display: flex; gap: 0.75rem; margin-bottom: 1.25rem; }
.search-form input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: var(--bg-card);
    color: var(--text);
    transition: all var(--transition);
}
.search-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* ---------- Auth Pages ---------- */
.auth-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    min-height: calc(100vh - 60px);
    background:
        radial-gradient(ellipse at 50% 0%, rgba(79, 70, 229, 0.06) 0%, transparent 60%),
        var(--bg);
}

.auth-container {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    padding: 2.5rem 2rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
    animation: fadeInUp 0.4s ease;
}

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

.auth-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-header .auth-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    color: #fff;
    box-shadow: 0 4px 16px var(--primary-glow);
}

.auth-header .auth-icon svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-header h2 {
    width: 100%;
    margin: 0 0 0.25rem;
    font-size: 1.35rem;
    color: var(--text);
    text-align: center;
}
.auth-header p {
    width: 100%;
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
}

/* ---------- Cards ---------- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
    border-color: #cbd5e1;
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.card-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #818cf8);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: #cbd5e1;
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card .stat-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.stat-card .stat-body {
    flex: 1;
    min-width: 0;
}

.stat-card-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    letter-spacing: 0.01em;
}

.stat-card-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.stat-card-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ---------- Link Cards ---------- */
.link-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.link-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.link-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #818cf8);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition);
}

.link-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: #cbd5e1;
}

.link-card:hover::before {
    transform: scaleX(1);
}

.link-card .link-card-icon {
    flex-shrink: 0;
}

.link-card h4 {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
}

.link-card p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.5;
}

.link-card .link-card-arrow {
    margin-top: auto;
    align-self: flex-end;
    color: var(--text-muted);
    transition: transform var(--transition), color var(--transition);
}

.link-card:hover .link-card-arrow {
    transform: translateX(4px);
    color: var(--primary);
}

/* ---------- Tables ---------- */
.table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table thead {
    background: #fafbfc;
}

.table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    vertical-align: middle;
}

.token-usage {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.token-usage svg {
    width: 14px !important;
    height: 14px !important;
    flex: 0 0 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.token-input { color: #2563eb; }
.token-output { color: #16a34a; }

.table tbody tr {
    transition: background var(--transition);
}

.table tbody tr:hover {
    background: #f8fafc;
}

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

.table code {
    font-size: 0.8rem;
    background: #f1f5f9;
    padding: 2px 6px;
}

.table-actions {
    display: flex;
    gap: 0.375rem;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-success { background: var(--success-light); color: #065f46; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-info { background: var(--info-light); color: #1e40af; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-neutral { background: #f1f5f9; color: #475569; border: 1px solid var(--border); }

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    justify-content: center;
    margin: 1.5rem 0 0.5rem;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
}

.page-link:hover:not(.active) {
    background: var(--bg-hover);
    border-color: #cbd5e1;
    color: var(--text);
}

.page-link.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px var(--primary-glow);
}

.page-link.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ---------- Info Box ---------- */
.info-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-top: 1.25rem;
}

.info-box h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-box ol {
    padding-left: 1.25rem;
}

.info-box li {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.info-box code {
    font-size: 0.85rem;
    word-break: break-all;
}

/* ---------- Referral ---------- */
.referral-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
}

.referral-share-card { overflow: hidden; }

.share-link-box {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    margin-top: 1rem;
}

.share-link-field {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
    padding-left: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.share-link-field:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.share-link-field > svg {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    color: var(--text-muted);
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.share-link-field input {
    min-width: 0;
    width: 100%;
    border: 0;
    box-shadow: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.share-link-field input:focus { border: 0; box-shadow: none; }
.share-copy-btn { min-width: 120px; }

.share-copy-btn svg {
    width: 17px;
    height: 17px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.share-copy-btn.is-copied {
    background: var(--success);
    border-color: var(--success);
}

.share-copy-feedback {
    min-height: 1.4rem;
    margin: 0.5rem 0 0;
    font-size: 0.82rem;
    font-weight: 600;
}

.share-copy-feedback.is-success { color: #047857; }
.share-copy-feedback.is-error { color: var(--danger); }

/* ---------- Page Header ---------- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h1,
.page-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-header-with-subtitle {
    margin-bottom: 1.5rem;
}

.page-header-with-subtitle p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.35rem;
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-lg);
}

.empty-state-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.75rem;
    color: var(--text-muted);
    opacity: 0.4;
}

.empty-state-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.empty-state p {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* ---------- Footer ---------- */
.footer {
    background: var(--bg-card);
    color: var(--text-muted);
    text-align: center;
    padding: 1.25rem 0;
    margin-top: auto;
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
    color: var(--text);
    font-weight: 700;
    line-height: 1.3;
}

h2 {
    font-size: 1.3rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

h3 {
    font-size: 1.05rem;
    margin: 1.25rem 0 0.75rem;
    color: var(--text-secondary);
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.flex-wrap { flex-wrap: wrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Log Status ---------- */
.log-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot-success {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.status-dot-error {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

/* ---------- Model Grid ---------- */
.model-endpoint-box {
    margin-bottom: 1.25rem;
}

.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.model-card {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
}

.model-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: #cbd5e1;
}

.model-card .model-icon {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin-bottom: 0.25rem;
}

.model-card .model-icon-image {
    width: 72px;
    height: 72px;
    display: block;
    border-radius: 10px;
    object-fit: cover;
}

.model-card h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.model-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0;
    flex: 1;
}

.model-card .model-description {
    white-space: pre-line;
}

.model-card-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.25rem;
    width: 100%;
    min-height: 2.6rem;
    margin-bottom: 0.25rem;
}

.model-badge,
.model-price-badge {
    display: block;
    position: static;
    padding: 0.3rem 0.55rem;
    border-radius: 0.65rem;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.45;
    text-align: left;
}

.model-badge {
    flex: 0 0 auto;
    background: var(--primary-light);
    color: var(--primary);
    white-space: nowrap;
}

.model-price-badge {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    background: var(--danger-light);
    color: #dc2626;
    text-overflow: ellipsis;
    white-space: normal;
    overflow-wrap: anywhere;
}

.model-card .model-name {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
}

.model-card .model-name-value {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.model-card .model-name code {
    font-size: 0.8rem;
}

/* ---------- Captcha ---------- */
.captcha-container {
    display: grid !important;
    grid-template-columns: minmax(140px, 1fr) auto;
    grid-template-rows: auto auto;
    grid-template-areas:
        "input   media"
        "input   media";
    column-gap: 0.75rem;
    align-items: start;
    width: 100%;
}

.form-group .captcha-container input[type="text"],
.form-group .captcha-container input#captcha {
    grid-area: input;
    width: 100% !important;
    max-width: 100%;
    height: 48px;
    line-height: 48px;
    padding: 0 0.875rem;
    box-sizing: border-box;
    align-self: start;
    min-width: 0;
}

.captcha-media {
    grid-area: media;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.375rem;
    width: fit-content;
    justify-self: end;
}

.verification-code-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: stretch;
}

.verification-code-row input {
    min-width: 0;
}

.verification-code-row .send-code-btn {
    min-width: 112px;
    white-space: nowrap;
}

.captcha-media img {
    display: block;
    width: 160px;
    height: 48px;
    box-sizing: content-box;
    object-fit: none;
    object-position: 0 0;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background-color: var(--bg);
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.captcha-media img:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.captcha-hint {
    margin: 0;
    padding: 0 1px 0 0;
    white-space: nowrap;
    line-height: 1.2;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    html { font-size: 15px; }
    .container { padding: 0 1rem; }
    main.container { padding: 1.5rem 1rem; }

    .menu-toggle { display: flex; }
    .navbar-right {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        background: #ffffff;
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.75rem;
        border-top: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
        z-index: 1001;
    }
    .navbar-right.open { display: flex; }
    .navbar-nav { flex-direction: column; gap: 0.35rem; width: 100%; }
    .navbar-nav a { font-size: 1rem; padding: 0.75rem; width: 100%; }
    .navbar-right form { width: 100%; }
    .navbar-right form .btn { width: 100%; justify-content: flex-start; padding: 0.75rem; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
    .stat-card { padding: 1rem; }
    .stat-card-value { font-size: 1.35rem; }
    .link-cards { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; gap: 0; }
    .inline-form { flex-direction: column; align-items: stretch; }
    .inline-form .btn { align-self: flex-start; }
    .referral-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .referral-tabs .btn { width: 100%; padding-left: 0.5rem; padding-right: 0.5rem; }
    .share-link-box { flex-direction: column; }
    .share-link-field { min-height: 48px; }
    .share-copy-btn { width: 100%; min-height: 44px; }
    .search-form { flex-direction: column; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .table { font-size: 0.8rem; }
    .table th, .table td { padding: 0.5rem 0.625rem; }
    .auth-container { padding: 2rem 1.25rem; }
    .model-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .navbar-brand { font-size: 1rem; }
    .captcha-container {
        grid-template-columns: 1fr;
        grid-template-areas: "input" "media";
        row-gap: 0.5rem;
    }
    .captcha-media { align-items: flex-start; justify-self: start; }
    .captcha-media img { width: 100%; max-width: 280px; height: 52px; }
}