/* AI Relay Platform - Global Styles */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #222240;
    --bg-input: #16162a;
    --border: #2a2a4a;
    --border-focus: #6c5ce7;
    --text-primary: #e8e8f0;
    --text-secondary: #9090b0;
    --text-muted: #606080;
    --accent: #6c5ce7;
    --accent-hover: #7d6ff0;
    --accent-glow: rgba(108, 92, 231, 0.3);
    --success: #00d2a0;
    --warning: #ffa64d;
    --danger: #ff4d6a;
    --info: #4da6ff;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
    --transition: all 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Noto Sans SC', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.page-content { padding: 32px 0 64px; }

/* Navbar */
.navbar {
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.navbar-brand {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}
.navbar-brand .icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.navbar-links { display: flex; gap: 24px; align-items: center; }
.navbar-links a { color: var(--text-secondary); font-size: 14px; }
.navbar-links a:hover { color: var(--text-primary); }
.navbar-links .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    color: white;
    box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); color: white; }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--accent); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.9; }
.btn-success { background: var(--success); color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
}
.card:hover { border-color: rgba(108, 92, 231, 0.3); }
.card-header { margin-bottom: 16px; }
.card-title { font-size: 18px; font-weight: 600; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.stat-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; }
.stat-value.accent { color: var(--accent); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }
.stat-change { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; font-weight: 500; }
.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-input::placeholder { color: var(--text-muted); }
select.form-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239090b0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 16px; font-size: 13px; color: var(--text-secondary); font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid rgba(42, 42, 74, 0.5); white-space: nowrap; }
tr:hover td { background: rgba(108, 92, 231, 0.05); }

/* Tags */
.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.tag-success { background: rgba(0, 210, 160, 0.15); color: var(--success); }
.tag-danger { background: rgba(255, 77, 106, 0.15); color: var(--danger); }
.tag-warning { background: rgba(255, 166, 77, 0.15); color: var(--warning); }
.tag-info { background: rgba(77, 166, 255, 0.15); color: var(--info); }
.tag-purple { background: rgba(108, 92, 231, 0.15); color: var(--accent); }

/* Hero */
.hero {
    text-align: center;
    padding: 80px 0 60px;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at center, rgba(108, 92, 231, 0.08) 0%, transparent 70%);
    pointer-events: none;
}
.hero h1 {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #fff, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero .subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 32px;
}
.hero-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    padding: 48px 0;
}
.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    transition: var(--transition);
}
.feature-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.feature-icon { font-size: 40px; margin-bottom: 16px; }
.feature-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.feature-desc { font-size: 14px; color: var(--text-secondary); }

/* Model list */
.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.model-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.model-name { font-weight: 600; font-size: 15px; }
.model-id { font-size: 12px; color: var(--text-muted); font-family: monospace; }
.model-prices { text-align: right; }
.model-price { font-size: 13px; color: var(--text-secondary); }
.model-price span { color: var(--accent); font-weight: 600; }

/* Code block */
.code-block {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px;
    overflow-x: auto;
    color: var(--text-secondary);
    line-height: 1.8;
    position: relative;
}
.code-block .copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}
.code-block .copy-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Chart placeholder */
.chart-container {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab {
    padding: 12px 24px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Auth pages */
.auth-container {
    max-width: 420px;
    margin: 80px auto;
    padding: 0 24px;
}
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
}
.auth-card h2 { text-align: center; margin-bottom: 32px; font-size: 24px; }
.auth-footer { text-align: center; margin-top: 24px; font-size: 14px; color: var(--text-secondary); }

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: white;
    z-index: 1000;
    animation: slideIn 0.3s ease;
    max-width: 400px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Section */
.section { padding: 48px 0; }
.section-title { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.section-subtitle { color: var(--text-secondary); margin-bottom: 32px; }

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}
.modal h3 { margin-bottom: 20px; }

/* Responsive */
@media (max-width: 768px) {
    .hero h1 { font-size: 32px; }
    .hero .subtitle { font-size: 16px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .navbar-links { gap: 8px; flex-wrap: wrap; }
    .navbar-links a { font-size: 13px; }
    .hero-actions { flex-direction: column; align-items: center; }
    .navbar .container { gap: 8px; }
}

/* Key display */
.key-display {
    background: var(--bg-input);
    border: 1px solid var(--success);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: monospace;
    font-size: 14px;
    color: var(--success);
    word-break: break-all;
    margin: 16px 0;
}

/* FAQ */
.faq-item { border-bottom: 1px solid var(--border); padding: 16px 0; }
.faq-q { font-weight: 600; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.faq-a { color: var(--text-secondary); font-size: 14px; margin-top: 12px; display: none; }
.faq-item.open .faq-a { display: block; }

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    padding: 32px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.badge-online { background: rgba(0, 210, 160, 0.1); color: var(--success); }
.badge-offline { background: rgba(255, 77, 106, 0.1); color: var(--danger); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-dot.on { background: var(--success); }
.badge-dot.off { background: var(--danger); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
