/**
 * Blank Task Modal Styles
 * Modal for creating HD/Partnership cases from scratch
 * Class names match blank-task-modal.js HTML template
 */

/* ==========================================
   OVERLAY & MODAL CONTAINER
   ========================================== */

.btm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.btm-modal {
  background: var(--bg-card, #ffffff);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: btmSlideUp 0.3s ease-out;
}

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

/* ==========================================
   HEADER
   ========================================== */

.btm-header {
  background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
  color: white;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btm-header-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.btm-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.btm-subtitle {
  font-size: 14px;
  font-weight: 400;
  margin: 0;
  opacity: 0.9;
}

.btm-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

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

.btm-close-btn svg {
  width: 20px;
  height: 20px;
}

/* ==========================================
   CASE BANNER (Remaining Cases)
   ========================================== */

.btm-case-banner {
  padding: 12px 24px;
  background: rgba(59, 130, 246, 0.08);
  border-bottom: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
  display: flex;
  align-items: center;
  gap: 8px;
}

.btm-case-banner.btm-case-available {
  background: rgba(16, 185, 129, 0.08);
}

.btm-case-banner.btm-case-available .btm-case-info {
  color: #059669;
}

.btm-case-banner.btm-case-warning {
  background: rgba(245, 158, 11, 0.08);
}

.btm-case-banner.btm-case-warning .btm-case-info {
  color: #d97706;
}

.btm-case-banner.btm-case-depleted {
  background: rgba(239, 68, 68, 0.08);
}

.btm-case-banner.btm-case-depleted .btm-case-info {
  color: #dc2626;
}

.btm-case-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #3B82F6;
}

.btm-case-info svg {
  width: 18px;
  height: 18px;
}

/* ==========================================
   BODY (Scrollable Form)
   ========================================== */

.btm-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.btm-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ==========================================
   FORM FIELDS
   ========================================== */

.btm-form-group {
  margin-bottom: 20px;
}

.btm-form-group:last-child {
  margin-bottom: 0;
}

.btm-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary, #1e293b);
  margin-bottom: 8px;
}

.btm-required {
  color: #ef4444;
  margin-left: 2px;
}

.btm-field-hint {
  font-size: 13px;
  color: var(--text-tertiary, #94a3b8);
  margin: 0 0 10px 0;
}

.btm-input,
.btm-textarea,
.btm-select {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
  border-radius: 10px;
  background: white;
  transition: all 0.2s;
  font-family: inherit;
  color: var(--text-primary, #1e293b);
}

.btm-input::placeholder,
.btm-textarea::placeholder {
  color: var(--text-tertiary, #94a3b8);
}

.btm-input:focus,
.btm-textarea:focus,
.btm-select:focus {
  outline: none;
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btm-input.error,
.btm-textarea.error,
.btm-select.error {
  border-color: #ef4444;
}

.btm-textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

.btm-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* Two-column layout */
.btm-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.btm-form-row .btm-form-group {
  margin-bottom: 0;
}

@media (max-width: 640px) {
  .btm-form-row {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
   ASSIGNEE DROPDOWN
   ========================================== */

.btm-assignee-dropdown {
  position: relative;
}

.btm-assignee-btn {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
  border-radius: 10px;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: all 0.2s;
  color: var(--text-primary, #1e293b);
  text-align: left;
}

.btm-assignee-btn:hover {
  border-color: var(--border-medium, rgba(0, 0, 0, 0.12));
}

.btm-assignee-btn:focus {
  outline: none;
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btm-assignee-btn svg {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary, #94a3b8);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.btm-assignee-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: 280px;
  background: white;
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  z-index: 100;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.btm-assignee-search {
  padding: 12px;
  border-bottom: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-secondary, #f8fafc);
}

.btm-assignee-search svg {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary, #94a3b8);
  flex-shrink: 0;
}

.btm-assignee-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-primary, #1e293b);
  outline: none;
}

.btm-assignee-search input::placeholder {
  color: var(--text-tertiary, #94a3b8);
}

.btm-assignee-list {
  overflow-y: auto;
  max-height: 220px;
  padding: 8px 0;
}

.btm-assignee-item {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.btm-assignee-item:hover {
  background: var(--bg-hover, #f8fafc);
}

.btm-assignee-item.selected {
  background: rgba(59, 130, 246, 0.08);
}

.btm-assignee-item.selected .btm-assignee-name {
  color: #3B82F6;
}

.btm-assignee-item svg {
  width: 18px;
  height: 18px;
  color: #3B82F6;
  margin-left: auto;
  flex-shrink: 0;
}

.btm-assignee-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}

.btm-assignee-info {
  flex: 1;
  min-width: 0;
}

.btm-assignee-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary, #1e293b);
  margin-bottom: 2px;
}

.btm-assignee-email {
  font-size: 12px;
  color: var(--text-tertiary, #94a3b8);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btm-assignee-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-tertiary, #94a3b8);
  font-size: 14px;
}

/* ==========================================
   CASE COST SELECTOR
   ========================================== */

.btm-case-cost-buttons {
  display: flex;
  gap: 8px;
}

.btm-case-btn {
  flex: 1;
  padding: 12px 8px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
  border-radius: 10px;
  background: white;
  color: var(--text-primary, #1e293b);
  cursor: pointer;
  transition: all 0.2s;
}

.btm-case-btn:hover {
  border-color: #3B82F6;
  background: rgba(59, 130, 246, 0.05);
}

.btm-case-btn.active {
  background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
  color: white;
  border-color: #3B82F6;
}

.btm-case-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btm-case-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.08);
  border-radius: 8px;
  font-size: 13px;
  color: #dc2626;
}

.btm-case-warning svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ==========================================
   MARKETPLACE SELECTION
   ========================================== */

.btm-marketplace-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btm-marketplace-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
  border-radius: 10px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  color: var(--text-primary, #1e293b);
  user-select: none;
}

.btm-marketplace-checkbox:hover {
  border-color: #3B82F6;
  background: rgba(59, 130, 246, 0.05);
}

.btm-marketplace-checkbox:has(input:checked) {
  border-color: #3B82F6;
  background: rgba(59, 130, 246, 0.08);
}

.btm-marketplace-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #3B82F6;
  cursor: pointer;
}

/* Auto-selected single marketplace */
.btm-marketplace-auto-selected {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #059669;
}

.btm-marketplace-auto-selected svg {
  width: 18px;
  height: 18px;
  color: #059669;
}

.btm-auto-selected-hint {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-tertiary, #94a3b8);
  margin-left: 4px;
}

/* ==========================================
   INFO TOOLTIP
   ========================================== */

.btm-info-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  margin-left: 6px;
  background: transparent;
  border: none;
  color: var(--text-tertiary, #94a3b8);
  cursor: help;
  vertical-align: middle;
  border-radius: 50%;
  transition: all 0.2s;
}

.btm-info-tooltip:hover {
  color: #3B82F6;
  background: rgba(59, 130, 246, 0.1);
}

.btm-info-tooltip svg {
  width: 14px;
  height: 14px;
}

/* ==========================================
   DUE DATE QUICK SELECT
   ========================================== */

.btm-form-group-wide {
  flex: 1.5;
}

.btm-due-date-quick {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.btm-quick-date-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
  border-radius: 6px;
  background: white;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
  transition: all 0.2s;
}

.btm-quick-date-btn:hover {
  border-color: #3B82F6;
  color: #3B82F6;
  background: rgba(59, 130, 246, 0.05);
}

.btm-quick-date-btn.active {
  background: #3B82F6;
  border-color: #3B82F6;
  color: white;
}

/* ==========================================
   SUBTASKS SECTION
   ========================================== */

.btm-subtask-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.btm-subtask-header .btm-label {
  margin-bottom: 0;
}

.btm-subtask-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btm-add-subtask-btn,
.btm-add-from-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.1);
  color: #3B82F6;
  cursor: pointer;
  transition: all 0.2s;
}

.btm-add-subtask-btn:hover,
.btm-add-from-menu-btn:hover {
  background: rgba(59, 130, 246, 0.15);
}

.btm-add-subtask-btn svg,
.btm-add-from-menu-btn svg {
  width: 14px;
  height: 14px;
}

.btm-add-from-menu-btn {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.btm-add-from-menu-btn:hover {
  background: rgba(16, 185, 129, 0.15);
}

/* Menu Picker Dropdown */
.btm-menu-picker-wrapper {
  position: relative;
}

.btm-menu-picker {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 320px;
  max-height: 350px;
  background: white;
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  z-index: 200;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.btm-menu-picker-search {
  padding: 12px;
  border-bottom: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-secondary, #f8fafc);
}

.btm-menu-picker-search svg {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary, #94a3b8);
  flex-shrink: 0;
}

.btm-menu-picker-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-primary, #1e293b);
  outline: none;
}

.btm-menu-picker-search input::placeholder {
  color: var(--text-tertiary, #94a3b8);
}

.btm-menu-picker-list {
  overflow-y: auto;
  max-height: 280px;
  padding: 8px 0;
}

.btm-menu-picker-category {
  padding: 0;
}

.btm-menu-picker-category-name {
  padding: 10px 14px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary, #94a3b8);
}

.btm-menu-picker-item {
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.btm-menu-picker-item:hover {
  background: var(--bg-hover, #f8fafc);
}

.btm-menu-picker-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary, #1e293b);
  margin-bottom: 2px;
}

.btm-menu-picker-item-desc {
  font-size: 12px;
  color: var(--text-tertiary, #94a3b8);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btm-menu-picker-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-tertiary, #94a3b8);
  font-size: 14px;
}

.btm-subtask-input-row {
  margin-bottom: 12px;
}

.btm-subtask-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btm-no-subtasks {
  text-align: center;
  color: var(--text-tertiary, #94a3b8);
  font-size: 14px;
  padding: 16px;
  margin: 0;
}

.btm-subtask-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-secondary, #f8fafc);
  border-radius: 10px;
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
}

.btm-subtask-item svg:first-child {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary, #94a3b8);
  flex-shrink: 0;
}

.btm-subtask-item span {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary, #1e293b);
}

/* Template subtask styling */
.btm-subtask-item.btm-subtask-template {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.15);
}

.btm-subtask-item.btm-subtask-template svg:first-child {
  color: #059669;
}

.btm-subtask-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.btm-subtask-title {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary, #1e293b);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btm-subtask-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  flex-shrink: 0;
}

.btm-subtask-remove {
  background: none;
  border: none;
  color: var(--text-tertiary, #94a3b8);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btm-subtask-remove:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.btm-subtask-remove svg {
  width: 16px;
  height: 16px;
}

/* ==========================================
   FOOTER
   ========================================== */

.btm-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
  background: var(--surface-secondary, #f8fafc);
}

.btm-btn-secondary {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
  color: var(--text-primary, #1e293b);
}

.btm-btn-secondary:hover {
  background: var(--surface-secondary, #f8fafc);
  border-color: var(--border-medium, rgba(0, 0, 0, 0.12));
}

.btm-btn-primary {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
  border: none;
  color: white;
}

.btm-btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -2px rgba(59, 130, 246, 0.3);
}

.btm-btn-primary:disabled {
  background: var(--text-tertiary, #94a3b8);
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

.btm-btn-primary svg,
.btm-btn-secondary svg {
  width: 16px;
  height: 16px;
}

/* ==========================================
   LOADING SPINNER
   ========================================== */

.spin {
  animation: btmSpin 1s linear infinite;
}

@keyframes btmSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 640px) {
  .btm-overlay {
    padding: 0;
  }

  .btm-modal {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .btm-case-cost-buttons {
    flex-wrap: wrap;
  }

  .btm-case-btn {
    flex: 0 0 calc(33.333% - 6px);
  }
}
