/* =================================================================
   SimulATe Dashboard — additive styles (extends ../assets/css/styles.css)
   ================================================================= */

/* Auth gate splash (loaded before user data arrives) */
.auth-loading {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
}
.auth-loading .spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== App shell ===== */
.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  background: var(--bg-soft);
}

.sidebar {
  background: var(--navy-deep);
  color: #DBE5F2;
  padding: 24px 0;
  border-right: 1px solid rgba(255,255,255,.06);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar-brand {
  padding: 0 22px 24px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 18px;
}
.sidebar-brand img { height: 38px; filter: brightness(0) invert(1); }
.sidebar-brand .badge {
  display: inline-block;
  margin-top: 8px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 8px;
  background: var(--orange);
  color: #fff;
  border-radius: 4px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: 8px;
  color: #A9BCD4;
  font-size: 14.5px;
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: var(--blue); color: #fff; box-shadow: var(--shadow-blue); }
.sidebar nav a i { width: 18px; text-align: center; opacity: .9; }

.sidebar-foot { padding: 18px 22px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  font-size: 13px;
}
.sidebar-user .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--orange));
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user .email {
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 150px;
}
.sidebar-user .tier {
  color: #A9BCD4;
  font-size: 11px;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.sidebar nav .signout {
  margin-top: 14px;
  color: #A9BCD4;
  font-size: 13px;
}
.sidebar nav .signout:hover { background: rgba(231,76,60,.15); color: #fff; }

/* ===== Main area ===== */
.app-main { padding: 32px 40px 60px; max-width: 1100px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 30px;
  flex-wrap: wrap; gap: 14px;
}
.page-head h1 {
  font-size: 1.8rem;
  letter-spacing: -.6px;
  font-weight: 800;
}
.page-head .crumb {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 4px;
}

/* ===== Cards ===== */
.dash-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  transition: box-shadow var(--t);
}
.dash-card:hover { box-shadow: var(--shadow-sm); }
.dash-card h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.dash-card .big {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.8px;
  color: var(--ink);
  line-height: 1.1;
}
.dash-card .sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 22px;
  overflow: hidden;
}
.panel-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.panel-head h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.3px;
}
.panel-body { padding: 24px; }
.panel-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--muted);
}
.panel-empty i {
  font-size: 32px;
  color: var(--muted-soft);
  display: block;
  margin-bottom: 14px;
}

/* ===== Status pill ===== */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
}
.pill i { font-size: 7px; }
.pill-active   { background: rgba(46,204,113,.12); color: #1F8E47; }
.pill-trial    { background: rgba(244,155,58,.15); color: #B6601A; }
.pill-cancelled{ background: rgba(231,76,60,.12); color: #B33020; }
.pill-paused   { background: rgba(108,122,137,.15); color: #51606F; }
.pill-pro      { background: linear-gradient(135deg,#F4A934,#E07C1F); color: #fff; }
.pill-standard { background: var(--navy); color: #fff; }
.pill-demo     { background: var(--line); color: var(--muted); }

/* ===== License key block ===== */
.lic-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 12px;
  background: var(--bg-soft);
}
.lic-row-head {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px;
  margin-bottom: 12px;
}
.lic-key {
  font-family: 'JetBrains Mono', monospace;
  background: var(--navy);
  color: #FFD9AC;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  letter-spacing: 1.5px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  user-select: all;
}
.lic-key-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lic-actions {
  display: flex; gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.lic-meta {
  display: flex; gap: 18px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 10px;
}
.lic-meta strong { color: var(--ink); font-weight: 600; }

.btn-icon {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  color: #FFD9AC;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background var(--t-fast);
}
.btn-icon:hover { background: rgba(255,255,255,.2); }

/* ===== Login page (no sidebar) ===== */
.login-shell {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 50%, var(--blue-darker) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-shell::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
}
.login-shell::after {
  content: ""; position: absolute;
  right: -200px; top: -100px;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(244,155,58,.25), transparent 60%);
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 44px 38px;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
}
.login-card .brand { justify-content: center; margin-bottom: 22px; }
.login-card .brand img { height: 48px; }
.login-card h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.5px;
  margin-bottom: 8px;
  text-align: center;
}
.login-card p.sub {
  text-align: center;
  color: var(--muted);
  margin-bottom: 28px;
  font-size: 14.5px;
  line-height: 1.6;
}
.login-card .form-group { margin-bottom: 16px; }
.login-card .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}
.login-card .form-group input {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg-soft);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.login-card .form-group input:focus {
  outline: none;
  border-color: var(--blue);
  background: #fff;
}
.login-card .btn { width: 100%; }
.login-card .alt {
  margin-top: 22px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.login-card .alt a { color: var(--blue); font-weight: 600; }
.login-info {
  background: var(--bg-tint);
  border-left: 3px solid var(--blue);
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin-top: 18px;
  display: flex; gap: 10px;
  align-items: flex-start;
}
.login-info i { color: var(--blue); margin-top: 4px; }

.login-success {
  display: none;
  background: rgba(46,204,113,.1);
  border: 1px solid rgba(46,204,113,.35);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  color: #1A8E47;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 18px;
}
.login-success.show { display: block; }
.login-error {
  display: none;
  background: rgba(231,76,60,.1);
  border: 1px solid rgba(231,76,60,.35);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: #C0392B;
  font-size: 14px;
  margin-bottom: 18px;
}
.login-error.show { display: block; }

/* ===== Profile form ===== */
.profile-form .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.profile-form .full { grid-column: 1 / -1; }
.profile-form .form-group { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.profile-form label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.profile-form input,
.profile-form select {
  padding: 11px 14px;
  background: var(--bg-soft);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.profile-form input:focus,
.profile-form select:focus {
  outline: none;
  border-color: var(--blue);
  background: #fff;
}
.profile-form .helper {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ===== Toast ===== */
.toast-host {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 3000;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--navy-deep);
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: slideIn .2s ease;
  max-width: 360px;
}
.toast.success { background: #1F8E47; }
.toast.error { background: #C0392B; }
.toast i { font-size: 16px; }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== Tables ===== */
.dash-table {
  width: 100%;
  border-collapse: collapse;
}
.dash-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 18px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.dash-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
  color: var(--ink-soft);
}
.dash-table tr:last-child td { border-bottom: none; }
.dash-table .mono { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; color: var(--blue); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 14px 18px;
    gap: 12px;
    overflow-x: auto;
  }
  .sidebar-brand { padding: 0; border: none; margin: 0; padding-right: 14px; border-right: 1px solid rgba(255,255,255,.08); }
  .sidebar-brand img { height: 30px; }
  .sidebar-brand .badge { display: none; }
  .sidebar nav { flex-direction: row; padding: 0; flex: 1; gap: 4px; }
  .sidebar nav a { padding: 8px 12px; font-size: 13px; }
  .sidebar nav a span { display: none; }
  .sidebar nav a.signout { margin: 0; }
  .sidebar-foot { display: none; }
  .app-main { padding: 22px 18px 40px; }
  .profile-form .form-grid { grid-template-columns: 1fr; }
}
