/* ================================================================
   IMPÉRIO SUPREMO — CSS Global (v2.0)
   ================================================================ */

:root {
  --bg-primary:   #080e1a;
  --bg-secondary: #0d1627;
  --bg-card:      #111f35;
  --bg-hover:     #162540;
  --border:       #1e3a5f;
  --border-light: #2a4a73;

  --gold:    #f59e0b;
  --gold-dk: #d97706;
  --green:   #10b981;
  --red:     #ef4444;
  --blue:    #3b82f6;
  --purple:  #8b5cf6;
  --cyan:    #06b6d4;
  --orange:  #f97316;

  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #4a6080;

  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Consolas', 'Monaco', monospace;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-gold: 0 0 20px rgba(245,158,11,0.2);
  --transition: 0.2s ease;

  --sidebar-w: 220px;
  --topbar-h: 64px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}

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

/* ── Typography ────────────────────────────────────────────── */
h1,h2,h3,h4 { color: var(--text-primary); font-weight: 600; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.95rem; }

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

p { color: var(--text-secondary); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: var(--font);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary  { background: var(--blue);   color: #fff; }
.btn-primary:hover:not(:disabled)  { background: #2563eb; transform: translateY(-1px); }

.btn-gold     { background: var(--gold);   color: #000; }
.btn-gold:hover:not(:disabled)     { background: var(--gold-dk); transform: translateY(-1px); }

.btn-danger   { background: var(--red);    color: #fff; }
.btn-danger:hover:not(:disabled)   { background: #dc2626; }

.btn-success  { background: var(--green);  color: #fff; }
.btn-success:hover:not(:disabled)  { background: #059669; }

.btn-ghost    { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled)    { border-color: var(--blue); color: var(--text-primary); }

.btn-sm  { padding: 5px 10px; font-size: 12px; }
.btn-lg  { padding: 11px 24px; font-size: 15px; }
.btn-icon { padding: 8px; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-light); }
.card-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.card-title  { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.card-subtitle { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font);
  transition: border-color var(--transition);
  outline: none;
}
.form-input:focus  { border-color: var(--blue); }
.form-input::placeholder { color: var(--text-muted); }
select.form-input  { cursor: pointer; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--bg-secondary); }
th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-secondary); vertical-align: middle; }
tbody tr:hover td { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700;
}
.badge-gold    { background: rgba(245,158,11,0.15); color: var(--gold); border: 1px solid rgba(245,158,11,0.3); }
.badge-green   { background: rgba(16,185,129,0.15); color: var(--green); border: 1px solid rgba(16,185,129,0.3); }
.badge-red     { background: rgba(239,68,68,0.15);  color: var(--red);   border: 1px solid rgba(239,68,68,0.3); }
.badge-blue    { background: rgba(59,130,246,0.15); color: var(--blue);  border: 1px solid rgba(59,130,246,0.3); }
.badge-purple  { background: rgba(139,92,246,0.15); color: var(--purple);border: 1px solid rgba(139,92,246,0.3); }
.badge-gray    { background: rgba(100,116,139,0.15);color: var(--text-secondary); border: 1px solid var(--border); }

/* ── Progress bar ───────────────────────────────────────────── */
.progress { background: var(--bg-secondary); border-radius: 99px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; transition: width 0.5s ease; }
.progress-bar.gold   { background: linear-gradient(90deg, var(--gold-dk), var(--gold)); }
.progress-bar.green  { background: linear-gradient(90deg, #059669, var(--green)); }
.progress-bar.blue   { background: linear-gradient(90deg, #2563eb, var(--blue)); }
.progress-bar.red    { background: linear-gradient(90deg, #dc2626, var(--red)); }
.progress-bar.purple { background: linear-gradient(90deg, #7c3aed, var(--purple)); }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: var(--green); }
.alert-danger  { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.3);  color: var(--red); }
.alert-info    { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); color: var(--blue); }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: var(--gold); }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  z-index: 1000; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%; max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity:0; transform:scale(0.95) translateY(-10px); } to { opacity:1; transform:none; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title  { font-size: 1.1rem; font-weight: 700; }
.modal-close  { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; padding: 4px; }
.modal-close:hover { color: var(--text-primary); }

/* ── Utility ────────────────────────────────────────────────── */
.flex  { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-gold   { color: var(--gold); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-blue   { color: var(--blue); }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.text-lg     { font-size: 1.1rem; }
.text-xl     { font-size: 1.3rem; }
.text-2xl    { font-size: 1.6rem; }
.font-bold   { font-weight: 700; }
.font-mono   { font-family: var(--font-mono); }
.w-full      { width: 100%; }
.hidden      { display: none !important; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Toast ──────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 16px;
  min-width: 260px; max-width: 360px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease;
  font-size: 13px;
}
@keyframes toastIn { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:none; } }
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }
.toast.warning { border-left: 3px solid var(--gold); }
.toast-icon    { font-size: 16px; }
.toast-fade    { animation: toastOut 0.3s ease forwards; }
@keyframes toastOut { to { opacity:0; transform:translateX(20px); } }

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-light);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Loading overlay ────────────────────────────────────────── */
#loading-overlay {
  position: fixed; inset: 0;
  background: var(--bg-primary);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9998;
  gap: 16px;
}
#loading-overlay .logo-text {
  font-size: 2rem; font-weight: 900;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* ── Countdown ──────────────────────────────────────────────── */
.countdown { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }

/* ── Resource icon ──────────────────────────────────────────── */
.res-icon { font-size: 16px; }
.res-val  { font-weight: 700; font-family: var(--font-mono); }

/* ── Tier stars ─────────────────────────────────────────────── */
.tier-stars { color: var(--gold); font-size: 11px; }

/* ── Rarity colors ──────────────────────────────────────────── */
.rarity-common    { color: #94a3b8; }
.rarity-uncommon  { color: #22c55e; }
.rarity-rare      { color: #3b82f6; }
.rarity-epic      { color: #a855f7; }
.rarity-legendary { color: #f59e0b; text-shadow: 0 0 8px rgba(245,158,11,0.5); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .grid-2,.grid-3,.grid-4 { grid-template-columns: 1fr; }
  .hidden-mobile { display: none !important; }
}
@media (max-width: 480px) {
  .btn { padding: 7px 12px; font-size: 12px; }
  .card { padding: 14px; }
  .modal { padding: 20px; }
}
