/* ─── PANOBUILDER PORTAL ─── */

/* ─── LOGIN PAGE ─── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(244,120,0,.04) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 60%, rgba(244,120,0,.03) 0%, transparent 50%);
}

.login-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(244,120,0,.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244,120,0,.012) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
}

.login-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 420px;
  background: var(--bg3, #181c22);
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo-text {
  font-family: 'Comfortaa', sans-serif;
  font-size: 28px;
  font-weight: 300;
  color: #fff;
  letter-spacing: 2px;
}
.login-logo-text span { color: var(--accent, #F47800); font-weight: 700; }

/* Fix logo-fallback color in portal nav */
.logo-fallback {
  color: var(--text, #e8ecf0) !important;
}

.login-subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--muted, #7a8694);
  margin-bottom: 28px;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 10px;
  color: rgba(255,255,255,.15);
}

/* ─── PORTAL LAYOUT ─── */
.portal-wrap {
  display: flex;
  min-height: 100vh;
  padding-top: 56px; /* nav height */
}

.portal-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg2, #121519);
  border-right: 1px solid var(--border, rgba(255,255,255,.08));
  padding: 32px 0;
  position: fixed;
  top: 56px;
  left: 0;
  bottom: 0;
  z-index: 50;
}

.portal-sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}
.portal-sidebar-nav li {
  margin: 0;
}
.portal-sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--muted, #7a8694);
  text-decoration: none;
  font-family: 'Comfortaa', sans-serif;
  font-size: 13px;
  font-weight: 500;
  transition: all .2s;
  border-left: 3px solid transparent;
}
.portal-sidebar-nav a:hover {
  color: var(--text, #e8ecf0);
  background: rgba(255,255,255,.03);
}
.portal-sidebar-nav a.active {
  color: var(--accent, #F47800);
  border-left-color: var(--accent, #F47800);
  background: rgba(244,120,0,.05);
}
.portal-sidebar-nav .nav-icon {
  width: 18px;
  height: 18px;
  opacity: .6;
}
.portal-sidebar-nav a.active .nav-icon { opacity: 1; }

.sidebar-divider {
  height: 1px;
  background: var(--border, rgba(255,255,255,.08));
  margin: 16px 24px;
}

.portal-main {
  flex: 1;
  margin-left: 240px;
  padding: 40px;
  max-width: 1100px;
}

/* ─── PAGE HEADER ─── */
.portal-header {
  margin-bottom: 32px;
}
.portal-header h1 {
  font-family: 'Comfortaa', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text, #e8ecf0);
  margin: 0 0 6px 0;
}
.portal-header p {
  font-size: 14px;
  color: var(--muted, #7a8694);
  margin: 0;
}

/* ─── STAT CARDS ─── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--card, rgba(255,255,255,.03));
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 12px;
  padding: 24px;
}
.stat-card-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted, #7a8694);
  margin-bottom: 8px;
}
.stat-card-value {
  font-family: 'Comfortaa', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--accent, #F47800);
}
.stat-card-sub {
  font-size: 12px;
  color: var(--muted, #7a8694);
  margin-top: 4px;
}

/* ─── STATUS BADGES ─── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-active {
  background: rgba(39,174,96,.12);
  color: #27ae60;
  border: 1px solid rgba(39,174,96,.25);
}
.badge-expired {
  background: rgba(231,76,60,.12);
  color: #e74c3c;
  border: 1px solid rgba(231,76,60,.25);
}
.badge-feature {
  background: rgba(244,120,0,.1);
  color: var(--accent, #F47800);
  border: 1px solid rgba(244,120,0,.2);
  margin-right: 6px;
  margin-bottom: 6px;
}

/* ─── PORTAL CARDS ─── */
.portal-card {
  background: var(--card, rgba(255,255,255,.03));
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 24px;
}
.portal-card-title {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent, #F47800);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
}

/* ─── PUBLICATIONS TABLE ─── */
.pub-table {
  width: 100%;
}
.pub-row {
  display: grid;
  grid-template-columns: 70px 1fr 140px auto;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
}
.pub-row:last-child { border-bottom: none; }

.pub-header {
  border-bottom: 1px solid rgba(244,120,0,.2);
  padding-bottom: 10px;
  margin-bottom: 4px;
}
.pub-header > div {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted, #7a8694);
}

.pub-col-vis {
  display: flex;
  justify-content: center;
}

.pub-col-exp {
  text-align: center;
  min-width: 140px;
}
.pub-header .pub-col-exp {
  display: flex;
  justify-content: center;
  align-items: center;
}
.exp-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
}
.exp-ok { background: rgba(33,186,69,.12); color: #21ba45; }
.exp-warning { background: rgba(251,189,8,.12); color: #fbbd08; }
.exp-critical { background: rgba(242,113,28,.15); color: #f2711c; }
.exp-expired { background: rgba(219,40,40,.12); color: #db2828; }
.exp-date {
  font-size: 10px;
  color: var(--muted, #7a8694);
  font-family: 'DM Mono', monospace;
  margin-top: 2px;
}
.pub-btn-extend {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 10px;
  border: 1px solid rgba(244,120,0,.3);
  border-radius: 5px;
  background: rgba(244,120,0,.1);
  color: #F47800;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.pub-btn-extend:hover {
  background: #F47800;
  color: #000;
}
.exp-extend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
}
.exp-select {
  padding: 3px 6px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 5px;
  background: rgba(255,255,255,.05);
  color: var(--text, #e8ecf0);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  cursor: pointer;
}
.exp-select:focus {
  outline: 1px solid #F47800;
}

.pub-name {
  font-family: 'Comfortaa', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #e8ecf0);
}
.pub-publish {
  font-size: 12px;
  color: var(--muted, #7a8694);
  font-family: 'DM Mono', monospace;
}

.pub-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pub-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 6px;
  background: transparent;
  color: var(--muted, #7a8694);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}
.pub-btn:hover {
  color: var(--text, #e8ecf0);
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.15);
}
.pub-btn-danger:hover {
  color: #e74c3c;
  border-color: rgba(231,76,60,.3);
  background: rgba(231,76,60,.06);
}
.pub-btn svg {
  width: 14px;
  height: 14px;
}

/* ─── TOGGLE SWITCH ─── */
.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  cursor: pointer;
}
.toggle input { display: none; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.1);
  border-radius: 11px;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted, #7a8694);
  top: 3px;
  left: 3px;
  transition: all .2s;
}
.toggle input:checked + .toggle-slider {
  background: rgba(244,120,0,.25);
}
.toggle input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: var(--accent, #F47800);
}

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted, #7a8694);
}
.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: .4;
}
.empty-state p {
  font-size: 14px;
  max-width: 300px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ─── QR MODAL ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }

.modal-card {
  background: var(--bg3, #181c22);
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 16px;
  padding: 32px;
  max-width: 380px;
  width: 90%;
  text-align: center;
}
.modal-card h3 {
  font-family: 'Comfortaa', sans-serif;
  font-size: 16px;
  color: var(--text, #e8ecf0);
  margin-bottom: 20px;
}
.modal-qr {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  display: inline-block;
  margin-bottom: 16px;
}
.modal-url {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted, #7a8694);
  word-break: break-all;
  margin-bottom: 20px;
}
.modal-close {
  padding: 8px 24px;
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #7a8694);
  cursor: pointer;
  font-family: 'Comfortaa', sans-serif;
  font-size: 12px;
  transition: all .2s;
}
.modal-close:hover {
  color: var(--text, #e8ecf0);
  background: rgba(255,255,255,.04);
}

/* ─── PORTAL FORMS ─── */
.portal-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.portal-form .form-group {
  margin-bottom: 18px;
}
.portal-form .form-label {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted, #7a8694);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
}
.portal-form .form-input {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 8px;
  font-family: 'Comfortaa', sans-serif;
  font-size: 14px;
  color: var(--text, #e8ecf0);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.portal-form .form-input::placeholder { color: rgba(122,134,148,.45); }
.portal-form .form-input:focus {
  border-color: rgba(244,120,0,.4);
  box-shadow: 0 0 0 3px rgba(244,120,0,.08);
}
.portal-form .form-input[readonly] {
  opacity: .5;
  cursor: not-allowed;
}

.pw-wrap { position: relative; }
.pw-wrap .form-input { padding-right: 44px; }
.pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: rgba(255,255,255,.15);
  transition: color .15s;
  line-height: 1;
}
.pw-toggle:hover { color: var(--accent, #F47800); }
.pw-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }

.portal-form .btn-save {
  padding: 12px 32px;
  background: linear-gradient(135deg, var(--accent, #F47800), #d06a10);
  border: none;
  border-radius: 8px;
  font-family: 'Comfortaa', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: all .2s;
  letter-spacing: .03em;
}
.portal-form .btn-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(244,120,0,.3);
}

/* ─── TOAST ─── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 24px;
  border-radius: 8px;
  font-family: 'Comfortaa', sans-serif;
  font-size: 13px;
  z-index: 2000;
  opacity: 0;
  transform: translateY(10px);
  transition: all .3s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast-success {
  background: rgba(39,174,96,.15);
  border: 1px solid rgba(39,174,96,.3);
  color: #27ae60;
}
.toast-error {
  background: rgba(231,76,60,.15);
  border: 1px solid rgba(231,76,60,.3);
  color: #e74c3c;
}

/* ─── LOGIN FORM MESSAGES ─── */
.msg-error {
  background: rgba(231,76,60,.1);
  border: 1px solid rgba(231,76,60,.2);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 13px;
  color: #e74c3c;
  display: none;
}
.msg-error.show { display: block; }

/* ─── LICENCE INFO ─── */
.licence-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.licence-item {
  padding: 12px;
  background: rgba(255,255,255,.02);
  border-radius: 8px;
}
.licence-item-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted, #7a8694);
  margin-bottom: 4px;
}
.licence-item-value {
  font-family: 'Comfortaa', sans-serif;
  font-size: 14px;
  color: var(--text, #e8ecf0);
  font-weight: 600;
}

/* ─── QUICK LINKS ─── */
.quick-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 24px;
}
.quick-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--card, rgba(255,255,255,.03));
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 10px;
  text-decoration: none;
  color: var(--text, #e8ecf0);
  font-family: 'Comfortaa', sans-serif;
  font-size: 13px;
  font-weight: 500;
  transition: all .2s;
}
.quick-link:hover {
  background: var(--bg3, #181c22);
  border-color: rgba(244,120,0,.2);
  transform: translateY(-1px);
}
.quick-link-icon {
  font-size: 20px;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .portal-sidebar {
    display: none;
  }
  .portal-main {
    margin-left: 0;
    padding: 24px 16px;
  }
  .pub-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
  .portal-form .form-row {
    grid-template-columns: 1fr;
  }
  .quick-links {
    grid-template-columns: 1fr;
  }
  .licence-grid {
    grid-template-columns: 1fr;
  }
}
