/* Zurihub Technology - User Portal / Dashboard */
:root {
  --user-sidebar-w: 260px;
  --user-header-h: 64px;
}

.user-portal {
  min-height: 100vh;
  background: var(--light, #F8F9FC);
}

/* Layout */
.user-layout {
  display: flex;
  min-height: 100vh;
}
.user-sidebar {
  width: var(--user-sidebar-w);
  flex-shrink: 0;
  background: var(--primary, #101F4C);
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 220ms ease, width 220ms ease;
  overflow-y: auto;
}
.user-sidebar.hidden-mobile {
  transform: translateX(-100%);
}
@media (min-width: 1024px) {
  .user-sidebar.hidden-mobile { transform: none; }
}
.user-main {
  flex: 1;
  min-width: 0;
  margin-left: 0;
  padding-top: var(--user-header-h);
}
@media (min-width: 1024px) {
  .user-main { margin-left: var(--user-sidebar-w); }
}

/* Sidebar brand */
.user-sidebar-brand {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.user-sidebar-brand a {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.user-sidebar-brand img {
  height: 90px;
  width: auto;
  display: block;
  object-fit: contain;
}
.user-sidebar-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  transition: background 180ms;
}
.user-sidebar-close:hover { background: rgba(255,255,255,0.18); }
@media (min-width: 1024px) {
  .user-sidebar-close { display: none; }
}

/* Sidebar nav */
.user-nav {
  padding: 1rem 0;
}
.user-nav-section {
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
}
.user-nav-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.45);
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.25rem;
}
.user-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: 8px;
  margin-bottom: 2px;
  transition: background 180ms, color 180ms;
}
.user-nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.user-nav-link.active {
  background: var(--accent, #FB5041);
  color: #fff;
}
.user-nav-link svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  opacity: 0.9;
}

/* User header (top bar) */
.user-header {
  height: var(--user-header-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200, #E5E7EB);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem 0 1rem;
  box-shadow: 0 1px 3px rgba(16,31,76,0.06);
}
@media (min-width: 1024px) {
  .user-header { left: var(--user-sidebar-w); padding: 0 1.5rem; }
}
.user-header-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--light);
  color: var(--primary);
  border-radius: 8px;
  cursor: pointer;
}
@media (min-width: 1024px) {
  .user-header-menu-btn { display: none; }
}
.user-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.user-header-notify {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--light);
  border: none;
  border-radius: 8px;
  color: var(--gray-600);
  cursor: pointer;
}
.user-header-notify .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  background: var(--accent);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.user-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gray-200);
}
.user-header-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

/* Page content */
.user-page {
  padding: 1.5rem 1rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}
@media (min-width: 768px) {
  .user-page { padding: 2rem 1.5rem 3rem; }
}
.user-page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.5rem;
}
.user-page-subtitle {
  font-size: 0.9375rem;
  color: var(--gray-500);
  margin-bottom: 1.5rem;
}

/* Cards */
.user-card {
  background: #fff;
  border-radius: var(--radius-card, 8px);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,0.05));
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.user-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
}
.user-card-body {
  padding: 1.25rem;
}

/* Stats grid */
.user-stats {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 640px) {
  .user-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .user-stats { grid-template-columns: repeat(4, 1fr); }
}
.user-stat {
  background: #fff;
  border-radius: var(--radius-card);
  border: 1px solid var(--gray-200);
  padding: 1.25rem;
  transition: box-shadow 180ms, border-color 180ms;
}
.user-stat:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(251,80,65,0.12);
}
.user-stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}
.user-stat-label {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}
.user-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  background: var(--light);
  color: var(--accent);
}

/* Tables / lists */
.user-table-wrap {
  overflow-x: auto;
}
.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.user-table th,
.user-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-100);
}
.user-table th {
  font-weight: 600;
  color: var(--gray-600);
  background: var(--gray-50);
}
.user-table tr:hover td { background: var(--gray-50); }
.user-table .status {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
}
.user-table .status.open { background: #DBEAFE; color: #1D4ED8; }
.user-table .status.in_progress { background: #FEF3C7; color: #B45309; }
.user-table .status.resolved { background: #D1FAE5; color: #047857; }
.user-table .status.closed { background: var(--gray-200); color: var(--gray-600); }
.user-table .status.submitted { background: #EFF6FF; color: #2563EB; }
.user-table .status.accepted { background: #D1FAE5; color: #047857; }
.user-table .status.rejected { background: #FEE2E2; color: #B91C1C; }
.user-table .status.sent { background: #E0E7FF; color: #3730A3; }
.user-table .status.paid { background: #D1FAE5; color: #047857; }
.user-table .status.overdue { background: #FEE2E2; color: #B91C1C; }

/* Status badge (project/proposal views) */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: capitalize;
}
.status-badge.status-to_do,
.status-badge.status-gray { background: #F1F5F9; color: #475569; }
.status-badge.status-in_progress,
.status-badge.status-info { background: #DBEAFE; color: #1D4ED8; }
.status-badge.status-review,
.status-badge.status-warning { background: #FEF3C7; color: #B45309; }
.status-badge.status-completed,
.status-badge.status-success { background: #D1FAE5; color: #047857; }
.status-badge.status-draft { background: #F1F5F9; color: #475569; }
.status-badge.status-sent { background: #E0E7FF; color: #3730A3; }
.status-badge.status-viewed { background: #FEF3C7; color: #B45309; }
.status-badge.status-accepted { background: #D1FAE5; color: #047857; }
.status-badge.status-rejected,
.status-badge.status-danger { background: #FEE2E2; color: #B91C1C; }
.user-table td:last-child { white-space: nowrap; min-width: 110px; }

/* Empty state */
.user-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--gray-500);
}
.user-empty svg {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  opacity: 0.4;
}
.user-empty p { margin-bottom: 1rem; }

/* Forms */
.user-form-group {
  margin-bottom: 1.25rem;
}
.user-form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.375rem;
}
.user-form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  transition: border-color 180ms, box-shadow 180ms;
}
.user-form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(251,80,65,0.15);
  outline: none;
}
.user-form-input::placeholder { color: var(--gray-400); }
.user-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 180ms;
  text-decoration: none;
  font-family: inherit;
}
.user-btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.user-btn-primary:hover {
  background: var(--accent-hover, #e8402f);
  border-color: var(--accent-hover);
  transform: translateY(-1px);
}
.user-btn-secondary {
  background: #fff;
  color: var(--primary);
  border-color: var(--gray-300);
}
.user-btn-secondary:hover {
  border-color: var(--primary);
  background: var(--light);
}

/* Login / Auth page */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #F8F9FC 0%, #EFF1F8 50%, #E8ECF4 100%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  box-shadow: 0 10px 40px rgba(16,31,76,0.08);
  overflow: hidden;
}
.auth-card-header {
  padding: 2rem 2rem 1rem;
  text-align: center;
}
.auth-card-header img {
  height: 44px;
  width: auto;
  margin: 0 auto 1rem;
}
.auth-card-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.25rem;
}
.auth-card-header p {
  font-size: 0.9375rem;
  color: var(--gray-500);
}
.auth-card-body {
  padding: 1.5rem 2rem 2rem;
}
.auth-card-body .user-form-group { margin-bottom: 1rem; }
.auth-card-body .user-btn { width: 100%; padding: 0.75rem; margin-top: 0.5rem; cursor: pointer; pointer-events: auto; }
.auth-card form { position: relative; z-index: 1; }
.auth-divider {
  text-align: center;
  margin: 1.25rem 0;
  font-size: 0.8125rem;
  color: var(--gray-400);
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  display: inline-block;
  width: 40%;
  height: 1px;
  background: var(--gray-200);
  vertical-align: middle;
  margin: 0 0.5rem;
}
.auth-link {
  display: block;
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9375rem;
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}
.auth-link:hover { text-decoration: underline; }

/* Profile image upload */
.user-avatar-upload {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 1rem;
}
.user-avatar-preview {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--gray-200);
}
.user-avatar-upload-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(251,80,65,0.4);
}
.user-avatar-upload input { display: none; }

/* PWA install banner */
.pwa-install-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.pwa-install-banner-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pwa-install-banner h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.25rem; }
.pwa-install-banner p { font-size: 0.875rem; opacity: 0.9; margin-bottom: 0.75rem; }
.pwa-install-banner .user-btn { flex-shrink: 0; }

/* Install app modal */
.install-app-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.install-app-modal.active {
  opacity: 1;
  visibility: visible;
}
.install-app-modal[hidden] { display: none !important; }
.install-app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.install-app-modal-box {
  position: relative;
  background: var(--white);
  border-radius: 12px;
  padding: 2rem;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  text-align: center;
}
.install-app-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #6B7280;
  cursor: pointer;
  border-radius: 6px;
}
.install-app-modal-close:hover {
  background: var(--gray-100);
  color: var(--primary);
}
.install-app-modal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, #0A1535 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.install-app-modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 0.5rem;
}
.install-app-modal-text {
  font-size: 0.9375rem;
  color: #6B7280;
  margin: 0 0 1.5rem;
  line-height: 1.5;
}
.install-app-modal-btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 8px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.install-app-modal-btn:hover {
  background: #e8402f;
  color: #fff;
  transform: translateY(-1px);
}
.install-app-modal-fallback {
  margin-top: 1rem;
  line-height: 1.5;
}

/* Notification list */
.user-notification-item {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  transition: background 180ms;
}
.user-notification-item:hover { background: var(--gray-50); }
.user-notification-item.unread { background: #FFF8F7; }
.user-notification-item .n-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 0.5rem;
}
.user-notification-item .n-content { flex: 1; min-width: 0; }
.user-notification-item .n-title { font-weight: 600; color: var(--primary); margin-bottom: 0.25rem; }
.user-notification-item .n-body { font-size: 0.875rem; color: var(--gray-600); }
.user-notification-item .n-time { font-size: 0.75rem; color: var(--gray-400); }

/* Referral card */
.referral-code-box {
  background: var(--light);
  border: 2px dashed var(--gray-300);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  font-family: monospace;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.referral-code-box .user-btn { flex-shrink: 0; }

/* Action buttons (tickets, applications) - icon style, mobile responsive */
.user-actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-start;
}
.user-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.1s;
  color: var(--primary, #101F4C);
  background: var(--gray-100, #F3F4F6);
}
.user-action-btn:hover {
  background: var(--primary, #101F4C);
  color: #fff;
  transform: translateY(-1px);
}
.user-action-btn:active { transform: translateY(0); }
.user-action-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.user-action-btn[title] { position: relative; }
@media (min-width: 640px) {
  .user-action-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }
}
