/* =========== Details Tab Styles =========== */

.details-container {
  padding: 16px !important;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 320px));
  gap: 12px;
  justify-content: center;
}

.details-card {
  background: var(--bg-secondary);
  border-radius: 10px;
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.details-card:hover {
  box-shadow: var(--shadow-sm);
}

/* מצב עריכה - כרטיס מודגש */
.details-card.editing {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.details-card-primary {
  grid-column: span 1;
  max-width: 400px;
}

@media (min-width: 900px) {
  .details-card-primary {
    grid-column: span 2;
    max-width: 650px;
  }
}

/* Card Header - עם כפתור עריכה */
.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-light);
}

.card-header .card-icon {
  font-size: 16px;
}

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  flex: 1;
}

/* כפתור עריכה בכותרת */
.card-edit-btn {
  opacity: 0;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-tertiary);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.details-card:hover .card-edit-btn {
  opacity: 1;
}

.card-edit-btn:hover {
  color: var(--accent-primary);
  background: var(--accent-light);
  border-color: var(--accent-primary);
}

/* כפתורים במצב עריכה */
.card-edit-actions {
  display: none;
  gap: 4px;
}

.details-card.editing .card-edit-btn {
  display: none;
}

.details-card.editing .card-edit-actions {
  display: flex;
}

.edit-save-btn, .edit-cancel-btn {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.edit-save-btn {
  background: var(--accent-primary);
  color: white;
}

.edit-save-btn:hover {
  background: var(--accent-hover);
}

.edit-cancel-btn {
  background: var(--bg-primary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.edit-cancel-btn:hover {
  background: var(--bg-tertiary);
}

.card-content {
  padding: 12px 14px;
}

/* Detail Rows */
.detail-row {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  min-height: 32px;
}

.detail-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.detail-row:first-child {
  padding-top: 0;
}

.detail-label {
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
  width: 60px;
  text-align: right;
}

.detail-value {
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 12px;
}

.detail-name {
  font-weight: 600;
  font-size: 15px;
}

.empty-value {
  color: var(--text-tertiary);
  font-style: italic;
  font-size: 12px;
}

/* =========== מצב עריכה - שדות =========== */
.editable-text {
  display: inline;
}

.edit-input-wrapper {
  display: none;
  flex: 1;
}

.details-card.editing .editable-text {
  display: none;
}

.details-card.editing .edit-input-wrapper {
  display: block;
}

.edit-input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 13px;
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}

.edit-input:focus {
  border-color: var(--accent-primary);
}

.edit-input::placeholder {
  color: var(--text-tertiary);
  font-style: italic;
}

/* Phone Display */
.phone-options {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.phone-display {
  font-family: 'Courier New', monospace;
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.phone-copy-buttons {
  display: flex;
  gap: 2px;
}

/* Copy Buttons */
.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 3px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.copy-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.copy-btn.mini {
  padding: 2px 5px;
  font-size: 10px;
}

/* Status Badge */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.status-active { background: #dcfce7; color: #166534; }
.status-inactive { background: #fef3c7; color: #92400e; }
.status-completed { background: #e0e7ff; color: #3730a3; }
.status-interested { background: #fce7f3; color: #9d174d; }
.status-disconnected { background: #fee2e2; color: #991b1b; }
.status-unknown { background: var(--bg-tertiary); color: var(--text-secondary); }

.substatus-text {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* WhatsApp Section */
.whatsapp-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.whatsapp-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-size: 12px;
}

.whatsapp-item .wa-icon {
  font-size: 14px;
}

.whatsapp-item .wa-label {
  flex: 1;
  color: var(--text-primary);
}

.whatsapp-item.disabled {
  opacity: 0.5;
}

/* Links */
.links-content {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.link-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-size: 12px;
}

.link-row .link-icon {
  font-size: 14px;
}

.link-row .link-text {
  flex: 1;
  color: var(--text-primary);
}

.link-row .link-actions {
  display: flex;
  gap: 3px;
}

.link-row a.open-link {
  padding: 2px 6px;
  background: var(--accent-light);
  color: var(--accent-primary);
  text-decoration: none;
  border-radius: 4px;
  font-size: 11px;
  transition: all 0.15s;
}

.link-row a.open-link:hover {
  background: var(--accent-primary);
  color: white;
}

/* No Link State */
.no-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border: 1px dashed var(--border-light);
  border-radius: 6px;
  color: var(--text-tertiary);
  font-size: 11px;
}

/* Address */
.address-display {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.address-city {
  font-size: 11px;
  color: var(--text-secondary);
}

.address-full {
  font-size: 12px;
}

/* Notes */
.notes-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.notes-value {
  width: 100%;
  text-align: right;
  background: var(--bg-tertiary);
  padding: 6px 8px;
  border-radius: 6px;
  line-height: 1.4;
  white-space: pre-wrap;
  font-size: 11px;
  max-height: 60px;
  overflow-y: auto;
}

.edit-textarea {
  width: 100%;
  min-height: 60px;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  resize: vertical;
  outline: none;
}

.edit-textarea:focus {
  border-color: var(--accent-primary);
}

/* Dates */
.upcoming-date {
  color: var(--success);
  font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
  .details-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .details-card-primary {
    max-width: 100%;
  }
  
  .card-edit-btn {
    opacity: 1;
  }
  
  .detail-row {
    flex-wrap: wrap;
  }
  
  .detail-label {
    width: 100%;
    margin-bottom: 2px;
    text-align: right;
  }
  
  .detail-value {
    margin-right: 0;
  }
  
  .phone-options {
    width: 100%;
  }
}
