/* ==========================================================================
   LYNX EMS INDUSTRIAL - CLIENT PORTAL & NESTING STYLES
   ========================================================================== */

/* Auth Modals (Login & Register) */
.lynx-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(8, 8, 10, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lynx-modal-backdrop.active {
  opacity: 1;
  pointer-events: all;
}

.lynx-modal-card {
  width: 100%;
  max-width: 440px;
  background: rgba(16, 16, 19, 0.95);
  border: 1px solid var(--border-cad);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  padding: 32px;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.lynx-modal-backdrop.active .lynx-modal-card {
  transform: scale(1);
}

.lynx-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: #a0a0ab;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s ease;
}

.lynx-modal-close:hover {
  color: var(--text-primary);
}

.lynx-modal-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 8px;
  text-align: center;
}

.lynx-modal-subtitle {
  color: #a0a0ab;
  font-size: 0.85rem;
  text-align: center;
  margin-bottom: 24px;
}

/* Restricted Area Section (Simulador de Nesting) */
.restricted-section {
  display: none; /* Controlled by JS auth status */
  padding: 6rem 0;
  border-top: 1px solid var(--border-cad);
  background-color: rgba(12, 12, 14, 0.9);
  position: relative;
}

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

.portal-user-info h2 {
  font-size: 1.8rem;
  margin-bottom: 4px;
}

.portal-user-info span {
  font-size: 0.9rem;
  color: var(--color-laser-blue);
  font-weight: 500;
}

.portal-actions {
  display: flex;
  gap: 12px;
}

/* Nesting Dashboard Layout */
.nesting-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 30px;
  align-items: start;
}

.nesting-sidebar {
  background: var(--bg-dark-card);
  border: 1px solid var(--border-cad);
  border-radius: 8px;
  padding: 24px;
}

.nesting-sidebar h3 {
  font-size: 1.15rem;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
}

/* Drag & Drop File Zone */
.dxf-dropzone {
  border: 2px dashed var(--border-cad);
  border-radius: 8px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  background: rgba(255,255,255,0.01);
  transition: all 0.2s ease;
  margin-bottom: 20px;
}

.dxf-dropzone:hover, .dxf-dropzone.dragover {
  border-color: var(--color-laser-blue);
  background: rgba(0, 240, 255, 0.03);
}

.dxf-dropzone-icon {
  color: var(--color-laser-blue);
  margin-bottom: 12px;
}

.dxf-dropzone p {
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.dxf-dropzone span {
  font-size: 0.75rem;
  color: #a0a0ab;
}

/* Loaded DXF file items */
.dxf-file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}

.dxf-file-item {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-cad);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dxf-file-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dxf-file-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
}

.dxf-file-remove {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 0.75rem;
}

.dxf-file-details {
  font-size: 0.75rem;
  color: #a0a0ab;
  display: flex;
  justify-content: space-between;
}

.dxf-file-qty-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-top: 8px;
  margin-top: 4px;
}

.dxf-file-qty-control label {
  font-size: 0.75rem;
  color: var(--text-primary);
}

.dxf-file-qty-input {
  width: 60px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-cad);
  border-radius: 4px;
  padding: 4px 6px;
  color: var(--text-primary);
  font-size: 0.75rem;
  text-align: center;
}

/* Nesting Workspace Output */
.nesting-workspace {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Metrics Dashboard Cards */
.nesting-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.nesting-metric-card {
  background: var(--bg-dark-card);
  border: 1px solid var(--border-cad);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.nesting-metric-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--color-laser-blue);
}

.nesting-metric-card.accent::before {
  background: var(--color-laser-orange);
}

.nesting-metric-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #a0a0ab;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.nesting-metric-value {
  font-size: 1.6rem;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.nesting-metric-desc {
  font-size: 0.7rem;
  color: #a0a0ab;
  margin-top: 4px;
}

/* Canvas Blueprint Sheet */
.nesting-canvas-container {
  background: #08080a;
  border: 1px solid var(--border-cad);
  border-radius: 8px;
  padding: 24px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.nesting-canvas-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: #a0a0ab;
}

.nesting-canvas-wrapper {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(0, 240, 255, 0.1);
  background-image: 
    linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  padding: 10px;
}

.nesting-canvas-wrapper canvas {
  display: block;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* Client History Section */
.client-history-card {
  background: var(--bg-dark-card);
  border: 1px solid var(--border-cad);
  border-radius: 8px;
  padding: 24px;
  margin-top: 40px;
}

.client-history-card h3 {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
}

.client-history-table-wrapper {
  overflow-x: auto;
}

.client-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.client-history-table th {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--border-cad);
  color: #a0a0ab;
  font-weight: 600;
}

.client-history-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.client-history-status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.client-history-status-badge.novo {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.client-history-status-badge.qualificado {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.client-history-status-badge.descartado {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.client-history-status-badge.qualificacao {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.client-history-status-badge.contato {
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

/* Layout for login trigger link in header */
.nav-link.client-portal-btn {
  color: var(--color-laser-blue) !important;
  font-weight: 600;
  border: 1px solid rgba(0, 240, 255, 0.3);
  padding: 6px 14px !important;
  border-radius: 4px;
  margin-left: 10px;
  transition: all 0.2s ease;
}

.nav-link.client-portal-btn:hover {
  background: rgba(0, 240, 255, 0.05);
  border-color: var(--color-laser-blue);
  color: #fff !important;
}

.nav-link.client-portal-btn.logged-in {
  border-color: var(--color-laser-orange);
  color: var(--color-laser-orange) !important;
}

.nav-link.client-portal-btn.logged-in:hover {
  background: rgba(255, 94, 0, 0.05);
  border-color: var(--color-laser-orange);
}

/* Dropdown menu for logged in client */
.client-dropdown {
  position: relative;
  display: inline-block;
}

.client-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: rgba(16, 16, 19, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-cad);
  min-width: 160px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.5);
  border-radius: 4px;
  z-index: 100;
  margin-top: 8px;
}

.client-dropdown:hover .client-dropdown-menu {
  display: block;
}

.client-dropdown-item {
  color: var(--text-primary);
  padding: 10px 16px;
  text-decoration: none;
  display: block;
  font-size: 0.85rem;
  transition: background 0.2s ease;
  cursor: pointer;
  text-align: left;
}

.client-dropdown-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--color-laser-blue);
}

.client-dropdown-item.logout {
  color: #ef4444;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.client-dropdown-item.logout:hover {
  background: rgba(239, 68, 68, 0.05);
  color: #ef4444;
}

/* Adjustments for Nesting Sidebar forms */
.nesting-sidebar .form-group {
  margin-bottom: 12px;
}

.nesting-sidebar .form-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #a0a0ab;
}

.nesting-sidebar .form-control {
  font-size: 0.85rem;
  padding: 8px 10px;
}
