/* ====================================
   MODALS - Overlay, Forms, Filter Panel
   ==================================== */

/* ====== MODAL OVERLAY & BACKDROP ====== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.active {
  display: flex;
  background: rgba(0,0,0,0.5);
}

/* ====== MODAL STRUCTURE ====== */
.modal-content {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  position: relative;
  transform: scale(0.9) translateY(-20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.modal.active .modal-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.modal-header {
  padding: 25px 30px;
  border-bottom: 2px solid #667eea;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 16px 16px 0 0;
  position: relative;
  flex-shrink: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
}

.modal-body {
  padding: 30px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 20px 30px;
  border-top: 1px solid #e0e0e0;
  background: #f8f9fa;
  border-radius: 0 0 16px 16px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ====== CLOSE BUTTON ====== */
.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s;
  line-height: 1;
}

.close-btn:hover {
  background: rgba(255,255,255,0.2);
}

/* ====== DETAIL GRID ====== */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-label {
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.detail-value {
  font-size: 15px;
  color: #333;
  font-weight: 500;
}

.detail-value.status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  width: fit-content;
}

/* ====== MODAL FOOTER BUTTONS ====== */
.modal-footer .btn-secondary {
  background: white;
  color: #666;
  border: 1px solid #e0e0e0;
}

.modal-footer .btn-secondary:hover {
  background: #f8f9fa;
}

/* ====== RESPONSIVE MODAL ====== */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .modal-header {
    padding: 20px;
  }

  .modal-body {
    padding: 20px;
  }

  .modal-footer {
    padding: 15px 20px;
    flex-direction: column;
  }

  .modal-footer button {
    width: 100%;
  }
}

/* ====== FILTER PANEL SIDEBAR ====== */
.filter-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100%;
  background: white;
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  z-index: 2000;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.filter-panel.open {
  right: 0;
}

.filter-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1999;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.filter-panel-overlay.active {
  display: block;
  opacity: 1;
}

.filter-header {
  padding: 25px;
  border-bottom: 2px solid #667eea;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.filter-body {
  padding: 25px;
}

.filter-group {
  margin-bottom: 25px;
}

.filter-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 14px;
  color: #333;
}

.filter-select {
  width: 100%;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  background: white;
  cursor: pointer;
  transition: border-color 0.3s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.filter-select:focus {
  outline: none;
  border-color: #667eea;
}

.filter-footer {
  padding: 20px 25px;
  border-top: 1px solid #e0e0e0;
  background: #f8f9fa;
  display: flex;
  gap: 10px;
  position: sticky;
  bottom: 0;
}

/* ====== MULTI-SELECT STATUS DROPDOWN ====== */
.status-multiselect {
  position: relative;
}

.status-multiselect-btn {
  width: 100%;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  background: white;
  cursor: pointer;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.3s;
}

.status-multiselect-btn:hover,
.status-multiselect-btn:focus {
  border-color: #667eea;
  outline: none;
}

.status-multiselect-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  background: white;
  border: 2px solid #667eea;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 100;
  display: none;
  max-height: 300px;
  overflow-y: auto;
}

.status-multiselect-dropdown.open {
  display: block;
}

.status-multiselect-header {
  padding: 12px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  gap: 8px;
  background: #f8f9fa;
}

.status-multiselect-header button {
  flex: 1;
  padding: 6px 12px;
  border: 1px solid #667eea;
  border-radius: 6px;
  background: white;
  color: #667eea;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.status-multiselect-header button:hover {
  background: #667eea;
  color: white;
}

.status-multiselect-options {
  padding: 8px;
}

.status-multiselect-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.status-multiselect-option:hover {
  background: #f8f9ff;
}

.status-multiselect-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #667eea;
  cursor: pointer;
}

/* ====== NOTES SECTION ====== */
.note-card {
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #ffffff;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.note-card:hover {
  border-color: #667eea;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.note-card.note-selected {
  background: #f8f9ff;
  border-color: #667eea;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.note-text {
  font-size: 14px;
  line-height: 1.6;
  color: #2d3748;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.note-edit-textarea {
  font-family: inherit;
  resize: vertical;
}

.note-checkbox {
  width: 18px;
  height: 18px;
  accent-color: #667eea;
  cursor: pointer;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 13px;
  min-width: auto;
}

/* ====== MINI MODAL FOR SELECTORS ====== */
.mini-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0);
  z-index: 3000;
  justify-content: center;
  align-items: center;
  transition: background 0.3s ease;
}

.mini-modal.active {
  display: flex;
  background: rgba(0,0,0,0.4);
}

.mini-modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  max-height: 80vh;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  transform: scale(0.9);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mini-modal.active .mini-modal-content {
  transform: scale(1);
  opacity: 1;
}

.mini-modal-header {
  padding: 20px 24px;
  border-bottom: 2px solid #667eea;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mini-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.mini-modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.mini-modal-close:hover {
  background: rgba(255,255,255,0.2);
}

.mini-modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.mini-modal-body .client-selector-list {
  max-height: none;
}
/* GLOBAL LETTER-SPACING */ * { letter-spacing: -0.04em !important; }
