/* ============================================================
   MusicCloud Business Portal — shared.css
   Reuses the colour palette, fonts and gradient language from
   website/index.php so the portal feels like the same product.
   ============================================================ */

:root {
  --orange: #FF4D00;
  --pink: #FF0055;
  --coral: #FF6B35;
  --hot: #FF1A6C;
  --cream: #FFFAF7;
  --paper: #FFF5EE;
  --ink: #1A0A00;
  --muted: #7A4030;
  --light: #FFE8DC;
  --lighter: #FFF0E8;
  --input-border: rgba(26, 10, 0, 0.35);
  --input-border-hover: rgba(26, 10, 0, 0.55);

  --sidebar-w: 240px;
  --radius: 16px;
  --radius-sm: 10px;
}

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

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  background: var(--cream);
  color: var(--ink);
  font-family: 'Outfit', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; }

/* ── Auth pages (login / register) ───────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.auth-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 15% 10%, rgba(255, 77, 0, 0.10) 0%, transparent 70%),
    radial-gradient(ellipse 50% 35% at 85% 85%, rgba(255, 0, 85, 0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.auth-card {
  position: relative;
  z-index: 1;
  background: #fff;
  border: 1px solid rgba(255, 77, 0, 0.12);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(26, 10, 0, 0.08);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.auth-logo img { width: 40px; height: 40px; object-fit: contain; }

.auth-logo-text {
  font-family: 'Syne', sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--orange), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-card h1 {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.auth-card p.sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--input-border-hover);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 77, 0, 0.12);
}

/* ── Generic form control visibility fix (applies portal-wide) ───────── */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
select,
textarea {
  border: 1px solid var(--input-border);
}
input[type="text"]:hover,
input[type="number"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="search"]:hover,
input[type="tel"]:hover,
input[type="url"]:hover,
input[type="date"]:hover,
select:hover,
textarea:hover {
  border-color: var(--input-border-hover);
}
input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 77, 0, 0.12);
}

/* ── Checkbox & radio visibility fix ──────────────────────────────────
   Plain (non-custom) checkboxes/radio inputs get a visible outline and
   a stronger highlight on hover so users can locate them. Custom
   checkbox components (e.g. .cb-row, .toggle, .switch) already draw
   their own visible control and are unaffected by this rule since their
   native input is visually hidden (opacity: 0). */
input[type="checkbox"]:not([style*="opacity: 0"]),
input[type="radio"]:not([style*="opacity: 0"]) {
  width: 16px;
  height: 16px;
  accent-color: var(--orange);
  outline: 1px solid var(--input-border);
  outline-offset: 2px;
  border-radius: 3px;
  cursor: pointer;
}
input[type="checkbox"]:not([style*="opacity: 0"]):hover,
input[type="radio"]:not([style*="opacity: 0"]):hover {
  outline-color: var(--input-border-hover);
}
input[type="checkbox"]:not([style*="opacity: 0"]):focus-visible,
input[type="radio"]:not([style*="opacity: 0"]):focus-visible {
  outline: 2px solid var(--orange);
}

.btn-primary {
  width: 100%;
  padding: 13px 22px;
  border: none;
  border-radius: 100px;
  background: linear-gradient(135deg, var(--orange), var(--pink));
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255, 77, 0, 0.30);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(255, 77, 0, 0.45); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.auth-foot {
  text-align: center;
  margin-top: 22px;
  font-size: 0.88rem;
  color: var(--muted);
}

.auth-foot a { color: var(--orange); font-weight: 600; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

.form-msg {
  display: none;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 18px;
}

.form-msg.error { display: block; background: rgba(255, 0, 85, 0.08); color: var(--hot); border: 1px solid rgba(255, 0, 85, 0.18); }
.form-msg.success { display: block; background: rgba(16, 185, 129, 0.08); color: #0a8a5f; border: 1px solid rgba(16, 185, 129, 0.2); }

/* ── App shell (header + sidebar) ────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.shell-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, #2a0d00, #1A0A00);
  color: #fff;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sb-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sb-logo img { width: 32px; height: 32px; object-fit: contain; }

.sb-logo-text {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
}

.sb-logo-tag {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.45);
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.5px;
}

.sb-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }

.sb-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.sb-nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.sb-nav a.active {
  background: linear-gradient(135deg, rgba(255, 77, 0, 0.35), rgba(255, 0, 85, 0.25));
  color: #fff;
}

.sb-nav .icon { font-size: 1.05rem; width: 20px; text-align: center; }

.sb-foot { padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, 0.08); }

.sb-logout {
  width: 100%;
  background: rgba(255, 255, 255, 0.07);
  border: none;
  color: rgba(255, 255, 255, 0.75);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
}

.sb-logout:hover { background: rgba(255, 255, 255, 0.13); color: #fff; }

.shell-main { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; display: flex; flex-direction: column; }

.shell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: #fff;
  border-bottom: 1px solid var(--light);
}

.shell-header h2 { font-family: 'Syne', sans-serif; font-size: 1.2rem; font-weight: 800; }

.shell-header .account {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}

.shell-content { padding: 32px; flex: 1; }

.placeholder-card {
  background: #fff;
  border: 1px dashed var(--light);
  border-radius: var(--radius);
  padding: 60px 30px;
  text-align: center;
  color: var(--muted);
}

.placeholder-card h3 {
  font-family: 'Syne', sans-serif;
  color: var(--ink);
  font-size: 1.2rem;
  margin-bottom: 8px;
}

@media (max-width: 820px) {
  .shell-sidebar { width: 72px; }
  .sb-logo-text, .sb-logo-tag, .sb-nav a span.label { display: none; }
  .shell-main { margin-left: 72px; }
}

/* ── Phase 11: phone-width hardening ─────────────────────────────────── */
/* Cards that wrap a data table get horizontal scroll instead of forcing
   the whole shell wider than the viewport. Applies to .ads-card (my ads),
   .wallet-history-card (wallet), and .dash-card (dashboard per-ad table) —
   no markup changes needed in those pages. */
.ads-card, .wallet-history-card, .dash-card {
  overflow-x: auto;
}

@media (max-width: 600px) {
  .shell-content { padding: 18px !important; }

  .shell-header {
    padding: 14px 16px !important;
    flex-wrap: wrap;
    gap: 8px;
  }
  .shell-header h2 { font-size: 1.05rem; }

  .ads-card, .wallet-history-card, .dash-card, .detail-card, .calc-card {
    padding: 18px 16px !important;
  }

  .stat-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
  .stat-card { padding: 14px 16px !important; }
  .stat-card .value { font-size: 1.35rem !important; }

  .ads-table, .wallet-table { min-width: 560px; }

  .auth-card { padding: 28px 22px !important; }
}

/* ── Mobile bottom navigation (replaces the sidebar on small screens) ─── */
.mobile-bottom-nav { display: none; }

@media (max-width: 768px) {
  .shell-sidebar { display: none; }
  .shell-main { margin-left: 0; }
  .shell-content { padding-bottom: 92px !important; } /* room above the fixed bottom nav */

  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 200;
    background: #fff;
    border-top: 1px solid var(--light);
    box-shadow: 0 -6px 24px rgba(26, 10, 0, 0.08);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .mobile-bottom-nav a {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 2px;
    text-decoration: none;
    color: var(--muted);
    font-family: 'Outfit', sans-serif;
    font-size: 0.66rem;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease, background 0.15s ease;
  }
  .mobile-bottom-nav a i { font-size: 1.15rem; }
  .mobile-bottom-nav a.active {
    color: var(--orange);
    background: rgba(255, 77, 0, 0.08);
  }
}
