/**
 * ECONS - Área de Clientes (Customer Portal)
 * Estilos dedicados para el panel B2B de constructoras y clientes
 */

.portal-body {
  background-color: #ffffff;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.portal-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.portal-sidebar {
  width: 280px;
  background: #ffffff;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--border);
  z-index: 30;
}

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

.portal-brand .wordmark {
  color: var(--primary);
  font-size: 28px;
}

.portal-brand .wordmark span {
  color: var(--text-main);}

.portal-badge-tag {
  background: var(--primary-light);
  color: #2b3dde;
  border: 1px solid rgba(43, 61, 222, 0.2);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.portal-user-brief {
  padding: 20px 22px;
  background: #f5f6fa;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2b3dde, #7084ff);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 16px;
  font-family: var(--font-display);
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(43, 61, 222, 0.3);
}

.portal-user-meta {
  overflow: hidden;
}

.portal-user-meta strong {
  display: block;
  font-size: 13px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-user-meta span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-nav {
  padding: 20px 14px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.portal-nav-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 12px 12px 6px;
  margin-top: 8px;
}

.portal-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.2s;
}

.portal-nav-item svg {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color 0.2s;
}

.portal-nav-item:hover {
  background: #f5f6fa;
  color: var(--primary);}

.portal-nav-item:hover svg {
  color: var(--primary);}

.portal-nav-item.active {
  background: #2b3dde;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(43, 61, 222, 0.35);
}

.portal-nav-item.active svg {
  color: #ffffff;
}

.portal-sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.portal-logout-link {
  color: #ef4444;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.portal-logout-link:hover {
  color: #f87171;
  text-decoration: underline;
}

.portal-home-link {
  color: var(--text-muted);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.portal-home-link:hover {
  color: var(--primary);}

/* Main Area */
.portal-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}

.portal-topbar {
  height: 70px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 20;
}

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

.portal-topbar-title h1 {
  font: 700 20px var(--font-display);
  color: #0f172a;
  letter-spacing: -0.02em;
}

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

.portal-phone-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.portal-content {
  padding: 32px;
  flex: 1;
}

/* Welcome Hero Card */
.portal-welcome-card {
  background: var(--primary-light);
  color: var(--text-main);
  padding: 30px;
  border-radius: 8px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  box-shadow: none;
  border: 1px solid var(--border);
}

.portal-welcome-card::after {
  content: "ECONS";
  position: absolute;
  right: -20px;
  bottom: -30px;
  font: 800 120px var(--font-display);
  color: rgba(43, 61, 222, 0.06);
  pointer-events: none;
}

.portal-welcome-content h2 {
  font: 700 26px var(--font-display);
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.portal-welcome-content p {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 620px;
  line-height: 1.6;
}

.portal-welcome-actions {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.metric-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 22px;
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.metric-icon.blue { background: #eff6ff; color: #2b3dde; }
.metric-icon.amber { background: #fffbeb; color: #d97706; }
.metric-icon.green { background: #f0fdf4; color: #16a34a; }
.metric-icon.purple { background: #faf5ff; color: #9333ea; }

.metric-data small {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.metric-data strong {
  display: block;
  font: 700 24px var(--font-display);
  color: #0f172a;
  letter-spacing: -0.03em;
}

.metric-data span {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

/* Dashboard Sections Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
}

.panel-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  overflow: hidden;
  margin-bottom: 24px;
}

.panel-card-header {
  padding: 18px 22px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fcfcfd;
}

.panel-card-header h3 {
  font: 700 16px var(--font-display);
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-card-body {
  padding: 22px;
}

/* Order Dispatch / Hiab Tracking Banner */
.dispatch-banner {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

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

.dispatch-header h4 {
  font: 700 15px var(--font-display);
  color: #0f172a;
}

.dispatch-header p {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

/* Tracker Step Process */
.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  margin: 24px 0 16px;
}

.stepper::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 24px;
  right: 24px;
  height: 3px;
  background: #e2e8f0;
  z-index: 1;
}

.step-item {
  position: relative;
  z-index: 2;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 90px;
}

.step-node {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 8px;
  transition: all 0.2s;
}

.step-item.completed .step-node {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
}

.step-item.active .step-node {
  background: #2b3dde;
  border-color: #2b3dde;
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(43, 61, 222, 0.2);
}

.step-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  line-height: 1.2;
}

.step-item.active .step-label {
  color: #2b3dde;
  font-weight: 700;
}

/* Tables */
.data-table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
}

.data-table tr:hover td {
  background: #f8fafc;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-blue { background: #eff6ff; color: #1d4ed8; }
.badge-green { background: #ecfdf5; color: #047857; }
.badge-amber { background: #fffbeb; color: #b45309; }
.badge-red { background: #fef2f2; color: #b91c1c; }
.badge-gray { background: #f1f5f9; color: #475569; }

/* Obra / Projects list */
.project-card-item {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 12px;
  background: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-meta h4 {
  font: 700 14px var(--font-display);
  color: #0f172a;
}

.project-meta p {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

/* Forms in Portal */
.portal-form-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 30px;
  margin-bottom: 24px;
}

.portal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.portal-form-grid .full {
  grid-column: 1 / -1;
}

.portal-field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
}

.portal-field input,
.portal-field select,
.portal-field textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  padding: 11px 14px;
  border-radius: 6px;
  font-size: 13px;
  color: #1e293b;
  outline: none;
  transition: all 0.2s;
}

.portal-field input:focus,
.portal-field select:focus,
.portal-field textarea:focus {
  border-color: #2b3dde;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(43, 61, 222, 0.12);
}

/* Auth Cards (Login & Registro) */
.auth-page {
  min-height: 100vh;
  background: #f5f6fa;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 16px;
}

.auth-card {
  width: min(480px, 100%);
  background: #ffffff;
  border-radius: 8px;
  padding: 40px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-header .wordmark {
  font-size: 36px;
  display: inline-block;
  margin-bottom: 12px;
}

.auth-header h2 {
  font: 700 22px var(--font-display);
  color: #0f172a;
}

.auth-header p {
  color: #64748b;
  font-size: 13px;
  margin-top: 4px;
}

.demo-account-box {
  background: #eff6ff;
  border: 1px dashed #93c5fd;
  border-radius: 6px;
  padding: 14px;
  margin-bottom: 22px;
  font-size: 12px;
  color: #1e40af;
}

.demo-account-box strong {
  display: block;
  margin-bottom: 4px;
  color: #1d4ed8;
}

.btn-fill-demo {
  background: #2b3dde;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
}

.btn-fill-demo:hover {
  background: #202da8;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 20px;
}

.alert-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 20px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

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

.modal-window {
  background: #ffffff;
  width: min(720px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 8px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font: 700 18px var(--font-display);
  color: #0f172a;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Responsive Portal */
@media (max-width: 1024px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .portal-layout { flex-direction: column; }
  .portal-sidebar {
    width: 100%;
    height: auto;
    position: static;
  }
  .portal-topbar { padding: 0 16px; }
  .portal-content { padding: 20px 16px; }
  .metrics-grid { grid-template-columns: 1fr; }
  .portal-form-grid { grid-template-columns: 1fr; }
  .stepper { flex-wrap: wrap; gap: 14px; }
  .stepper::before { display: none; }
}

/* Logo oficial en el portal */
.portal-brand .site-logo {
  height: 34px;
}
