/* ═══════════════════════════════════════════════════════════════
   Casa Marra — Shared Premium Dark Theme
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --bg:         #0a0a0a;
  --sidebar-bg: #111111;
  --accent:     #D4AF37;
  --accent-dim: #a88a28;
  --text:       #e8e8e8;
  --text-muted: #888888;
  --card-bg:    #1a1a1a;
  --card-border:#2a2a2a;
  --danger:     #e53e3e;
  --success:    #38a169;
  --warning:    #d97706;
  --sidebar-w:  220px;
  --radius:     8px;
  --transition: 0.2s ease;
}

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
}

/* ─── SCROLLBAR ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ─── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--card-border);
}

.sidebar-logo .brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.sidebar-logo .brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color var(--transition), background var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

.sidebar-nav a.active {
  color: var(--accent);
  background: rgba(212,175,55,0.08);
  border-left-color: var(--accent);
}

.sidebar-nav a .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--card-border);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.btn-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(229,62,62,0.06);
}

/* ─── MAIN CONTENT ────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-header {
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.page-body {
  padding: 24px 28px;
  flex: 1;
}

/* ─── CARDS ───────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card .stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-card .stat-value.accent { color: var(--accent); }

/* ─── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover {
  background: var(--accent-dim);
}

.btn-secondary {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #c53030;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
}

.btn-ghost:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
}

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── TABLES ──────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead tr {
  background: #161616;
  border-bottom: 1px solid var(--card-border);
}

thead th {
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid #1e1e1e;
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }

tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.015);
}

tbody tr:hover {
  background: rgba(212,175,55,0.05);
  cursor: pointer;
}

tbody td {
  padding: 11px 14px;
  color: var(--text);
  vertical-align: middle;
}

/* ─── BADGES ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: rgba(56,161,105,0.15);
  color: var(--success);
}

.badge-danger {
  background: rgba(229,62,62,0.15);
  color: var(--danger);
}

.badge-warning {
  background: rgba(217,119,6,0.15);
  color: var(--warning);
}

.badge-muted {
  background: rgba(136,136,136,0.15);
  color: var(--text-muted);
}

.badge-accent {
  background: rgba(212,175,55,0.15);
  color: var(--accent);
}

/* ─── LIVE BADGE ──────────────────────────────────────────────── */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(56,161,105,0.12);
  border: 1px solid rgba(56,161,105,0.3);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--success);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.live-dot {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse-green 1.5s infinite;
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

/* ─── FORMS ───────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  background: #111;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  transition: border-color var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  background: #141414;
}

.form-control::placeholder { color: #444; }

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ─── MODAL ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-in 0.18s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ─── DRAWER ──────────────────────────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 900;
}

.drawer {
  position: fixed;
  top: 0; right: 0;
  width: 380px;
  height: 100vh;
  background: var(--card-bg);
  border-left: 1px solid var(--card-border);
  z-index: 910;
  overflow-y: auto;
  animation: drawer-in 0.22s ease;
  display: flex;
  flex-direction: column;
}

@keyframes drawer-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.drawer-header {
  padding: 20px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--card-bg);
  z-index: 1;
}

.drawer-body {
  padding: 20px;
  flex: 1;
}

/* ─── SEARCH BAR ──────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 340px;
}

.search-input {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 8px 12px 8px 34px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  width: 100%;
  transition: border-color var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}

.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: #444; }

/* ─── TOAST ───────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  min-width: 220px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast-success {
  background: var(--success);
  color: #fff;
}

.toast-error {
  background: var(--danger);
  color: #fff;
}

.toast-info {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text);
}

/* ─── FILTER BAR ──────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-bar input,
.filter-bar select {
  padding: 7px 10px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  outline: none;
}

.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--accent);
}

/* ─── PLAN CARDS ──────────────────────────────────────────────── */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

@media (max-width: 800px) {
  .plans-grid { grid-template-columns: repeat(2, 1fr); }
}

.plan-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 24px;
  position: relative;
  transition: border-color var(--transition);
}

.plan-card:hover {
  border-color: #3a3a3a;
}

.plan-card.platinum {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(212,175,55,0.1);
}

.plan-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.plan-name {
  font-size: 18px;
  font-weight: 700;
}

.plan-badge {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.plan-price {
  margin-bottom: 16px;
}

.plan-price .annual {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
}

.plan-price .currency {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
}

.plan-price .monthly {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.plan-benefits {
  list-style: none;
  margin-bottom: 20px;
}

.plan-benefits li {
  font-size: 13px;
  color: var(--text-muted);
  padding: 5px 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.plan-benefits li::before {
  content: '✓';
  color: var(--success);
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.plan-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--card-border);
}

.plan-member-count {
  font-size: 12px;
  color: var(--text-muted);
}

.plan-actions {
  display: flex;
  gap: 6px;
}

/* ─── SETTINGS ────────────────────────────────────────────────── */
.settings-section {
  margin-bottom: 28px;
}

.settings-section h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--card-border);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.green { background: var(--success); }
.status-dot.red   { background: var(--danger); }
.status-dot.yellow { background: var(--warning); }

/* ─── PROFILE PLACEHOLDER ─────────────────────────────────────── */
.avatar-placeholder {
  width: 64px;
  height: 64px;
  background: #222;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-muted);
  border: 2px solid var(--card-border);
  flex-shrink: 0;
}

/* ─── UTILITY ─────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-600 { font-weight: 600; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* ─── DIVIDER ─────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--card-border);
  margin: 16px 0;
}

/* ─── INFO ROW ────────────────────────────────────────────────── */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid #1e1e1e;
  font-size: 13px;
}

.info-row:last-child { border-bottom: none; }

.info-row .label {
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
  min-width: 130px;
}

.info-row .value {
  color: var(--text);
  text-align: right;
  word-break: break-all;
}

/* ─── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
}

/* ─── DANGER ZONE ─────────────────────────────────────────────── */
.danger-zone {
  background: rgba(229,62,62,0.05);
  border: 1px solid rgba(229,62,62,0.2);
  border-radius: var(--radius);
  padding: 20px;
}

.danger-zone h3 {
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}

.danger-zone p {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 14px;
}
