/* Spinning animation for refresh button icon */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spinning {
  animation: spin 1s linear infinite;
}
.support-send-link {
  background: #16a34a;
  color: #fff !important;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: 0 2px 8px rgba(22,163,74,0.10);
  transition: background 0.18s, transform 0.18s;
  margin-left: auto;
  margin-right: 0;
  border: none;
  outline: none;
  text-decoration: none !important;

}
.support-send-link:hover, .support-send-link:focus {
  background: #059669;
  color: #fff !important;
  transform: translateY(-1px) scale(1.08);
  text-decoration: none;
}
.support-send-link i {
  color: #fff !important;
  font-size: 1.15em;
}
@media (max-width: 768px) {
  .support-send-link {
    width: 36px;
    height: 36px;
    font-size: 1.08rem;
  }
}
/* Desktop: Float send message icon to right in ticket modal */
.support-content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.support-send-link {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* ===== Support Page Styles ===== */
/* Using the same color variables as the main admin panel */

/* ===== Loading Spinner ===== */
#spinner.iqsp-spinner {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 100000;
  /* align/justify defined on active state so the base element stays hidden */
  backdrop-filter: blur(2px);
}

#spinner.iqsp-spinner.active {
  display: flex !important;
  align-items: center;
  justify-content: center;
  animation: fadeInSpinner 0.2s ease-in;
}

#spinner.iqsp-spinner .iqsp-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(30, 30, 30, 0.9), rgba(40, 40, 40, 0.9));
  padding: 2rem 2.5rem;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9), 0 0 30px rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: #e6eef8;
  backdrop-filter: blur(10px);
}

#spinner.iqsp-spinner .iqsp-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--primary, #38bdf8);
  border-right-color: rgba(56, 189, 248, 0.6);
  animation: iqsp-spin 0.8s linear infinite;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.5), 0 0 40px rgba(56, 189, 248, 0.25);
}

#spinner.iqsp-spinner .iqsp-text {
  margin: 0;
  color: #ffffff;
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

@keyframes iqsp-spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeInSpinner {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== Statistics Cards ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card-bg);
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--shadow);
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--shadow);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  background: rgba(133, 214, 255, 0.1);
}

.stat-icon i {
  color: var(--primary);
}

.stat-content h3 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  color: var(--primary);
}

/* Color overrides for stat types */
.stat-card.stat-urgent .stat-icon i,
.stat-card.stat-urgent .stat-content h3 {
  color: #dc2626; /* red */
}

.stat-card.stat-resolved .stat-icon i,
.stat-card.stat-resolved .stat-content h3 {
  color: #10b981; /* green */
}

.stat-card.stat-opened .stat-icon i,
.stat-card.stat-opened .stat-content h3 {
  color: #f59e0b; /* yellow */
}

.stat-content p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== Filters Section ===== */
.filters-section {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--shadow);
  margin-bottom: 2rem;
  transition: background var(--transition), border-color var(--transition);
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  align-items: end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-group label {
  font-weight: 600;
  color: var(--text-color);
  font-size: 0.9rem;
}

.filter-group select,
.filter-group input {
  padding: 0.75rem 1rem;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgb(18, 19, 19);
  color: var(--text-color);
  font-size: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(133, 214, 255, 0.1);
}

/* Visual colored selects */
.filter-group select.select-colored {
  border-width: 1.8px;
}

.filter-group select.select-colored option {
  /* Keep options readable and matching card background */
  color: var(--text-color);
  background: var(--card-bg);
}

/* ===== Data Table ===== */
.data-table-container {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--shadow);
  overflow-x: auto;
  transition: background var(--transition), border-color var(--transition);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table thead {
  background: rgba(255, 255, 255, 0.05);
}

.data-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-color);
  border-bottom: 1px solid var(--shadow);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.data-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-color);
  vertical-align: middle;
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background var(--transition);
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.data-table .empty-state {
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
  padding: 2rem;
}

/* ===== Badges and Status Indicators ===== */
.category-badge,
.priority-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.3px;
}

.category-badge {
  background: rgba(255, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(255, 158, 11, 0.2);
}

.priority-badge.low {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.priority-badge.medium {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.priority-badge.high {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.priority-badge.urgent {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.status-badge.open {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.status-badge.in_progress {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge.resolved {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.closed {
  background: rgba(107, 114, 128, 0.1);
  color: var(--text-secondary);
  border: 1px solid rgba(107, 114, 128, 0.2);
}



/* ===== Ticket Messages ===== */
.ticket-messages {
  max-height: 400px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--shadow);
  border-radius: 8px;
  padding: 1rem;
}

.message {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid;
}

.message:last-child {
  margin-bottom: 0;
}

.message.admin-message {
  background: rgba(133, 214, 255, 0.05);
  border-left-color: var(--primary);
}

.message.user-message {
  background: rgba(255, 255, 255, 0.03);
  border-left-color: var(--accent-green);
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.message-sender {
  font-weight: 600;
  color: var(--text-color);
}

.message-time {
  color: var(--text-secondary);
}

.message-content {
  color: var(--text-color);
  line-height: 1.5;
  white-space: pre-wrap;
}

.no-messages {
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
  padding: 2rem;
}

/* ===== Reply Form ===== */
.reply-form {
  background: rgba(255, 255, 255, 0.02);
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--shadow);
}

.reply-form h4 {
  margin: 0 0 1rem 0;
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 600;
}

.reply-form .form-group textarea {
  min-height: 120px;
  resize: vertical;
}

/* ===== Action Buttons ===== */
.actions-cell {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border-radius: 6px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--primary);
  color: #0c171b;
  border: none;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--accent-green);
  color: #ffffff;
  border: none;
}

.btn-success:hover {
  background: #059669;
  transform: translateY(-1px);
}

/* Escalate button - prominent orange */
.btn-escalate {
  background: linear-gradient(90deg, #ff8a00, #ff5a00);
  color: #ffffff;
  border: none;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  font-weight: 700;
}

.btn-escalate:hover {
  filter: brightness(0.95);
  transform: translateY(-1px);
}

/* Generic button base - used across modals */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.06);
  background: var(--btn-bg, rgba(255,255,255,0.03));
  color: var(--btn-color, var(--text-color));
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
  text-decoration: none;
}

.btn:focus {
  outline: 2px solid rgba(79,70,229,0.12);
  outline-offset: 2px;
}

/* Warning style used for the Open action */
.btn-warning {
  background: linear-gradient(90deg, #f6c13d, #f0b90b);
  color: #000000;
  border: none;
  box-shadow: 0 2px 8px rgba(240, 185, 11, 0.12);
}

.btn-warning:hover {
  transform: translateY(-1px);
  filter: brightness(0.98);
}

/* Specific tuning for the Open Ticket button to ensure proper sizing */
#openTicketBtn.btn.btn-warning {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  min-width: 120px;
  text-align: center;
}

/* ===== Ticket ID Styling ===== */
.ticket-id {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 600;
  color: var(--primary);
  font-size: 0.85rem;
}

.user-uid {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.ticket-subject {
  font-weight: 500;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  .data-table {
    font-size: 0.8rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.75rem 0.5rem;
  }

  .ticket-info-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    gap: 0.75rem;
    align-items: start;
  }

  .actions-cell {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-sm {
    justify-content: center;
  }

  /* Refresh button on mobile */
  #refreshTicketsBtn {
    position: fixed;
    top: 0px;
    right: 5px;
    z-index: 1000;
    padding: 0;
    font-size: 0;
    width: 50px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    background: var(--primary);
    color: #000;
    border: none;
  }

  #refreshTicketsBtn i {
    font-size: 1.3rem;
    margin-right: -10px;
  }
}

@media (max-width: 480px) {
  .stat-card {
    padding: 0.75rem;
    gap: 0.4rem;
  }

  .stat-content h3 {
    font-size: 1.5rem;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }

  .ticket-messages {
    max-height: 300px;
  }
}


/* =========================================================
   SUPPORT TICKET MODAL — FULL RECREATED STYLES
   Uses your existing root variables
========================================================= */

/* Modal Overlay */
.support-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 1rem;
}

/* Show modal when active (matches JS toggling of .active) */
.support-modal.active {
  display: flex;
  opacity: 1;
  visibility: visible;
}

/* Ensure the email modal appears above the ticket support modal when both are open */
#emailModal {
  z-index: 10001;
}

/* Modal Container */
.support-modal-content {
  width: 100%;
  max-width: 800px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: supportModalIn 0.28s ease-out;
}

/* Header */
.support-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.6rem;
  background: linear-gradient(135deg, #1b1e26, #23262f);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.support-modal-header h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-color);
  letter-spacing: 0.3px;
}

.support-modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color var(--transition), transform var(--transition);
}

.support-modal-close:hover {
  color: var(--text-color);
  transform: rotate(90deg);
}

/* Body */
.support-modal-body {
  padding: 1.6rem;
  max-height: 78vh;
  overflow-y: auto;
}

/* Wrapper */
.support-ticket-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2.2rem;
}

/* =========================================================
   DESKTOP VIEW
========================================================= */

/* Info Grid */
.support-ticket-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.4rem 1.8rem;
}

.support-info-block {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.support-info-block label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.support-info-block span {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-color);
  text-transform: capitalize;
}

/* Ticket Content */
.support-ticket-content h4 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
}

.support-ticket-content p {
  margin: 0 0 1.4rem;
  font-size: 0.95rem;
  color: var(--text-color);
  line-height: 1.6;
}

.support-ticket-description {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  font-size: 0.9rem;
  color: var(--text-color);
  line-height: 1.7;
  white-space: pre-wrap;
  text-align: left;
  justify-content: flex-start;
  align-items: flex-start;
}

/* Actions */
.support-ticket-actions {
  margin-top: 0.5rem;
}

.support-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: flex-end;
}

/* =========================================================
   BUTTONS
========================================================= */

.support-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-color);
}

.support-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--shadow);
}

.support-btn i {
  font-size: 0.85rem;
}

/* Variants */
.support-btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent-blue));
  color: #000;
}

.support-btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), var(--accent-blue));
}

.support-btn-warning {
  background: linear-gradient(135deg, var(--warning), var(--accent-yellow));
  color: #000;
}

.support-btn-warning:hover {
  background: linear-gradient(135deg, #d8a400, var(--accent-yellow));
}

.support-btn-escalate {
  background: linear-gradient(135deg, var(--danger), var(--accent-red));
  color: #fff;
}

.support-btn-escalate:hover {
  background: linear-gradient(135deg, #e63636, var(--accent-red));
}

.support-btn-success {
  background: linear-gradient(135deg, var(--accent-green), #1fdf64);
  color: #000;
}

.support-btn-success:hover {
  background: linear-gradient(135deg, #0cbf76, #1fdf64);
}

/* =========================================================
   ANIMATION
========================================================= */

@keyframes supportModalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* =========================================================
   MOBILE VIEW (Flex Layout)
========================================================= */

@media (max-width: 768px) {

  /* Make modal taller on mobile and allow more scrollable content */
  .support-modal {
    padding: 0.6rem;
    align-items: flex-start; /* allow modal to sit near top so it can expand taller */
    justify-content: center;
  }

  .support-modal-content {
    border-radius: 12px;
    width: min(98%, 760px);
    max-width: 760px;
    max-height: 96vh; /* increased modal height */
    margin-top: 3vh;
    overflow: hidden;
  }

  .support-modal-header {
    padding: 1rem 1.1rem;
  }

  .support-modal-body {
    padding: 1.1rem;
    max-height: calc(96vh - 120px); /* body becomes scrollable within the taller modal */
    overflow-y: auto;
  }

  .support-ticket-wrapper {
    gap: 1.6rem;
  }

  /* Grid becomes stacked flex cards */
  .support-ticket-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .support-info-block {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.8rem 0.9rem;
  }

  .support-info-block label {
    font-size: 0.7rem;
  }

  .support-info-block span {
    font-size: 0.85rem;
    font-weight: 600;
    text-align: right;
    text-transform: capitalize;
  }

  .support-ticket-content h4 {
    font-size: 0.9rem;
  }

  .support-ticket-content p,
  .support-ticket-description {
    font-size: 0.85rem;
  }

  /* Support content header holds the subject and the send icon */
  .support-content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }

  .support-ticket-description {
    position: relative;
    padding-bottom: 0.5rem;
  }

  .description-text {
    white-space: pre-wrap;
  }

  /* Prominent send link (icon) placed above the description. 'Firm' appearance: bold, solid color, small size */
  .support-send-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #ff8a00, #ff5a00);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(255, 90, 0, 0.18);
    text-decoration: none;
    font-weight: 800;
    border: 1px solid rgba(0,0,0,0.06);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
  }

  .support-send-link:hover,
  .support-send-link:focus {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(255, 90, 0, 0.22);
    outline: none;
  }

  .support-send-link i {
    font-size: 1rem;
  }

  .support-form-actions {
    flex-direction: row;
    gap: 1rem;
  }

  .support-btn {
    width: 45%;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
  }
}

/* Very small screens: near-fullscreen modal */
@media (max-width: 480px) {
  .support-modal {
    padding: 0.35rem;
    align-items: flex-start;
  }

  .support-modal-content {
    width: 98%;
    max-height: 98vh;
    margin-top: 1vh;
    border-radius: 10px;
    overflow: hidden;
  }

  .support-modal-body {
    max-height: calc(98vh - 110px);
    overflow-y: auto;
  }
}


/* ────────────────────────────────────────────────
   EMAIL MODAL STYLES
   ──────────────────────────────────────────────── */

.zq-modal-portal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1500;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.zq-modal-portal.active {
  opacity: 1;
  visibility: visible;
}

.zq-modal-inner-wrapper {
  background: var(--card-bg);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 100vh;
  overflow-y: auto;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transform: scale(0.92);
  opacity: 0;
  transition: all var(--transition);
}

.zq-modal-portal.active .zq-modal-inner-wrapper {
  transform: scale(1);
  opacity: 1;
}

.zq-modal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.zq-modal-topbar h3 {
  margin: 0;
  font-size: 1.32rem;
  font-weight: 600;
  color: var(--text-color);
}

.zq-modal-dismiss {
  background: none;
  border: none;
  font-size: 2.1rem;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 8px;
  transition: var(--transition);
}

.zq-modal-dismiss:hover,
.zq-modal-dismiss:focus {
  color: var(--text-color);
  transform: rotate(90deg);
}

.zq-modal-main-content {
  padding: 24px;
}

.zq-field-container {
  margin-bottom: 20px;
}

.zq-field-container label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--text-secondary);
}


.zq-input-control,
.zq-select-control,
.zq-textarea-control {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-color);
  font-size: 1rem;
  transition: var(--transition);
}

/* Visually distinct style for From dropdown in email modal */
.zq-select-from {
  background: linear-gradient(90deg, #e0e7ff 0%, #f0fdfa 100%);
  border: 1.5px solid #6366f1;
  color: #22223b;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(99,102,241,0.08);
}
  
.zq-select-from:focus {
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22,163,74,0.12);
}

.zq-input-control:focus,
.zq-select-control:focus,
.zq-textarea-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.18);
}

.zq-input-control::placeholder,
.zq-textarea-control::placeholder {
  color: rgba(176, 176, 176, 0.38);
}

.zq-textarea-control {
  resize: vertical;
  min-height: 118px;
}

.zq-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.zq-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.zq-btn-primary:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.zq-btn-primary:active {
  transform: translateY(0);
}

/* ────────────────────────────────────────────────
   RESPONSIVE ADJUSTMENTS
   ──────────────────────────────────────────────── */

@media (max-width: 640px) {
  .zq-modal-portal {
    padding: 16px;
  }

  .zq-modal-inner-wrapper {
    max-width: 100%;
  }

  .zq-modal-topbar {
    padding: 16px 20px;
  }

  .zq-modal-main-content {
    padding: 20px;
  }

  .zq-modal-topbar h3 {
    font-size: 1.24rem;
  }

  .zq-btn-primary {
    padding: 11px 22px;
    width: 100%;
    justify-content: center;
  }

  .zq-form-actions {
    flex-direction: column;
    gap: 12px;
  }
}

@media (max-width: 420px) {
  .zq-modal-main-content {
    padding: 16px;
  }

  .zq-field-container {
    margin-bottom: 16px;
  }
}