/**
 * TacticalHQ — Global CSS
 * Shared form styles used across all pages.
 * Import via nuxt.config.ts → css: ['~/assets/css/main.css']
 */

/* ─── Form Fields ─────────────────────────────────────────────────────────── */

.thq-input,
.thq-select,
.thq-textarea {
  width: 100% !important;
  padding: 10px 14px !important;
  border: 1px solid #94a3b8 !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  color: #1e293b !important;
  background: #f8fafc !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06) !important;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.thq-input:focus,
.thq-select:focus,
.thq-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.thq-input:disabled,
.thq-select:disabled,
.thq-textarea:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

.thq-input::placeholder,
.thq-textarea::placeholder {
  color: #94a3b8;
}

.thq-textarea {
  resize: vertical;
  font-family: inherit;
  min-height: 80px;
  line-height: 1.5;
}

.thq-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Small variant */
.thq-input-sm,
.thq-select-sm,
.thq-textarea-sm {
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 6px;
}

/* ─── Form Layout ─────────────────────────────────────────────────────────── */

.thq-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.thq-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.thq-hint {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

.thq-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* ─── Cards / Sections ────────────────────────────────────────────────────── */

.thq-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.thq-card-title {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 16px;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */

.thq-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
}

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

.thq-btn-primary {
  background: #3b82f6;
  color: #ffffff;
}
.thq-btn-primary:hover:not(:disabled) { background: #2563eb; }

.thq-btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}
.thq-btn-secondary:hover:not(:disabled) { background: #e2e8f0; }

.thq-btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}
.thq-btn-danger:hover:not(:disabled) { background: #fee2e2; }

.thq-btn-success {
  background: #16a34a;
  color: #ffffff;
}
.thq-btn-success:hover:not(:disabled) { background: #15803d; }

.thq-btn-sm { padding: 6px 12px; font-size: 12px; }
.thq-btn-lg { padding: 14px 24px; font-size: 16px; }
.thq-btn-block { width: 100%; }
.thq-btn-ghost {
  background: transparent;
  color: #64748b;
  border: none;
}
.thq-btn-ghost:hover:not(:disabled) { background: #f1f5f9; }

/* ─── Toggle (checkbox + label) ───────────────────────────────────────────── */

.thq-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  color: #334155;
}

.thq-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
}

/* ─── Alerts / Warnings ──────────────────────────────────────────────────── */

.thq-alert-warning {
  font-size: 13px;
  color: #92400e;
  background: #fef3c7;
  padding: 8px 12px;
  border-radius: 8px;
}

.thq-alert-error {
  font-size: 13px;
  color: #dc2626;
  background: #fee2e2;
  padding: 8px 12px;
  border-radius: 8px;
}

.thq-alert-info {
  font-size: 13px;
  color: #1e40af;
  background: #dbeafe;
  padding: 8px 12px;
  border-radius: 8px;
}

.thq-alert-success {
  font-size: 13px;
  color: #166534;
  background: #dcfce7;
  padding: 8px 12px;
  border-radius: 8px;
}

/* ─── Badges ─────────────────────────────────────────────────────────────── */

.thq-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 9999px;
}

.thq-badge-success { background: #dcfce7; color: #166534; }
.thq-badge-warning { background: #fef3c7; color: #92400e; }
.thq-badge-danger  { background: #fee2e2; color: #991b1b; }
.thq-badge-info    { background: #dbeafe; color: #1e40af; }
.thq-badge-neutral { background: #f1f5f9; color: #475569; }
.thq-badge-purple  { background: #f3e8ff; color: #6b21a8; }

/* ─── Tables ─────────────────────────────────────────────────────────────── */

.thq-table {
  width: 100%;
  font-size: 14px;
  border-collapse: collapse;
}

.thq-table thead {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.thq-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  background: #f8fafc;
  z-index: 1;
}

.thq-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

.thq-table tbody tr:hover {
  background: #f8fafc;
}

/* ─── Modals ─────────────────────────────────────────────────────────────── */

.thq-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thq-modal {
  background: #ffffff;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.thq-modal-sm { max-width: 400px; }
.thq-modal-lg { max-width: 800px; }
.thq-modal-xl { max-width: 1100px; }

.thq-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.thq-modal-header h2,
.thq-modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.thq-modal-body {
  margin-bottom: 20px;
}

.thq-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

/* ─── Card Variants ──────────────────────────────────────────────────────── */

.thq-card-muted {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
}

/* ─── Stat Cards ────────────────────────────────────────────────────── */

.thq-stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px 20px;
}

.thq-stat-card .thq-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
}

.thq-stat-card .thq-stat-label {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── Collapsible Sections ─────────────────────────────────────────────────── */

.collapsible-title {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: color 0.15s;
}

.collapsible-title:hover {
  color: #3b82f6;
}

.collapse-chevron {
  transition: transform 0.2s ease;
  flex-shrink: 0;
  color: #94a3b8;
}

.collapse-chevron.open {
  transform: rotate(90deg);
}

/* ─── Global Overrides ────────────────────────────────────────────────────── */
/* Enhance contrast for all form inputs across pages using Tailwind or scoped CSS.
   These rules use higher specificity to override both inline Tailwind and scoped styles. */

/* Override Tailwind border-gray-300 inputs/selects/textareas to have better contrast */
input.border-gray-300,
select.border-gray-300,
textarea.border-gray-300,
input.border.rounded-lg,
select.border.rounded-lg,
textarea.border.rounded-lg {
  border-color: #94a3b8 !important;
  background: #f8fafc !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
  color: #1e293b;
}

input.border-gray-300:focus,
select.border-gray-300:focus,
textarea.border-gray-300:focus,
input.border.rounded-lg:focus,
select.border.rounded-lg:focus,
textarea.border.rounded-lg:focus {
  border-color: #3b82f6 !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15) !important;
  outline: none;
}

/* Give white cards/sections a subtle shadow so they pop off the #f1f5f9 page background */
.bg-white.rounded-xl,
.bg-white.rounded-lg {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Override scoped .form-input used in Flow Studio, MCP, Invoicing, CRM, etc. */
.form-input,
.form-select {
  background: #f8fafc !important;
  border-color: #94a3b8 !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
  color: #1e293b;
}

.form-input:focus,
.form-select:focus {
  border-color: #3b82f6 !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15) !important;
  outline: none;
}

/* ─── Button Variants (additional) ────────────────────────────────────────── */

.thq-btn-warning {
  background: #f59e0b;
  color: #1e293b;
}
.thq-btn-warning:hover:not(:disabled) { background: #d97706; }

/* ─── Dark Theme ─────────────────────────────────────────────────────────── */
/* Wrap a page in .thq-dark to get dark-themed thq-* components.
   The page itself sets its own background (e.g. #0f172a or #1e293b).        */

.thq-dark .thq-card {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.thq-dark .thq-card-title {
  color: #f1f5f9;
}

/* Inputs / Selects / Textareas */
.thq-dark .thq-input,
.thq-dark .thq-select,
.thq-dark .thq-textarea {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  box-shadow: none;
}

.thq-dark .thq-input:focus,
.thq-dark .thq-select:focus,
.thq-dark .thq-textarea:focus {
  border-color: #3b82f6;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.thq-dark .thq-input::placeholder,
.thq-dark .thq-textarea::placeholder {
  color: #64748b;
}

.thq-dark .thq-input:disabled,
.thq-dark .thq-select:disabled,
.thq-dark .thq-textarea:disabled {
  background: rgba(255, 255, 255, 0.03);
  color: #64748b;
}

/* Labels / Hints */
.thq-dark .thq-label {
  color: #94a3b8;
}

.thq-dark .thq-hint {
  color: #64748b;
}

/* Buttons — dark-specific overrides */
.thq-dark .thq-btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.1);
}
.thq-dark .thq-btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
}

.thq-dark .thq-btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}
.thq-dark .thq-btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.3);
}

.thq-dark .thq-btn-ghost {
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.thq-dark .thq-btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
}

/* Tables */
.thq-dark .thq-table thead {
  background: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.thq-dark .thq-table th {
  color: #94a3b8;
}

.thq-dark .thq-table td {
  color: #e2e8f0;
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

.thq-dark .thq-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Badges */
.thq-dark .thq-badge-success { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.thq-dark .thq-badge-warning { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.thq-dark .thq-badge-danger  { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.thq-dark .thq-badge-info    { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.thq-dark .thq-badge-neutral { background: rgba(255, 255, 255, 0.08); color: #94a3b8; }
.thq-dark .thq-badge-purple  { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; }

/* Alerts */
.thq-dark .thq-alert-error {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.thq-dark .thq-alert-success {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.thq-dark .thq-alert-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.thq-dark .thq-alert-info {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Modals */
.thq-dark .thq-modal {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.thq-dark .thq-modal-header h2,
.thq-dark .thq-modal-header h3 {
  color: #f1f5f9;
}

.thq-dark .thq-modal-footer {
  border-top-color: rgba(255, 255, 255, 0.08);
}

/* Stat cards */
.thq-dark .thq-stat-card {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.08);
}

.thq-dark .thq-stat-card .thq-stat-value {
  color: #f1f5f9;
}

.thq-dark .thq-stat-card .thq-stat-label {
  color: #94a3b8;
}
