/* Estimate Detail Panel — Professional styling */

.estimate-detail-panel {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: transparent;
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 40px;
  animation: panelSlideIn 350ms cubic-bezier(0.16,1,0.3,1);
}

.estimate-detail-panel.open {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.estimate-detail-panel__backdrop {
  position: fixed;
  inset: 0;
  z-index: 399;
  background: linear-gradient(135deg, rgba(8,10,12,0.97) 0%, rgba(15,17,22,0.98) 100%);
  backdrop-filter: blur(12px);
  cursor: pointer;
}

.estimate-detail-panel__close {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 401;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--color-text-primary);
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms cubic-bezier(0.4,0,0.2,1);
}

.estimate-detail-panel__close:hover {
  background: rgba(255,255,255,0.15);
  transform: scale(1.08);
}

.estimate-detail-content {
  max-width: 980px;
  width: 100%;
  background: linear-gradient(160deg, #111418 0%, #0C0E11 60%, #0A0C0F 100%);
  border: 1px solid rgba(200,169,110,0.15);
  border-radius: 20px;
  box-shadow: 0 40px 120px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.05) inset;
  padding: 48px;
}

.estimate-detail__header {
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid rgba(200,169,110,0.2);
}

.estimate-detail__title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.estimate-detail__title {
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  color: var(--color-text-primary);
  font-family: 'Cormorant Garamond', Georgia, serif;
  letter-spacing: -0.01em;
}

.estimate-detail__status {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid rgba(200,169,110,0.3);
  background: rgba(200,169,110,0.15);
  color: rgba(200,169,110,0.95);
}

.estimate-detail__status.status--submitted {
  background: rgba(245,158,11,0.15);
  border-color: rgba(245,158,11,0.3);
  color: rgba(245,158,11,0.9);
}

.estimate-detail__status.status--approved {
  background: rgba(16,185,129,0.15);
  border-color: rgba(16,185,129,0.3);
  color: rgba(16,185,129,0.9);
}

.estimate-detail__status.status--declined {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.3);
  color: rgba(239,68,68,0.9);
}

.estimate-detail__subtitle {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.estimate-detail__section {
  margin-bottom: 40px;
}

.estimate-detail__section-title {
  margin: 0 0 20px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.estimate-detail__section-title::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(200,169,110,0.4);
}

/* Line Items Table */

.estimate-detail__line-items {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}

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

.estimate-detail__line-items thead {
  background: rgba(200,169,110,0.05);
  border-bottom: 1px solid rgba(200,169,110,0.15);
}

.estimate-detail__line-items th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: 0.02em;
  font-size: 12px;
  text-transform: uppercase;
}

.estimate-detail__line-items th:last-child {
  text-align: right;
}

.estimate-detail__line-items td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--color-text-primary);
}

.estimate-detail__line-items tr:last-child td {
  border-bottom: none;
}

.estimate-detail__line-items td:last-child {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  color: rgba(200,169,110,0.9);
}

/* Totals */

.estimate-detail__totals {
  background: rgba(200,169,110,0.06);
  border: 1px solid rgba(200,169,110,0.2);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
}

.estimate-detail__totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(200,169,110,0.1);
}

.estimate-detail__totals-row:last-child {
  border-bottom: none;
  padding-top: 16px;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.estimate-detail__totals-label {
  color: var(--color-text-muted);
}

.estimate-detail__totals-value {
  font-family: 'JetBrains Mono', monospace;
  color: var(--color-text-primary);
  font-weight: 500;
  letter-spacing: 0.03em;
}

.estimate-detail__totals-row:last-child .estimate-detail__totals-value {
  font-size: 20px;
  color: rgba(200,169,110,0.95);
}

/* Signatures */

.estimate-detail__signatures {
  background: rgba(200,169,110,0.05);
  border-left: 3px solid rgba(200,169,110,0.4);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.estimate-detail__signature-item {
  padding: 14px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  border-left: 3px solid rgba(200,169,110,0.2);
}

.estimate-detail__signature-item.signed {
  background: rgba(74,222,128,0.08);
  border-left-color: #4ade80;
}

.estimate-detail__signature-status {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

.estimate-detail__signature-status.signed {
  color: #4ade80;
}

.estimate-detail__signature-status.pending {
  color: var(--color-text-muted);
}

.estimate-detail__signature-name {
  font-size: 13px;
  color: var(--color-text-primary);
  margin: 6px 0 4px;
  font-weight: 500;
}

.estimate-detail__signature-date {
  font-size: 11px;
  color: var(--color-text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* History & Activity */

.estimate-detail__history-item {
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  border-left: 2px solid rgba(200,169,110,0.2);
  font-size: 12px;
}

.estimate-detail__history-item.current {
  background: rgba(74,222,128,0.08);
  border-left-color: #4ade80;
}

.estimate-detail__history-label {
  color: var(--color-text-primary);
  font-weight: 500;
  margin-bottom: 4px;
}

.estimate-detail__history-label.current {
  color: #4ade80;
}

.estimate-detail__history-meta {
  color: var(--color-text-muted);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
}

/* Actions */

.estimate-detail__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.estimate-detail__action-btn {
  padding: 10px 16px;
  background: rgba(200,169,110,0.2);
  border: 1px solid rgba(200,169,110,0.4);
  border-radius: 8px;
  color: var(--color-text-primary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 200ms cubic-bezier(0.4,0,0.2,1);
  font-family: inherit;
}

.estimate-detail__action-btn:hover {
  background: rgba(200,169,110,0.35);
  border-color: rgba(200,169,110,0.6);
  transform: translateY(-2px);
}

.estimate-detail__action-btn.primary {
  background: rgba(200,169,110,0.3);
  border-color: rgba(200,169,110,0.5);
}

.estimate-detail__action-btn.success {
  background: rgba(16,185,129,0.2);
  border-color: rgba(16,185,129,0.4);
  color: #10b981;
}

.estimate-detail__action-btn.danger {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.4);
  color: #ef4444;
}

/* Animations */

@keyframes panelSlideIn {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes modalFadeIn {
  from {
    transform: scale(0.94) translateY(16px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* Signature Modal */

#signatureModal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4,5,6,0.82);
  backdrop-filter: blur(12px);
}

#signatureModal.open {
  display: flex;
}

#signatureModal > div:first-child {
  position: absolute;
  inset: 0;
  cursor: pointer;
}

#signatureModal__sheet {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: linear-gradient(160deg,#111418 0%,#0C0E11 60%,#0A0C0F 100%);
  border: 1px solid rgba(200,169,110,0.22);
  border-radius: 16px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.7);
  padding: 32px;
  transform: scale(0.94);
  animation: modalFadeIn 300ms cubic-bezier(0.16,1,0.3,1) forwards;
}

#signatureModal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 200ms;
}

#signatureModal__close:hover {
  background: rgba(255,255,255,0.12);
}

#signatureForm {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#signatureForm input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: var(--color-text-primary);
  font-size: 14px;
  transition: border-color 200ms;
  font-family: inherit;
}

#signatureForm input:focus {
  outline: none;
  border-color: rgba(200,169,110,0.4);
}

#signatureForm input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.6;
}

#signatureForm button {
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 200ms;
  font-family: inherit;
}

#signatureForm button[type="reset"] {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--color-text-primary);
}

#signatureForm button[type="submit"] {
  background: rgba(200,169,110,0.3);
  border: 1px solid rgba(200,169,110,0.4);
  color: var(--color-text-primary);
  font-weight: 600;
}

#signatureForm button:hover {
  opacity: 0.9;
}
