/* components.css — Buttons, forms, alerts, panels, tables, tabs, badges,
   portraits. Every corner is square, as in the game's UI. */

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border: 1px solid var(--line-gold);
    font: 700 0.92rem/1.3 var(--font-text);
    color: var(--gold);
    background: rgba(20, 17, 13, 0.85);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), color var(--transition), filter var(--transition);
    white-space: nowrap;
}
.btn:hover { border-color: var(--gold); color: var(--gold-bright); background: var(--surface-3); text-decoration: none; }

/* The call to act: a gilded plate with dark lettering. */
.btn-primary, .btn-accent {
    color: #1c140a;
    background: linear-gradient(180deg, #e6cd8c 0%, #c8ad70 45%, #a8894c 100%);
    border-color: #f0dca2;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 2px 10px rgba(200, 173, 112, 0.15);
    text-shadow: 0 1px 0 rgba(255, 240, 200, 0.35);
}
.btn-primary:hover, .btn-accent:hover { color: #120c05; background: linear-gradient(180deg, #f2dc9e 0%, #d6bb7c 45%, #b39253 100%); filter: none; }

.btn-outline, .btn-secondary { color: var(--text); border-color: var(--line-strong); }
.btn-outline:hover, .btn-secondary:hover { color: var(--text-bright); border-color: var(--line-gold); }
.btn-danger { color: var(--red); border-color: rgba(217, 109, 102, 0.55); background: transparent; }
.btn-danger:hover { color: #f19089; border-color: var(--red); background: rgba(217, 109, 102, 0.08); }

.btn-small { padding: 0.35rem 0.8rem; font-size: 0.84rem; }
.btn-large { padding: 0.85rem 1.9rem; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ===== FORMS ===== */
.form-group { margin-top: 1.1rem; }
.form-group:first-child { margin-top: 0; }
.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    font-size: 0.86rem;
    font-weight: 700;
}
.form-group input,
.form-group select,
.input {
    width: 100%;
    padding: 0.62rem 0.75rem;
    background: var(--well);
    border: 1px solid var(--line-strong);
    color: var(--text);
    font: 400 0.95rem var(--font-text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-group input::placeholder, .input::placeholder { color: var(--text-dim); }
.form-hint { color: var(--text-dim); font-size: 0.8rem; margin-top: 0.35rem; }
.form-actions { margin-top: 1.5rem; display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.form-footer { text-align: center; margin-top: 1.25rem; color: var(--text-muted); font-size: 0.9rem; }
.form-divider { border: none; border-top: 1px solid var(--line); margin: 1.75rem 0; }

/* A standalone form in a gilded frame (forum, admin). */
.form-card {
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-top: 2px solid var(--gold-deep);
    padding: 2rem;
    max-width: 440px;
    margin: 2rem auto;
    box-shadow: var(--shadow);
}
.form-card h2 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.form-card .form-desc { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

/* ===== ALERTS ===== */
.alert {
    display: none;
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    border: 1px solid;
    border-left-width: 3px;
}
.alert-error { background: rgba(217, 109, 102, 0.08); border-color: rgba(217, 109, 102, 0.45); color: #f0a49e; }
.alert-success { background: rgba(102, 199, 120, 0.08); border-color: rgba(102, 199, 120, 0.45); color: #9fe0ab; }
.alert.visible { display: block; }

/* ===== PANELS =====
   A panel is a window of the game: a dark board, a gilded hairline and,
   when it has one, a header strip with its title. */
.panel {
    position: relative;
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(242, 220, 158, 0.06);
    padding: 1.5rem;
}
.panel h2 { margin-bottom: 1rem; font-size: 1.25rem; }
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: -1.5rem -1.5rem 1.25rem;
    padding: 0.8rem 1.5rem;
    background: linear-gradient(180deg, #221c15, #19140f);
    border-bottom: 1px solid var(--line-gold);
}
.panel-head h2, .panel-head h3 {
    margin: 0;
    font-family: var(--font-title);
    font-weight: 400;
    font-size: 1.15rem;
    color: var(--gold);
}
.panel-head .panel-note { color: var(--text-dim); font-size: 0.8rem; }

/* A recessed area inside a panel, like the game's wells. */
.well {
    background: var(--well);
    border: 1px solid var(--line);
    padding: 1rem;
}

/* The game's tooltip rule: a gold line fading out at both ends. */
.rule {
    height: 1px;
    border: none;
    background: linear-gradient(90deg, transparent, var(--line-gold) 20%, var(--gold) 50%, var(--line-gold) 80%, transparent);
    margin: 1.5rem 0;
}

/* ===== DEFINITION ROWS (account data) ===== */
.rows { display: grid; }
.rows > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--line);
}
.rows > div:last-child { border-bottom: none; }
.rows dt { color: var(--text-muted); font-size: 0.9rem; }
.rows dd { color: var(--text-bright); text-align: right; }

/* ===== TABLES ===== */
.table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.table th {
    text-align: left;
    padding: 0.65rem 0.9rem;
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 700;
    background: #17130e;
    border-bottom: 1px solid var(--line-gold);
    white-space: nowrap;
}
.table td { padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:nth-child(even) td { background: rgba(255, 245, 220, 0.015); }
.table tbody tr:hover td { background: rgba(200, 173, 112, 0.06); }
.table .r { text-align: right; }
.table .c { text-align: center; }

/* ===== TABS =====
   A row of tabs over a panel, as the game's windows have. */
.tabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line-gold); }
.tab {
    padding: 0.6rem 1.1rem;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.92rem;
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -1px;
    transition: color var(--transition), background var(--transition);
}
.tab:hover { color: var(--text-bright); background: rgba(200, 173, 112, 0.05); text-decoration: none; }
.tab.active {
    color: var(--gold-bright);
    background: var(--surface-2);
    border-color: var(--line-gold);
    box-shadow: inset 0 2px 0 var(--gold);
}

/* Small pills that narrow a list (a class filter). */
.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip {
    padding: 0.3rem 0.75rem;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-muted);
    border: 1px solid var(--line-strong);
    background: var(--well);
}
.chip:hover { color: var(--text-bright); border-color: var(--line-gold); text-decoration: none; }
.chip.active { color: #1c140a; background: var(--gold); border-color: var(--gold-bright); }

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.12rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid var(--line-strong);
    color: var(--text-muted);
}
.badge-success { color: var(--green); border-color: rgba(102, 199, 120, 0.45); }
.badge-danger { color: var(--red); border-color: rgba(217, 109, 102, 0.45); }
.badge-warning { color: var(--amber); border-color: rgba(227, 176, 76, 0.45); }
.badge-info { color: #8fb4e0; border-color: rgba(143, 180, 224, 0.4); }

/* A realm's state: a lit dot. */
.status-dot { display: inline-block; width: 8px; height: 8px; background: var(--text-dim); }
.status-dot.online { background: var(--green); box-shadow: 0 0 8px rgba(102, 199, 120, 0.7); }
.status-dot.offline { background: var(--red); }
.status-dot.maintenance { background: var(--amber); }

/* The worlds' list (partials/realms.html). */
.realm-list { list-style: none; display: grid; gap: 0.45rem; }
.realm-list li { display: flex; align-items: center; gap: 0.55rem; }
.realm-list strong { color: var(--text-bright); }
.realm-state { margin-left: auto; color: var(--text-muted); font-size: 0.86rem; }

/* ===== PORTRAITS =====
   A character's or class's screenshot in a slot-like frame. */
.portrait {
    position: relative;
    display: block;
    overflow: hidden;
    background: #3fae6a;
    border: 2px solid #37332b;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.portrait::after {
    content: '';
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

/* A character whose class is not known yet: its name's first letter. */
.portrait-initial {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    font-family: var(--font-title);
    font-size: 1.3rem;
    color: var(--gold);
    background: var(--surface-3);
}

/* A place in a ranking: gold, silver, bronze, then a plain number. */
.rank {
    display: inline-grid;
    place-items: center;
    min-width: 2rem;
    height: 2rem;
    font-weight: 700;
    color: var(--text-muted);
}
.rank-1, .rank-2, .rank-3 { border: 1px solid currentColor; background: rgba(0, 0, 0, 0.35); }
.rank-1 { color: var(--rank-1); box-shadow: 0 0 10px rgba(240, 199, 94, 0.35); }
.rank-2 { color: var(--rank-2); }
.rank-3 { color: var(--rank-3); }

/* ===== EMPTY STATES ===== */
.empty {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    border: 1px dashed var(--line-strong);
    background: rgba(0, 0, 0, 0.2);
}

/* ===== SPINNER ===== */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(200, 173, 112, 0.25);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== JOIN OVERLAY =====
   Joining a realm from the home page or the dashboard (join.js). */
.join-overlay { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(3px); }
.join-overlay[hidden] { display: none; }
.join-card { min-width: 320px; text-align: center; display: grid; gap: 0.75rem; justify-items: center; }
.join-name { font-family: var(--font-title); font-size: 1.4rem; color: var(--gold); }
