/* =========================================================
   Components: button, card, badge, form, modal, tabs
   ========================================================= */

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px;
    font-family: var(--font-ui); font-size: .92rem; font-weight: 600;
    border-radius: var(--r);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .15s ease;
    text-decoration: none;
    line-height: 1;
}
.btn i { width: 16px; height: 16px; }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
    background: linear-gradient(180deg, var(--gold-soft) 0%, var(--gold) 100%);
    color: var(--ink);
    box-shadow: 0 2px 0 var(--gold-deep), 0 6px 14px rgba(201,162,39,.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 3px 0 var(--gold-deep), 0 10px 22px rgba(201,162,39,.35); }
.btn-primary:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--gold-deep); }

.btn-dark {
    background: var(--ink); color: var(--ivory);
    box-shadow: 0 2px 0 #04101a, 0 6px 14px rgba(11,27,43,.25);
}
.btn-dark:hover { background: var(--ink-2); }

.btn-ghost {
    background: transparent; color: var(--ivory); border-color: rgba(201,162,39,.4);
}
.btn-ghost:hover { background: rgba(201,162,39,.12); border-color: var(--gold); }

.btn-outline {
    background: transparent; color: var(--ink); border-color: var(--ink);
}
.btn-outline:hover { background: var(--ink); color: var(--ivory); }

.btn-danger {
    background: var(--burgundy); color: white;
    box-shadow: 0 2px 0 var(--burgundy-2);
}
.btn-danger:hover { background: var(--burgundy-2); }

.btn-soft {
    background: var(--parchment); color: var(--ink); border-color: var(--line);
}
.btn-soft:hover { background: var(--ivory); border-color: var(--gold); }

.btn-sm { padding: 6px 12px; font-size: .82rem; }
.btn-lg { padding: 14px 26px; font-size: 1rem; }
.btn-block { display: flex; width: 100%; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}
.card-elev { box-shadow: var(--shadow); }
.card-classic {
    background: var(--surface);
    border: 1px solid var(--gold);
    border-radius: var(--r-lg);
    padding: 24px;
    position: relative;
}
.card-classic::before {
    content: ''; position: absolute; inset: 6px;
    border: 1px solid var(--gold-soft); border-radius: 10px; pointer-events: none;
}
.card-title { font-family: var(--font-serif); font-size: 1.2rem; margin-bottom: 8px; }

/* ---------- Badge ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px;
    font-family: var(--font-ui); font-size: .72rem; font-weight: 600;
    letter-spacing: .04em;
    border-radius: 999px;
    text-transform: uppercase;
}
.role-badge { padding: 6px 12px; font-family: var(--font-ui); font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; border-radius: 999px; align-self: center; margin: 4px 8px; }
.badge-admin { background: var(--burgundy); color: white; }
.badge-mod   { background: var(--ink-3); color: var(--ivory); }
.badge-lib   { background: var(--emerald); color: white; }
.badge-user  { background: var(--gold); color: var(--ink); }

.tag {
    display: inline-block;
    padding: 4px 10px; border-radius: 999px;
    background: var(--parchment); color: var(--ink);
    font-family: var(--font-ui); font-size: .78rem;
    border: 1px solid var(--line);
}

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-family: var(--font-ui); font-size: .85rem; font-weight: 600; color: var(--text-soft); }
.input, .textarea, .select {
    width: 100%;
    padding: 11px 14px;
    font-family: var(--font-body); font-size: .98rem;
    background: var(--ivory);
    border: 1px solid var(--line);
    border-radius: var(--r);
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.input:focus, .textarea:focus, .select:focus {
    outline: none; border-color: var(--gold);
    background: white;
    box-shadow: 0 0 0 3px rgba(201,162,39,.18);
}
.textarea { min-height: 110px; resize: vertical; }
.input-group { display: flex; align-items: center; }
.input-group .input { border-radius: var(--r) 0 0 var(--r); }
.input-group .btn { border-radius: 0 var(--r) var(--r) 0; }

.form-help { font-family: var(--font-ui); font-size: .8rem; color: var(--text-muted); }
.form-error { color: var(--danger); font-family: var(--font-ui); font-size: .82rem; margin-top: 4px; }

/* Switch / Checkbox */
.check {
    display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-ui); font-size: .9rem;
    cursor: pointer;
}
.check input { accent-color: var(--gold); width: 16px; height: 16px; }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(11,27,43,.6); backdrop-filter: blur(2px);
    z-index: 100; display: none; align-items: center; justify-content: center;
}
.modal-backdrop.show { display: flex; animation: fadeIn .2s; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.modal {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 28px;
    max-width: 520px; width: 92%;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gold);
    position: relative;
    animation: pop .2s ease-out;
}
@keyframes pop { from{transform:scale(.95);opacity:0} to{transform:scale(1);opacity:1} }
.modal-close { position: absolute; top: 14px; right: 14px; background: none; border: 0; color: var(--text-muted); cursor: pointer; }
.modal h3 { margin-bottom: 14px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a {
    padding: 10px 16px; font-family: var(--font-ui); font-size: .9rem; font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
}
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--gold); }

/* ---------- Avatar ---------- */
.avatar {
    width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
    border: 1px solid var(--line); background: var(--parchment);
}
.avatar-lg { width: 96px; height: 96px; border: 3px solid var(--gold); }
.avatar-xl { width: 140px; height: 140px; border: 4px solid var(--gold); box-shadow: var(--shadow-gold); }
.avatar-sm { width: 28px; height: 28px; }

/* ---------- Star rating ---------- */
.stars { display: inline-flex; gap: 2px; color: var(--gold); }
.stars i { width: 18px; height: 18px; fill: currentColor; }
.stars-empty { color: #d6cfb8; }
.star-rate { display: inline-flex; gap: 4px; }
.star-rate input { display: none; }
.star-rate label { cursor: pointer; color: #d6cfb8; transition: color .15s; }
.star-rate label:hover, .star-rate label:hover ~ label { color: var(--gold); }
.star-rate input:checked ~ label { color: var(--gold); }
.star-rate { flex-direction: row-reverse; }

/* ---------- Skeleton ---------- */
.skel { background: linear-gradient(90deg, #eee, #f5f5f5, #eee); background-size: 200% 100%; animation: skel 1.2s infinite; border-radius: var(--r); }
@keyframes skel { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ---------- Empty state ---------- */
.empty {
    text-align: center; padding: 60px 20px;
    color: var(--text-muted); font-family: var(--font-ui);
}
.empty i { width: 48px; height: 48px; color: var(--gold); margin-bottom: 12px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 24px 0; }
.pagination a, .pagination span {
    padding: 8px 14px; border-radius: var(--r); font-family: var(--font-ui);
    background: var(--surface); border: 1px solid var(--line); color: var(--text-soft);
    font-size: .88rem;
}
.pagination a:hover { background: var(--parchment); border-color: var(--gold); }
.pagination .active { background: var(--ink); color: var(--ivory); border-color: var(--ink); }

/* ---------- Tooltip simple ---------- */
[data-tip] { position: relative; }
[data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    background: var(--ink); color: var(--ivory);
    padding: 5px 10px; border-radius: 6px; font-size: .75rem; font-family: var(--font-ui);
    white-space: nowrap; z-index: 60;
}
