/* ══════════════════════════════════════════════════════════════
   YourBestData — Client Portal Styles
   Matches public site dark-premium aesthetic
   ══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300;14..32,400;14..32,500;14..32,600;14..32,700;14..32,800;14..32,900&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Reset & Base ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scrollbar-width: thin;
  scrollbar-color: #333 #09090B;
}
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: #09090B; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: #09090B;
  color: #e4e4e7;
  line-height: 1.7;
  min-height: 100vh;
}

::selection {
  background: rgba(0,229,255,.12);
  color: #fff;
}

a { color: inherit; text-decoration: none; }

/* ── Layout ── */
.portal-wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px;
}

.portal-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.portal-main {
  flex: 1;
  padding: 100px 0 60px;
}

/* ── Header / Topbar ── */
.portal-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 64px;
  display: flex;
  align-items: center;
  background: rgba(9,9,11,.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,.04);
}

.portal-header .portal-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.portal-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: -.02em;
}

.portal-logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .68rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #7C3AED, #B388FF);
}

.portal-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-user-name {
  font-size: .82rem;
  color: #a1a1aa;
}

/* ── Buttons ── */
.btn-primary {
  background: linear-gradient(135deg, #7C3AED, #B388FF, #FF4FC3);
  background-size: 200% 200%;
  animation: grad-shift 4s ease infinite;
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 10px;
  font-family: inherit;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .3s cubic-bezier(.16,1,.3,1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 32px -4px rgba(179,136,255,.25);
}
.btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

@keyframes grad-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.btn-secondary {
  background: transparent;
  border: 1px solid rgba(255,255,255,.12);
  color: #e4e4e7;
  padding: 10px 24px;
  border-radius: 10px;
  font-family: inherit;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .3s;
}
.btn-secondary:hover {
  border-color: rgba(255,255,255,.25);
  background: rgba(255,255,255,.04);
}

.btn-sm {
  padding: 7px 16px;
  font-size: .8rem;
  border-radius: 8px;
}

.btn-danger {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.2);
  color: #f87171;
  padding: 10px 24px;
  border-radius: 10px;
  font-family: inherit;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .3s;
}
.btn-danger:hover {
  background: rgba(239,68,68,.15);
  border-color: rgba(239,68,68,.3);
}

.btn-icon {
  background: none;
  border: 1px solid rgba(255,255,255,.08);
  color: #a1a1aa;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .3s;
}
.btn-icon:hover {
  border-color: rgba(255,255,255,.2);
  color: #e4e4e7;
}

/* ── Cards ── */
.card {
  background: rgba(17,17,20,.6);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 16px;
  backdrop-filter: blur(20px);
  transition: all .4s cubic-bezier(.16,1,.3,1);
}
.card:hover {
  border-color: rgba(255,255,255,.1);
}

.card-body {
  padding: 24px;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-weight: 700;
  font-size: 1rem;
}

/* ── Forms ── */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: #a1a1aa;
  margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  font-family: inherit;
  font-size: .92rem;
  outline: none;
  transition: border-color .3s, box-shadow .3s;
  background: rgba(9,9,11,.8);
  border: 1px solid rgba(255,255,255,.06);
  color: #e4e4e7;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: rgba(0,229,255,.3);
  box-shadow: 0 0 0 3px rgba(0,229,255,.06);
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: #444;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8L9.5 4.5' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}
.form-select option {
  background: #111114;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-error {
  color: #f87171;
  font-size: .78rem;
  margin-top: 6px;
}

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

.login-card {
  width: 100%;
  max-width: 420px;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h1 {
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -.03em;
  margin-top: 20px;
  margin-bottom: 6px;
}

.login-header p {
  color: #a1a1aa;
  font-size: .88rem;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
}

.login-footer a {
  color: #B388FF;
  font-size: .84rem;
  font-weight: 500;
  transition: color .3s;
}
.login-footer a:hover {
  color: #00E5FF;
}

/* ── Gradient Text ── */
.text-gradient {
  background: linear-gradient(135deg, #00E5FF, #B388FF 50%, #FF4FC3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-2 {
  background: linear-gradient(90deg, #00E5FF, #B388FF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Page Header ── */
.page-title {
  font-weight: 800;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -.03em;
  line-height: 1.1;
  margin-bottom: 6px;
}

.page-subtitle {
  color: #a1a1aa;
  font-size: .95rem;
}

.page-header {
  margin-bottom: 32px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

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

.stat-card {
  padding: 20px 24px;
}

.stat-value {
  font-weight: 800;
  font-size: 1.8rem;
  letter-spacing: -.03em;
}

.stat-label {
  font-size: .78rem;
  color: #52525b;
  margin-top: 2px;
}

/* ── Project Cards ── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.project-card {
  cursor: pointer;
}
.project-card:hover {
  border-color: rgba(179,136,255,.15);
  box-shadow: 0 0 48px -12px rgba(0,229,255,.05);
}

.project-card .card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-card-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.project-card-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: .7rem;
  color: #52525b;
  letter-spacing: .05em;
}

.project-card-summary {
  font-size: .86rem;
  color: #a1a1aa;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: .78rem;
  color: #52525b;
  margin-top: auto;
}

/* ── Status Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.badge-planned {
  background: rgba(161,161,170,.1);
  color: #a1a1aa;
  border: 1px solid rgba(161,161,170,.15);
}
.badge-discovery {
  background: rgba(0,229,255,.08);
  color: #00E5FF;
  border: 1px solid rgba(0,229,255,.15);
}
.badge-in_progress, .badge-in-progress {
  background: rgba(179,136,255,.08);
  color: #B388FF;
  border: 1px solid rgba(179,136,255,.15);
}
.badge-review {
  background: rgba(255,79,195,.08);
  color: #FF4FC3;
  border: 1px solid rgba(255,79,195,.15);
}
.badge-blocked {
  background: rgba(239,68,68,.08);
  color: #f87171;
  border: 1px solid rgba(239,68,68,.15);
}
.badge-completed {
  background: rgba(34,197,94,.08);
  color: #22c55e;
  border: 1px solid rgba(34,197,94,.15);
}
.badge-pending {
  background: rgba(161,161,170,.1);
  color: #a1a1aa;
  border: 1px solid rgba(161,161,170,.15);
}

/* ── Progress Bar ── */
.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,.04);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #7C3AED, #B388FF);
  transition: width .6s cubic-bezier(.16,1,.3,1);
}

.progress-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem;
  color: #a1a1aa;
}

/* ── Project Detail ── */
.project-detail-header {
  margin-bottom: 40px;
}

.project-detail-header h1 {
  font-weight: 800;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -.03em;
  margin-bottom: 8px;
}

.project-meta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.project-meta-item {
  font-size: .82rem;
  color: #a1a1aa;
  display: flex;
  align-items: center;
  gap: 5px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 768px) {
  .detail-grid {
    grid-template-columns: 1.2fr .8fr;
  }
}

.detail-section {
  margin-bottom: 0;
}

.detail-section-title {
  font-weight: 700;
  font-size: .95rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Timeline ── */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: rgba(255,255,255,.06);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #7C3AED;
  border: 2px solid #09090B;
}

.timeline-title {
  font-weight: 600;
  font-size: .88rem;
  margin-bottom: 4px;
}

.timeline-body {
  font-size: .84rem;
  color: #a1a1aa;
  line-height: 1.7;
}

.timeline-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: .68rem;
  color: #52525b;
  margin-top: 4px;
}

/* ── Milestones ── */
.milestone-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,.03);
}

.milestone-item:last-child {
  border-bottom: none;
}

.milestone-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.milestone-check.completed {
  background: rgba(34,197,94,.12);
  border-color: #22c55e;
  color: #22c55e;
}

.milestone-check.in_progress, .milestone-check.in-progress {
  background: rgba(179,136,255,.1);
  border-color: #B388FF;
}

.milestone-title {
  font-weight: 600;
  font-size: .88rem;
}

.milestone-desc {
  font-size: .8rem;
  color: #a1a1aa;
  margin-top: 2px;
}

.milestone-due {
  font-family: 'JetBrains Mono', monospace;
  font-size: .68rem;
  color: #52525b;
  margin-top: 4px;
}

/* ── File Lists ── */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(9,9,11,.5);
  border: 1px solid rgba(255,255,255,.03);
  gap: 12px;
}

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

.file-name {
  font-size: .86rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: .72rem;
  color: #52525b;
  font-family: 'JetBrains Mono', monospace;
}

.file-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Upload Area ── */
.upload-area {
  border: 2px dashed rgba(255,255,255,.06);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  transition: all .3s;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: rgba(179,136,255,.2);
  background: rgba(179,136,255,.02);
}

.upload-area input[type="file"] {
  display: none;
}

.upload-label {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.upload-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(179,136,255,.06);
  border: 1px solid rgba(179,136,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #B388FF;
}

.upload-text {
  font-size: .86rem;
  color: #a1a1aa;
}

.upload-hint {
  font-size: .72rem;
  color: #52525b;
}

/* ── Table ── */
.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.06);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
}

thead {
  background: rgba(255,255,255,.02);
}

th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  font-size: .76rem;
  color: #52525b;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.03);
  vertical-align: middle;
}

tbody tr {
  transition: background .2s;
  cursor: pointer;
}

tbody tr:hover {
  background: rgba(255,255,255,.02);
}

tbody tr.selected {
  background: rgba(124,58,237,.06);
  border-color: rgba(124,58,237,.1);
}

/* ── Admin Panels ── */
.admin-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 1024px) {
  .admin-layout {
    grid-template-columns: 1.3fr .7fr;
  }
}

.admin-panel {
  position: sticky;
  top: 80px;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255,255,255,.02);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.04);
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 600;
  color: #52525b;
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all .3s;
  font-family: inherit;
}

.tab-btn:hover {
  color: #a1a1aa;
}

.tab-btn.active {
  background: rgba(124,58,237,.12);
  color: #B388FF;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ── Alerts ── */
.alert {
  padding: 14px 18px;
  border-radius: 10px;
  font-size: .86rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-error {
  background: rgba(239,68,68,.06);
  border: 1px solid rgba(239,68,68,.12);
  color: #f87171;
}

.alert-success {
  background: rgba(34,197,94,.06);
  border: 1px solid rgba(34,197,94,.12);
  color: #22c55e;
}

.alert-info {
  background: rgba(0,229,255,.04);
  border: 1px solid rgba(0,229,255,.08);
  color: #00E5FF;
}

/* ── Empty / Loading States ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(179,136,255,.04);
  border: 1px solid rgba(179,136,255,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: #B388FF;
}

.empty-state h3 {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.empty-state p {
  color: #52525b;
  font-size: .88rem;
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(179,136,255,.2);
  border-top-color: #B388FF;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-state {
  text-align: center;
  padding: 60px 20px;
}

.loading-state .loading-spinner {
  width: 32px;
  height: 32px;
  margin-bottom: 16px;
}

.loading-state p {
  color: #52525b;
  font-size: .88rem;
}

/* ── Orb Decoration ── */
.portal-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(150px);
  z-index: -1;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal .card-body {
  padding: 28px;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .page-header {
    flex-direction: column;
  }
  .portal-user-name {
    display: none;
  }
}

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-bar .form-select,
.filter-bar .form-input {
  width: auto;
  min-width: 180px;
  padding: 8px 14px;
  font-size: .82rem;
}

/* ── Back Link ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: #52525b;
  margin-bottom: 20px;
  transition: color .3s;
}

.back-link:hover {
  color: #e4e4e7;
}

/* ── Utilities ── */
.hidden { display: none !important; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: .82rem; }
.text-xs { font-size: .72rem; }
.text-muted { color: #a1a1aa; }
.text-dimmed { color: #52525b; }
.text-center { text-align: center; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }