/* ========================================
   Doc Portal - Shared Styles
   The Todd Hanley Mortgage Team
   Powered by United Direct Lending
   ======================================== */

:root {
  /* Brand Colors */
  --sage: #90b9b8;
  --navy: #090819;
  --blue: #1167ac;
  --light: #ecf2f7;
  --black: #000000;

  /* Semantic mappings */
  --primary: #1167ac;
  --primary-dark: #0d5290;
  --primary-light: #e8f1f9;
  --success: #059669;
  --success-light: #ecfdf5;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;

  /* Neutrals */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--light);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- Layout ---- */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
}

.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--navy);
}

/* ---- Header / Navbar ---- */
.portal-header {
  background: var(--navy);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.portal-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-header .brand-logo {
  height: 40px;
  width: auto;
}

.portal-header .brand-text {
  font-size: 16px;
  font-weight: 600;
  color: white;
}

.portal-header .brand-text small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--sage);
}

.portal-header .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-header .user-name {
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  font-size: 14px;
}

.portal-header .btn-outline {
  border-color: rgba(255,255,255,0.3);
  color: white;
}
.portal-header .btn-outline:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.5);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--blue);
  color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover:not(:disabled) { background: #047857; }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}
.btn-outline:hover:not(:disabled) {
  background: var(--gray-100);
  border-color: var(--gray-400);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
}

/* ---- Forms ---- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--gray-800);
  transition: border-color 0.15s;
  background: white;
}

.form-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(17, 103, 172, 0.12);
}

.form-input::placeholder { color: var(--gray-400); }

.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--gray-800);
  background: white;
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(17, 103, 172, 0.12);
}

/* PIN input - large centered digits */
.pin-input {
  text-align: center;
  font-size: 28px;
  letter-spacing: 12px;
  font-weight: 600;
  max-width: 200px;
  margin: 0 auto;
  display: block;
}

/* OTP input */
.otp-input {
  text-align: center;
  font-size: 32px;
  letter-spacing: 10px;
  font-weight: 600;
  max-width: 280px;
  margin: 0 auto;
  display: block;
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
}

.badge-pending { background: var(--gray-100); color: var(--gray-600); }
.badge-uploaded { background: #dbeafe; color: #1d4ed8; }
.badge-accepted { background: var(--success-light); color: var(--success); }
.badge-rejected { background: var(--danger-light); color: var(--danger); }
.badge-reviewed { background: var(--warning-light); color: var(--warning); }
.badge-active { background: var(--success-light); color: var(--success); }
.badge-expired { background: var(--warning-light); color: var(--warning); }
.badge-disabled { background: var(--danger-light); color: var(--danger); }

/* ---- Progress Bar ---- */
.progress-bar {
  width: 100%;
  height: 12px;
  background: var(--gray-200);
  border-radius: 100px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sage), var(--blue));
  border-radius: 100px;
  transition: width 0.4s ease;
}

.progress-text {
  font-size: 14px;
  color: var(--gray-600);
  text-align: center;
}

/* ---- Document Checklist Grid ---- */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.doc-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s;
}

.doc-card:hover { border-color: var(--blue); }

.doc-card .doc-type {
  font-weight: 600;
  font-size: 14px;
  color: var(--navy);
}

.doc-card .doc-info {
  font-size: 13px;
  color: var(--gray-500);
}

.doc-card.status-pending { border-left: 3px solid var(--gray-300); }
.doc-card.status-uploaded { border-left: 3px solid var(--blue); }
.doc-card.status-accepted { border-left: 3px solid var(--success); }
.doc-card.status-rejected { border-left: 3px solid var(--danger); }

/* ---- Upload Zone ---- */
.upload-zone {
  border: 2px dashed var(--sage);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(144, 185, 184, 0.06);
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--blue);
  background: var(--primary-light);
}

.upload-zone .upload-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.upload-zone .upload-text {
  font-size: 15px;
  color: var(--gray-600);
}

.upload-zone .upload-hint {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
}

/* Upload progress */
.upload-progress {
  margin-top: 12px;
  display: none;
}

.upload-progress.active { display: block; }

.upload-progress .filename {
  font-size: 13px;
  color: var(--gray-600);
  margin-bottom: 4px;
}

/* ---- Tables ---- */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--gray-600);
  background: var(--light);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

tbody tr:hover { background: var(--light); }
tbody tr.clickable { cursor: pointer; }

/* ---- Login Screen ---- */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--navy);
  position: relative;
  overflow: hidden;
}

/* Subtle diagonal accent */
.login-container::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 200%;
  background: linear-gradient(135deg, transparent 40%, rgba(144,185,184,0.06) 40%, rgba(144,185,184,0.06) 60%, transparent 60%);
  pointer-events: none;
}

.login-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  padding: 40px;
  max-width: 420px;
  width: 100%;
  position: relative;
  z-index: 1;
}

.login-card .logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-card .logo img {
  max-height: 60px;
  width: auto;
  margin-bottom: 12px;
}

.login-card .logo h1 {
  font-size: 20px;
  color: var(--navy);
  margin-bottom: 4px;
  font-weight: 700;
}

.login-card .logo p {
  font-size: 13px;
  color: var(--gray-500);
}

.login-card .secure-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--sage);
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}

/* ---- Alerts ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
  display: none;
}

.alert.show { display: block; }

.alert-error {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid #fecaca;
}

.alert-success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid #a7f3d0;
}

.alert-info {
  background: var(--primary-light);
  color: var(--blue);
  border: 1px solid #bfdbfe;
}

/* ---- Loading Spinner ---- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top: 2px solid var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  display: none;
}

.loading-overlay.active { display: flex; }

/* ---- Footer ---- */
.portal-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.7);
  padding: 32px 20px 24px;
  margin-top: 40px;
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.footer-brand img {
  height: 36px;
  margin-bottom: 10px;
}

.footer-brand p {
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255,255,255,0.5);
  max-width: 280px;
}

.footer-contact {
  font-size: 12px;
  line-height: 1.8;
}

.footer-contact a {
  color: var(--sage);
  text-decoration: none;
}
.footer-contact a:hover { text-decoration: underline; }

.footer-social {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

.footer-social a {
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s;
}
.footer-social a:hover {
  color: var(--sage);
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-legal {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  line-height: 1.6;
  max-width: 600px;
}

.footer-badges {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-badges img {
  height: 28px;
  opacity: 0.7;
}

/* ---- Admin Login Variant ---- */
.admin-login-bg {
  background: var(--navy);
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .container { padding: 12px; }
  .card { padding: 16px; }
  .login-card { padding: 28px 20px; }
  .doc-grid { grid-template-columns: 1fr; }
  .portal-header { flex-direction: column; gap: 8px; }
  table { font-size: 13px; }
  thead th, tbody td { padding: 8px 6px; }
  .btn-lg { padding: 12px 20px; font-size: 15px; }
  .footer-top { flex-direction: column; gap: 20px; }
  .footer-bottom { flex-direction: column; text-align: center; }
}

/* ---- Utility ---- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 13px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.gap-1 { gap: 8px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
