/* ───────────────────────────────────────────────────────────────
   MATHOM HOUSE — Calculator Pages
   Requires: mathomhouse.css, layout.css
   ─────────────────────────────────────────────────────────────── */

/* ─── NUMBER INPUTS ───────────────────────────────────────────── */
input[type="number"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 6px 10px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  max-width: 120px;
}
input[type="number"]:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* ─── CHECKBOXES ──────────────────────────────────────────────── */
input[type="checkbox"] {
  accent-color: var(--gold);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ─── CALC LABELS ─────────────────────────────────────────────── */
.equip-label,
.calc-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  text-transform: none;
  margin-bottom: 0;
}

/* ─── SELECT ELEMENT ──────────────────────────────────────────── */
select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 7px 12px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237a8099' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
select:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

/* ─── RESULT / OUTPUT PANELS ──────────────────────────────────── */
.result-panel,
.output-panel,
#result,
#output {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 24px 0;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.8;
  white-space: pre-line;
}
#result:empty,
#output:empty {
  display: none;
}

.result-panel h3,
.output-panel h3 {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}

/* ─── CALC BUTTONS ────────────────────────────────────────────── */
button.calc-btn,
button[onclick]:not(.hamburger):not(.theme-toggle-btn):not(.mobile-group-btn):not(.close-btn):not(.remove-btn):not(.qty-btn):not(.add-btn):not(.cart-fab):not(.cart-button):not(.mobile-theme-btn) {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--gold-dim);
  background: rgba(201,168,76,0.12);
  color: var(--gold);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}
button.calc-btn:hover,
button[onclick]:not(.hamburger):not(.theme-toggle-btn):not(.mobile-group-btn):not(.close-btn):not(.remove-btn):not(.qty-btn):not(.add-btn):not(.cart-fab):not(.cart-button):not(.mobile-theme-btn):hover {
  background: rgba(201,168,76,0.22);
  box-shadow: 0 0 14px var(--gold-glow);
}

/* ─── CALC DESCRIPTION (intro text) ──────────────────────────── */
.calc-desc,
.container > p:first-of-type {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 24px;
}


/* ─── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  input[type="number"] { max-width: 90px; }
}

/* --- ALLIANCE GRID & CARD LAYOUT --- */
.alliance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin: 24px 0;
    width: 100%;
}

/* --- ALLIANCE CARD WRAPPER --- */
.alliance-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: 100%;
    transition: all 0.3s ease;
    position: relative; /* For the absolute X button */
}

/* Restore the Gold Outline for Eternal City owners */
.alliance-card.has-eternal {
    border-color: var(--gold);
    box-shadow: 0 0 20px var(--gold-glow);
    background: linear-gradient(180deg, var(--surface2) 0%, rgba(201,168,76,0.08) 100%);
}

/* --- CARD HEADER & DELETE BUTTON --- */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-right: 30px; /* Room for the X button */
}

.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px; /* Larger hit area */
    height: 32px;
    border-radius: 50%;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--red);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-btn:hover {
    background: var(--red);
    color: white;
    transform: scale(1.1);
}

.card-header input {
    background: transparent;
    color: var(--gold);
    font-weight: 700;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    width: 80%;
}

/* --- BUILDING CONTROLS (Single column for mobile fit) --- */
.buildings-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 0;
}

.building-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.building-control span {
    font-size: 0.85rem;
    font-family: 'Rajdhani', sans-serif;
    color: var(--text-dim);
    flex: 1; 
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Prevents long names from breaking the card */
}

/* Stepper refinement */
.stepper {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    height: 32px;
    flex-shrink: 0;
}

.stepper button {
    width: 30px;
    height: 100%;
    background: none;
    border: none;
    color: var(--gold);
    cursor: pointer;
    font-size: 1.1rem;
}

.manual-entry {
    width: 35px !important;
    background: transparent !important;
    border: none !important;
    text-align: center;
    color: var(--text);
    font-weight: 600;
    padding: 0 !important;
    margin: 0 !important;
    -moz-appearance: textfield;
}

.manual-entry::-webkit-outer-spin-button,
.manual-entry::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Current Points Input */
.stat-row.main-input {
    margin-bottom: 10px;
}

.stat-row label {
    font-size: 0.7rem;
    color: var(--gold);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-row input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: 'Rajdhani', sans-serif;
    box-sizing: border-box;
}

/* --- ETERNAL CITY SPECIAL SECTION --- */
.eternal-control {
    margin-top: 10px;
    padding: 12px;
    background: rgba(201, 168, 76, 0.05);
    border: 1px dashed var(--border);
    border-radius: 8px;
}

.eternal-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--gold);
    font-weight: 600;
    margin: 0;
}

/* Card Footer Stats */
.card-footer {
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
}

.footer-stat {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.gold-text {
    color: var(--gold);
}

/* --- CHART LAYOUT --- */
.chart-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 40px;
}

.chart-box {
    min-height: 350px; /* Gives the bars room to breathe */
    background: var(--surface2);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-sizing: border-box;
}

canvas {
    width: 100% !important;
    height: auto !important;
}

/* Mobile Tweak */
@media (max-width: 480px) {
    .alliance-grid {
        grid-template-columns: 1fr;
    }
    .building-control span {
        font-size: 0.78rem;
    }
}

/* Container for the two pet boxes */
.gear-container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 32px; /* Increased space between the two containers */
  flex-wrap: wrap;
  margin-bottom: 30px;
}

/* Individual Pet Boxes */
.gear-box {
  width: 350px;
  max-width: 100%;
  padding: 24px; /* Internal spacing so content doesn't hit the border */
  background: var(--surface); /* Uses your dark blue surface color */
  border: 1px solid var(--border); /* Subtle outline using your system border color */
  border-radius: var(--radius); /* Rounded corners to match your buttons and cards */
  transition: border-color 0.2s;
}

/* Optional: Slight highlight when you hover over a container */
.gear-box:hover {
  border-color: var(--gold-dim);
}

@media (max-width: 768px) {
  .gear-container {
    flex-direction: column;
    align-items: center;
    gap: 20px; /* Slightly tighter gap for mobile screens */
  }
}