/**
 * Admin Custom Modals Styles
 * The Journeyman - Custom confirm/alert/prompt dialogs
 * Version: 1.0
 * 
 * Replaces browser-native dialogs with styled modals that match admin theme.
 */

/* ========================================
   MODAL OVERLAY
   ======================================== */
.tjm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  padding: 20px;
}

.tjm-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* ========================================
   MODAL CONTAINER
   ======================================== */
.tjm-modal {
  width: 100%;
  max-width: 420px;
  background: var(--admin-panel, #0e1014);
  border: 1px solid var(--admin-line, rgba(255, 255, 255, 0.1));
  border-radius: 16px;
  box-shadow: 
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(255, 107, 43, 0.1);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.2s ease;
  overflow: hidden;
}

.tjm-modal-overlay.open .tjm-modal {
  transform: scale(1) translateY(0);
}

/* ========================================
   MODAL HEADER
   ======================================== */
.tjm-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  background: var(--admin-card, #141414);
  border-bottom: 1px solid var(--admin-line, rgba(255, 255, 255, 0.1));
}

.tjm-modal-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 20px;
  flex-shrink: 0;
  background: rgba(255, 107, 43, 0.15);
  color: var(--admin-accent, #ff6b2b);
}

.tjm-modal-title {
  font-family: 'Cinzel', serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--admin-text, #ffffff);
  margin: 0;
  letter-spacing: 0.5px;
}

/* ========================================
   MODAL BODY
   ======================================== */
.tjm-modal-body {
  padding: 24px;
}

.tjm-modal-message {
  font-size: 14px;
  line-height: 1.6;
  color: var(--admin-text-secondary, #e8e8e8);
  margin: 0;
  white-space: pre-wrap;
}

/* Input for prompt mode */
.tjm-modal-input-wrap {
  margin-top: 16px;
}

.tjm-modal-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  background: var(--admin-input, #0d0f13);
  border: 1px solid var(--admin-line, rgba(255, 255, 255, 0.1));
  border-radius: 8px;
  color: var(--admin-text, #ffffff);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.tjm-modal-input:focus {
  border-color: var(--admin-accent, #ff6b2b);
  box-shadow: 0 0 0 3px rgba(255, 107, 43, 0.15);
}

.tjm-modal-input::placeholder {
  color: var(--admin-text-muted, #a0a0a0);
}

/* ========================================
   MODAL FOOTER
   ======================================== */
.tjm-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  background: var(--admin-card, #141414);
  border-top: 1px solid var(--admin-line, rgba(255, 255, 255, 0.1));
}

/* ========================================
   MODAL BUTTONS
   ======================================== */
.tjm-modal-btn {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 100px;
}

.tjm-modal-btn:focus {
  outline: none;
}

/* Secondary (Cancel) */
.tjm-modal-btn--secondary {
  background: transparent;
  border: 1px solid var(--admin-line-strong, rgba(255, 255, 255, 0.15));
  color: var(--admin-text-secondary, #e8e8e8);
}

.tjm-modal-btn--secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.25);
}

/* Primary (Confirm) */
.tjm-modal-btn--primary {
  background: var(--admin-accent, #ff6b2b);
  color: white;
  box-shadow: 0 2px 8px rgba(255, 107, 43, 0.3);
}

.tjm-modal-btn--primary:hover {
  background: #ff7f47;
  box-shadow: 0 4px 12px rgba(255, 107, 43, 0.4);
  transform: translateY(-1px);
}

/* Danger (Delete) */
.tjm-modal-btn--danger {
  background: var(--admin-danger, #ef4444);
  color: white;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.tjm-modal-btn--danger:hover {
  background: #f87171;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

/* Success */
.tjm-modal-btn--success {
  background: var(--admin-success, #22c55e);
  color: white;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.tjm-modal-btn--success:hover {
  background: #4ade80;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
  transform: translateY(-1px);
}

/* Warning */
.tjm-modal-btn--warning {
  background: var(--admin-warning, #f59e0b);
  color: white;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.tjm-modal-btn--warning:hover {
  background: #fbbf24;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
  transform: translateY(-1px);
}

/* ========================================
   MODAL TYPE VARIANTS
   ======================================== */

/* Danger Modal */
.tjm-modal--danger .tjm-modal-icon {
  background: rgba(239, 68, 68, 0.15);
  color: var(--admin-danger, #ef4444);
}

.tjm-modal--danger .tjm-modal-header {
  border-bottom-color: rgba(239, 68, 68, 0.2);
}

/* Success Modal */
.tjm-modal--success .tjm-modal-icon {
  background: rgba(34, 197, 94, 0.15);
  color: var(--admin-success, #22c55e);
}

.tjm-modal--success .tjm-modal-header {
  border-bottom-color: rgba(34, 197, 94, 0.2);
}

/* Warning Modal */
.tjm-modal--warning .tjm-modal-icon {
  background: rgba(245, 158, 11, 0.15);
  color: var(--admin-warning, #f59e0b);
}

.tjm-modal--warning .tjm-modal-header {
  border-bottom-color: rgba(245, 158, 11, 0.2);
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.tjm-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.tjm-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--admin-panel, #0e1014);
  border: 1px solid var(--admin-line, rgba(255, 255, 255, 0.1));
  border-radius: 10px;
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  max-width: 360px;
}

.tjm-toast--visible {
  opacity: 1;
  transform: translateX(0);
}

.tjm-toast--hiding {
  opacity: 0;
  transform: translateX(100%);
}

.tjm-toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.tjm-toast-message {
  flex: 1;
  font-size: 13px;
  color: var(--admin-text-secondary, #e8e8e8);
  line-height: 1.4;
}

.tjm-toast-close {
  background: none;
  border: none;
  color: var(--admin-text-muted, #a0a0a0);
  cursor: pointer;
  padding: 4px;
  font-size: 12px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.tjm-toast-close:hover {
  opacity: 1;
}

/* Toast Types */
.tjm-toast--info {
  border-left: 3px solid var(--admin-info, #3b82f6);
}

.tjm-toast--info .tjm-toast-icon {
  color: var(--admin-info, #3b82f6);
}

.tjm-toast--success {
  border-left: 3px solid var(--admin-success, #22c55e);
}

.tjm-toast--success .tjm-toast-icon {
  color: var(--admin-success, #22c55e);
}

.tjm-toast--warning {
  border-left: 3px solid var(--admin-warning, #f59e0b);
}

.tjm-toast--warning .tjm-toast-icon {
  color: var(--admin-warning, #f59e0b);
}

.tjm-toast--danger {
  border-left: 3px solid var(--admin-danger, #ef4444);
}

.tjm-toast--danger .tjm-toast-icon {
  color: var(--admin-danger, #ef4444);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 480px) {
  .tjm-modal-overlay {
    padding: 16px;
  }
  
  .tjm-modal {
    max-width: 100%;
    border-radius: 12px;
  }
  
  .tjm-modal-header {
    padding: 16px 20px;
  }
  
  .tjm-modal-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  
  .tjm-modal-title {
    font-size: 15px;
  }
  
  .tjm-modal-body {
    padding: 20px;
  }
  
  .tjm-modal-footer {
    padding: 14px 20px;
    flex-direction: column-reverse;
  }
  
  .tjm-modal-btn {
    width: 100%;
  }
  
  .tjm-toast-container {
    top: auto;
    bottom: 20px;
    left: 16px;
    right: 16px;
  }
  
  .tjm-toast {
    max-width: 100%;
  }
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes tjm-modal-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.tjm-modal--shake {
  animation: tjm-modal-shake 0.3s ease;
}
