/* ============================================
   LUXID — PORTAL / DASHBOARD
   Dark-theme admin panel, Luxid brand tokens
   ============================================ */

/* --- VARIABLES (extend main.css tokens) --- */
:root {
  --portal-bg:       #0A0A0A;
  --portal-surface:  #111111;
  --portal-card:     #161616;
  --portal-border:   #222222;
  --portal-hover:    #1C1C1C;
  --portal-sidebar:  240px;
  --portal-topbar:   64px;
  --portal-red:      #E8332A;
  --portal-green:    #2ECC71;
  --portal-yellow:   #F1C40F;
  --portal-blue:     #3498DB;
}

/* --- RESET FOR PORTAL --- */
.portal-body {
  margin: 0;
  padding: 0;
  background: var(--portal-bg);
  color: #F8F6F2;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

.portal-body a { color: inherit; text-decoration: none; }
.portal-body ul, .portal-body ol { list-style: none; }

/* --- LOGIN PAGE --- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--portal-bg);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(232,51,42,0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(232,51,42,0.03) 0%, transparent 50%);
  animation: loginGlow 12s ease-in-out infinite alternate;
}

@keyframes loginGlow {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-3%, 3%) scale(1.05); }
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 48px 40px;
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  border-radius: 12px;
  text-align: center;
  z-index: 1;
}

.login-logo {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
}

.login-logo span { color: var(--portal-red); }

.login-subtitle {
  font-size: 13px;
  color: #999;
  margin-bottom: 36px;
  letter-spacing: 0.02em;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-input-wrap {
  position: relative;
}

.login-input-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #555;
  pointer-events: none;
}

.login-input {
  width: 100%;
  padding: 14px 14px 14px 44px;
  background: var(--portal-bg);
  border: 1px solid var(--portal-border);
  border-radius: 8px;
  color: #F8F6F2;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input:focus {
  border-color: var(--portal-red);
  box-shadow: 0 0 0 3px rgba(232,51,42,0.12);
}

.login-input::placeholder {
  color: #555;
}

.login-btn {
  padding: 14px 24px;
  background: var(--portal-red);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.02em;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 4px;
}

.login-btn:hover { background: #D42D25; }
.login-btn:active { transform: scale(0.98); }

.login-error {
  font-size: 13px;
  color: var(--portal-red);
  min-height: 20px;
  opacity: 0;
  transition: opacity 0.2s;
}

.login-error.visible { opacity: 1; }

.login-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #666;
  margin-top: 24px;
  transition: color 0.2s;
}

.login-back:hover { color: #F8F6F2; }

.login-back svg {
  width: 14px;
  height: 14px;
}

/* --- LAYOUT: SIDEBAR + MAIN --- */
.portal-layout {
  display: flex;
  min-height: 100vh;
}

/* --- SIDEBAR --- */
.portal-sidebar {
  width: var(--portal-sidebar);
  background: var(--portal-surface);
  border-right: 1px solid var(--portal-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
}

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

.sidebar-logo a {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo span { color: var(--portal-red); }

.sidebar-badge {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(232,51,42,0.15);
  color: var(--portal-red);
  padding: 2px 6px;
  border-radius: 3px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #555;
  padding: 16px 12px 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: #999;
  transition: background 0.15s, color 0.15s;
  position: relative;
}

.sidebar-link:hover {
  background: var(--portal-hover);
  color: #F8F6F2;
}

.sidebar-link.active {
  background: rgba(232,51,42,0.1);
  color: #F8F6F2;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--portal-red);
  border-radius: 0 2px 2px 0;
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-link.active svg { opacity: 1; }

.sidebar-link .wip-dot {
  width: 6px;
  height: 6px;
  background: var(--portal-yellow);
  border-radius: 50%;
  margin-left: auto;
  flex-shrink: 0;
}

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

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  transition: background 0.15s;
  cursor: pointer;
}

.sidebar-user:hover { background: var(--portal-hover); }

.sidebar-avatar {
  width: 32px;
  height: 32px;
  background: var(--portal-red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #F8F6F2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: #666;
}

/* --- MAIN CONTENT --- */
.portal-main {
  flex: 1;
  margin-left: var(--portal-sidebar);
  min-height: 100vh;
}

.portal-topbar {
  height: var(--portal-topbar);
  border-bottom: 1px solid var(--portal-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--portal-surface);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-title {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--portal-border);
  border-radius: 6px;
  color: #999;
  font-size: 12px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.topbar-btn:hover {
  background: var(--portal-hover);
  color: #F8F6F2;
  border-color: #333;
}

.topbar-btn svg {
  width: 14px;
  height: 14px;
}

.topbar-btn--primary {
  background: var(--portal-red);
  border-color: var(--portal-red);
  color: #fff;
}

.topbar-btn--primary:hover {
  background: #D42D25;
  border-color: #D42D25;
  color: #fff;
}

/* Mobile burger for sidebar */
.portal-burger {
  display: none;
  background: none;
  border: none;
  color: #F8F6F2;
  cursor: pointer;
  padding: 4px;
}

.portal-burger svg { width: 22px; height: 22px; }

/* --- PAGE CONTENT --- */
.portal-content {
  padding: 32px;
}

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

.stat-card {
  background: var(--portal-card);
  border: 1px solid var(--portal-border);
  border-radius: 10px;
  padding: 24px;
  transition: border-color 0.2s;
}

.stat-card:hover { border-color: #333; }

.stat-card__label {
  font-size: 12px;
  font-weight: 500;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.stat-card__value {
  font-family: 'Syne', sans-serif;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-card__sub {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

.stat-card__sub.positive { color: var(--portal-green); }
.stat-card__sub.negative { color: var(--portal-red); }

/* --- DATA TABLE --- */
.portal-table-wrap {
  background: var(--portal-card);
  border: 1px solid var(--portal-border);
  border-radius: 10px;
  overflow: hidden;
}

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

.portal-table-title {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
}

.portal-table {
  width: 100%;
  border-collapse: collapse;
}

.portal-table th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #666;
  text-align: left;
  padding: 12px 24px;
  border-bottom: 1px solid var(--portal-border);
}

.portal-table td {
  padding: 16px 24px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--portal-border);
  color: #ccc;
}

.portal-table tr:last-child td { border-bottom: none; }

.portal-table tr:hover td {
  background: var(--portal-hover);
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-badge--active {
  background: rgba(46,204,113,0.12);
  color: var(--portal-green);
}
.status-badge--active::before { background: var(--portal-green); }

.status-badge--pending {
  background: rgba(241,196,15,0.12);
  color: var(--portal-yellow);
}
.status-badge--pending::before { background: var(--portal-yellow); }

.status-badge--completed {
  background: rgba(52,152,219,0.12);
  color: var(--portal-blue);
}
.status-badge--completed::before { background: var(--portal-blue); }

/* --- UNDER CONSTRUCTION OVERLAY --- */
.wip-overlay {
  position: relative;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  text-align: center;
  padding: 60px 32px;
}

.wip-icon {
  width: 64px;
  height: 64px;
  background: rgba(241,196,15,0.1);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.wip-icon svg {
  width: 32px;
  height: 32px;
  color: var(--portal-yellow);
}

.wip-title {
  font-family: 'Syne', sans-serif;
  font-size: 24px;
  font-weight: 700;
}

.wip-text {
  font-size: 14px;
  color: #666;
  max-width: 420px;
  line-height: 1.7;
}

.wip-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(241,196,15,0.1);
  border: 1px solid rgba(241,196,15,0.2);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--portal-yellow);
}

.wip-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--portal-yellow);
  border-radius: 50%;
  animation: wipPulse 2s ease-in-out infinite;
}

@keyframes wipPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* --- EMPTY STATE --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 32px;
  gap: 12px;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: #333;
  margin-bottom: 8px;
}

.empty-state__title {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 700;
}

.empty-state__text {
  font-size: 13px;
  color: #666;
  max-width: 360px;
}

/* --- CARDS GRID (for calendar, files, etc.) --- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.portal-card {
  background: var(--portal-card);
  border: 1px solid var(--portal-border);
  border-radius: 10px;
  padding: 24px;
  transition: border-color 0.2s, transform 0.15s;
}

.portal-card:hover {
  border-color: #333;
  transform: translateY(-1px);
}

.portal-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.portal-card__icon {
  width: 40px;
  height: 40px;
  background: rgba(232,51,42,0.1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portal-card__icon svg {
  width: 20px;
  height: 20px;
  color: var(--portal-red);
}

.portal-card__title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.portal-card__text {
  font-size: 13px;
  color: #666;
  line-height: 1.6;
}

/* --- CHAT / MESSAGES PREVIEW --- */
.chat-preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-message {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--portal-card);
  border: 1px solid var(--portal-border);
  border-radius: 10px;
}

.chat-message__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--portal-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.chat-message__content { flex: 1; min-width: 0; }

.chat-message__name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.chat-message__text {
  font-size: 13px;
  color: #999;
  line-height: 1.6;
}

.chat-message__time {
  font-size: 11px;
  color: #555;
  flex-shrink: 0;
}

/* --- SETTINGS FORM --- */
.settings-section {
  background: var(--portal-card);
  border: 1px solid var(--portal-border);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 16px;
}

.settings-section__title {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.settings-section__desc {
  font-size: 13px;
  color: #666;
  margin-bottom: 20px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--portal-border);
}

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

.settings-row__label {
  font-size: 13.5px;
  font-weight: 500;
}

.settings-row__value {
  font-size: 13px;
  color: #666;
}

/* Login link lives in footer__bottom-links — no extra styles needed,
   it inherits the same small muted style as Privacy / Imprint. */

/* --- LOGOUT LINK --- */
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: #666;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: 'Inter', sans-serif;
}

.sidebar-logout:hover {
  background: rgba(232,51,42,0.08);
  color: var(--portal-red);
}

.sidebar-logout svg {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

/* --- SIDEBAR OVERLAY (mobile) --- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 49;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
  .portal-sidebar {
    transform: translateX(-100%);
  }

  .portal-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .portal-main {
    margin-left: 0;
  }

  .portal-burger {
    display: block;
  }

  .portal-content {
    padding: 20px 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .portal-table-wrap {
    overflow-x: auto;
  }

  .portal-topbar {
    padding: 0 16px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    margin: 16px;
    padding: 36px 24px;
  }
}
