/* public/css/super.css — 通通訂 Superadmin 後台樣式 */

:root {
  --bg: #111111;
  --surface: #1a1a1a;
  --surface2: #222222;
  --border: #333333;
  --orange: #e8772e;
  --orange-dim: #c45f1e;
  --orange-light: rgba(232, 119, 46, 0.12);
  --text: #f0ece6;
  --text-dim: #999999;
  --green: #4caf50;
  --red: #e24b4a;
  --blue: #5b9bd5;
  --yellow: #f0ad4e;
  --ios-blue: #007aff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
}

a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ─── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.logo {
  padding: 22px 18px 18px;
  border-bottom: 0.5px solid var(--border);
}
.logo-brand { font-size: 16px; font-weight: 600; color: var(--orange); }
.logo-sub { font-size: 10px; color: var(--text-dim); margin-top: 3px; letter-spacing: 0.6px; text-transform: uppercase; }
.nav { flex: 1; padding: 14px 10px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 6px;
  cursor: pointer; color: var(--text-dim);
  font-size: 13px; margin-bottom: 2px;
  transition: background 0.15s;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--orange-light); color: var(--orange); }
.nav-icon { width: 16px; text-align: center; opacity: 0.7; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-footer { padding: 12px 10px; border-top: 0.5px solid var(--border); }

.main { flex: 1; padding: 24px 28px; overflow-y: auto; }
.main-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.main-header h1 { font-size: 20px; font-weight: 500; }
.main-header-right { display: flex; align-items: center; gap: 12px; }

/* ─── Buttons ─── */
.btn {
  background: var(--surface);
  border: 0.5px solid var(--border);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.15s;
}
.btn:hover { border-color: var(--orange); color: var(--orange); }
.btn.primary { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn.primary:hover { background: var(--orange-dim); border-color: var(--orange-dim); color: #fff; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: rgba(226, 75, 74, 0.1); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Cards ─── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
.card-label {
  font-size: 11px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 6px;
}
.card-val { font-size: 22px; font-weight: 600; }
.card-val.orange { color: var(--orange); }
.card-val.green { color: var(--green); }
.card-val.red { color: var(--red); }
.card-val.blue { color: var(--blue); }
.card-val.yellow { color: var(--yellow); }
.card-sub { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.card-change { font-size: 11px; margin-top: 4px; }
.card-change.up { color: var(--green); }
.card-change.down { color: var(--red); }

/* ─── Section ─── */
.section {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.section-title {
  font-size: 13px; font-weight: 500;
  margin-bottom: 14px;
  display: flex; justify-content: space-between; align-items: center;
}
.section-title-sub { font-size: 11px; color: var(--text-dim); font-weight: 400; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ─── Forms ─── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-label {
  font-size: 11px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.3px;
}
.form-input, .form-select, .form-textarea {
  background: var(--surface2);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  font-family: inherit;
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--orange); }
.form-input::placeholder { color: #555; }
.form-hint { font-size: 10px; color: var(--text-dim); }
.form-error { font-size: 11px; color: var(--red); margin-top: 3px; }

/* iOS Switch */
.ios-switch {
  position: relative;
  width: 44px; height: 26px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-block;
}
.ios-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.ios-track {
  position: absolute; inset: 0;
  border-radius: 13px;
  background: #555;
  transition: background 0.25s;
}
.ios-switch input:checked + .ios-track { background: var(--ios-blue); }
.ios-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.25s;
  pointer-events: none;
}
.ios-switch input:checked ~ .ios-thumb { transform: translateX(18px); }

/* ─── Tables ─── */
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th {
  text-align: left; color: var(--text-dim); font-weight: 400;
  padding: 8px 6px; border-bottom: 0.5px solid var(--border); font-size: 11px;
}
.tbl td { padding: 9px 6px; border-bottom: 0.5px solid var(--border); }
.tbl tr:hover td { background: var(--surface2); }
.tbl .clickable { color: var(--text); cursor: pointer; }
.tbl .clickable:hover { color: var(--orange); }
.mono { font-family: 'SF Mono', 'Courier New', monospace; font-size: 11px; }

/* Status badges */
.status {
  display: inline-block; padding: 2px 8px;
  border-radius: 4px; font-size: 10px; font-weight: 500;
  white-space: nowrap;
}
.status.trial { background: rgba(91,155,213,0.15); color: var(--blue); }
.status.active { background: rgba(76,175,80,0.15); color: var(--green); }
.status.past_due { background: rgba(240,173,78,0.15); color: var(--yellow); }
.status.suspended { background: rgba(226,75,74,0.15); color: var(--red); }
.status.cancelled { background: rgba(153,153,153,0.15); color: var(--text-dim); }
.status.pending_payment { background: rgba(232,119,46,0.12); color: var(--orange); }
.status.paid { background: rgba(76,175,80,0.15); color: var(--green); }
.status.failed { background: rgba(226,75,74,0.15); color: var(--red); }
.status.refunded { background: rgba(91,155,213,0.15); color: var(--blue); }
.status.pending { background: rgba(232,119,46,0.12); color: var(--orange); }

/* ─── Modal ─── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: 420px;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 {
  font-size: 16px; font-weight: 500; margin-bottom: 10px;
}
.modal h3.danger { color: var(--red); }
.modal-msg { font-size: 13px; color: var(--text-dim); margin-bottom: 18px; line-height: 1.6; }
.modal-msg b { color: var(--orange); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* ─── Filters ─── */
.filters { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filter-pill {
  padding: 5px 12px; border-radius: 4px; font-size: 11px;
  cursor: pointer; border: 0.5px solid var(--border);
  background: var(--surface2); color: var(--text-dim);
}
.filter-pill:hover { border-color: var(--text-dim); color: var(--text); }
.filter-pill.active { background: var(--orange-light); border-color: var(--orange); color: var(--orange); }
.filter-pill .cnt { font-size: 9px; margin-left: 4px; opacity: 0.7; }

.search-box {
  background: var(--surface2);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  font-size: 12px;
  outline: none;
  font-family: inherit;
  min-width: 200px;
}
.search-box:focus { border-color: var(--orange); }

/* ─── Toast ─── */
.toast {
  position: fixed; top: 20px; right: 20px;
  background: var(--surface); border: 0.5px solid var(--border);
  border-left: 3px solid var(--orange);
  padding: 12px 18px; border-radius: 6px;
  font-size: 13px; z-index: 2000;
  animation: slideIn 0.3s ease-out;
  max-width: 360px;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ─── Utility ─── */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; color: var(--text-dim);
}
.empty {
  text-align: center; padding: 40px; color: var(--text-dim); font-size: 13px;
}
.hidden { display: none !important; }

.text-orange { color: var(--orange); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-blue { color: var(--blue); }
.text-yellow { color: var(--yellow); }
.text-dim { color: var(--text-dim); }

/* Login page */
.login-bg {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-box {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 36px 32px;
  width: 380px;
  max-width: 90%;
}
.login-logo {
  text-align: center; margin-bottom: 28px;
}
.login-logo h1 {
  font-size: 22px; font-weight: 600; color: var(--orange); margin-bottom: 4px;
}
.login-logo p {
  font-size: 11px; color: var(--text-dim);
  letter-spacing: 1px; text-transform: uppercase;
}
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form input {
  background: var(--surface2);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.login-form input:focus { border-color: var(--orange); }
.login-form button {
  background: var(--orange); color: #fff; border: none;
  padding: 12px; border-radius: 6px; font-size: 14px;
  cursor: pointer; font-weight: 500; margin-top: 6px;
}
.login-form button:hover { background: var(--orange-dim); }
.login-error { color: var(--red); font-size: 12px; text-align: center; min-height: 16px; }
