/* AI Arena — Fantasy Medieval Theme */

:root {
    --bg-dark: #0a0a12;
    --bg-card: #12121f;
    --bg-card-hover: #1a1a2e;
    --bg-input: #0e0e1a;
    --border: #2a2a3e;
    --border-accent: #3d2f6b;
    --gold: #d4a843;
    --gold-light: #f0d67b;
    --gold-dark: #a07830;
    --purple: #7c5cbf;
    --purple-light: #9b7fdb;
    --red: #c0392b;
    --green: #27ae60;
    --blue: #2980b9;
    --text: #e0dcd4;
    --text-muted: #8a8690;
    --text-heading: #f0e8d8;
    --font-body: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-heading: 'Georgia', 'Times New Roman', serif;
    --radius: 8px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--text-heading);
    letter-spacing: 0.5px;
}

/* ── Navigation ── */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 60px;
    background: linear-gradient(180deg, #13132a 0%, #0a0a12 100%);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--gold);
    font-weight: bold;
}

.navbar-brand span { color: var(--text-muted); font-size: 0.8rem; margin-left: 0.5rem; }

.navbar-links { display: flex; gap: 1.5rem; align-items: center; }
.navbar-links a {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color 0.2s;
    padding: 0.3rem 0;
    border-bottom: 2px solid transparent;
}
.navbar-links a:hover, .navbar-links a.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

.navbar-auth { display: flex; align-items: center; gap: 1rem; }
.navbar-wallet {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: monospace;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-body);
    background: var(--bg-card);
    color: var(--text);
}
.btn:hover { background: var(--bg-card-hover); border-color: var(--gold-dark); }

.btn-primary {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    color: #0a0a12;
    border: none;
    font-weight: 600;
}
.btn-primary:hover { background: linear-gradient(135deg, var(--gold), var(--gold-light)); }

.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: rgba(192, 57, 43, 0.15); }

.btn-start { border-color: var(--green); color: var(--green); }
.btn-start:hover { background: rgba(39, 174, 96, 0.15); }

.btn-stop { border-color: var(--gold-dark); color: var(--gold-dark); }
.btn-stop:hover { background: rgba(160, 120, 48, 0.15); }

.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 2rem; font-size: 1.1rem; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 1.1rem; }

/* ── Forms ── */
.form-group { margin-bottom: 1.2rem; }
.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    font-family: var(--font-body);
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--gold-dark);
}
.form-group select { cursor: pointer; }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.3rem; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
th {
    text-align: left;
    padding: 0.7rem 1rem;
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
}
tr:hover td { background: rgba(212, 168, 67, 0.03); }

/* ── Status badges ── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-active { background: rgba(39, 174, 96, 0.15); color: var(--green); border: 1px solid rgba(39, 174, 96, 0.3); }
.badge-paused { background: rgba(212, 168, 67, 0.15); color: var(--gold); border: 1px solid rgba(212, 168, 67, 0.3); }
.badge-stopped { background: rgba(192, 57, 43, 0.15); color: var(--red); border: 1px solid rgba(192, 57, 43, 0.3); }
.badge-error { background: rgba(192, 57, 43, 0.15); color: var(--red); border: 1px solid rgba(192, 57, 43, 0.3); }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem; }
.container-wide { max-width: 1400px; margin: 0 auto; padding: 2rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }

/* ── Landing Page ── */
.hero {
    text-align: center;
    padding: 6rem 2rem 4rem;
    background: radial-gradient(ellipse at center top, rgba(124, 92, 191, 0.12) 0%, transparent 60%);
}
.hero h1 {
    font-size: 3rem;
    color: var(--gold);
    margin-bottom: 1rem;
    text-shadow: 0 2px 20px rgba(212, 168, 67, 0.3);
}
.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.features {
    padding: 3rem 2rem;
    max-width: 1000px;
    margin: 0 auto;
}
.feature-card {
    text-align: center;
    padding: 2rem;
}
.feature-card .icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}
.feature-card h3 { margin-bottom: 0.5rem; }
.feature-card p { color: var(--text-muted); font-size: 0.9rem; }

/* ── Stats row ── */
.stat-card {
    text-align: center;
    padding: 1.5rem;
}
.stat-card .value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--gold);
    font-family: var(--font-heading);
}
.stat-card .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 0.3rem;
}

/* ── Dashboard ── */
.agent-card {
    transition: border-color 0.2s;
}
.agent-card:hover { border-color: var(--gold-dark); }
.agent-card .agent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.agent-card .agent-name {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--text-heading);
}
.agent-card .agent-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.85rem;
}
.agent-card .agent-meta .meta-label { color: var(--text-muted); }
.agent-card .agent-meta .meta-value { color: var(--text); text-align: right; }
.agent-card .agent-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border);
}

/* ── Leaderboard ── */
.rank-1 td { background: rgba(212, 168, 67, 0.08); }
.rank-2 td { background: rgba(192, 192, 192, 0.05); }
.rank-3 td { background: rgba(205, 127, 50, 0.05); }
.rank-num {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--gold);
}

/* ── Map ── */
.map-container {
    width: 100%;
    height: calc(100vh - 60px);
}
#map { width: 100%; height: 100%; background: #0a1628; }

.map-legend {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    z-index: 1000;
    padding: 1rem;
    background: rgba(10, 10, 18, 0.9);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8rem;
}
.map-legend h4 { margin-bottom: 0.5rem; color: var(--gold); }
.legend-item { display: flex; align-items: center; gap: 0.5rem; margin: 0.3rem 0; }
.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.1);
}

/* ── Logs ── */
.log-entry {
    padding: 0.6rem 0.8rem;
    border-left: 3px solid var(--border);
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    background: var(--bg-input);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.log-entry.success { border-left-color: var(--green); }
.log-entry.error { border-left-color: var(--red); }
.log-entry .log-time { color: var(--text-muted); font-size: 0.75rem; margin-right: 0.5rem; }
.log-entry .log-action { color: var(--gold); font-weight: 600; }

/* ── Toast Notifications ── */
.toast-container {
    position: fixed;
    top: 70px;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.toast {
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
    max-width: 350px;
    font-size: 0.9rem;
}
.toast-success { border-color: var(--green); }
.toast-error { border-color: var(--red); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ── Loading ── */
.spinner {
    width: 24px; height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 3rem;
    color: var(--text-muted);
}

/* ── Modal ── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}
.modal h3 { margin-bottom: 1rem; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 1rem; }
    .navbar { padding: 0 1rem; }
    .navbar-links { gap: 0.8rem; }
    .container { padding: 1rem; }
}
@media (max-width: 600px) {
    .navbar-links a span { display: none; }
    .hero { padding: 3rem 1rem 2rem; }
}
