/* ============================================================
   Premium Module Design System – "Dopamine" Edition
   ============================================================ */

/* === Font === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* === Variables === */
.modal-modul {
  --accent: #2F5496;
  --accent-light: #4a7bc4;
  --accent-glow: rgba(47, 84, 150, 0.2);
  --green: #27ae60;
  --orange: #f39c12;
  --purple: #8e44ad;
  --red: #e74c3c;
  --teal: #1abc9c;
  --pink: #e84393;
  --bg-card: rgba(255,255,255,0.82);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --shadow-hover: 0 4px 12px rgba(47,84,150,.12), 0 8px 32px rgba(0,0,0,.06);
  --transition: 0.35s cubic-bezier(.25,.46,.45,.94);
  --transition-fast: 0.2s ease;
}

/* === Base === */
.modal-modul {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: .85rem;
  color: #1a1a2e;
}

/* === Card Entrance Animation === */
.modal-modul .gl-card {
  animation: modFadeUp 0.5s ease both;
}
.modal-modul .column:nth-child(1) .gl-card { animation-delay: 0.05s; }
.modal-modul .column:nth-child(2) .gl-card { animation-delay: 0.10s; }
.modal-modul .column:nth-child(3) .gl-card { animation-delay: 0.15s; }
.modal-modul .column:nth-child(4) .gl-card { animation-delay: 0.20s; }
@keyframes modFadeUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* === Cards === */
.modal-modul .gl-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0,0,0,.06);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem;
  height: 100%;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.modal-modul .gl-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light), var(--teal));
  opacity: 0;
  transition: opacity var(--transition);
}
.modal-modul .gl-card:hover::before {
  opacity: 1;
}
.modal-modul .gl-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
  border-color: rgba(47, 84, 150, .15);
}

/* === Card Header === */
.modal-modul .gl-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: .85rem;
}
.modal-modul .gl-card-header .icon {
  width: 34px; height: 34px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}
.modal-modul .gl-card:hover .gl-card-header .icon {
  transform: scale(1.1) rotate(-5deg);
}
.modal-modul .gl-card-header h4 {
  font-size: .9rem;
  font-weight: 700;
  margin: 0;
  color: #1a1a2e;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #1a1a2e, #2F5496);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === Input Fields === */
.modal-modul .gl-label {
  font-size: .7rem;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 3px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: color var(--transition-fast);
}
.modal-modul .gl-field:focus-within .gl-label {
  color: var(--accent);
}
.modal-modul .gl-input,
.modal-modul .gl-select,
.modal-modul textarea.gl-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  border: 1.5px solid rgba(0,0,0,.06);
  font-size: .82rem;
  font-family: inherit;
  transition: all var(--transition-fast);
  background: #fff;
  color: #1a1a2e;
}
.modal-modul .gl-input:focus,
.modal-modul .gl-select:focus,
.modal-modul textarea.gl-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow), 0 0 20px rgba(47,84,150,.06);
  background: #fff;
}
.modal-modul .gl-input-sm { max-width: 110px; }
.modal-modul .gl-input-md { max-width: 160px; }
.modal-modul textarea.gl-input {
  resize: vertical;
  min-height: 60px;
  line-height: 1.4;
}

/* === Custom Toggle Switch (replaces checkboxes) === */
.modal-modul .gl-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  cursor: pointer;
  padding: 4px 10px 4px 4px;
  border-radius: 20px;
  transition: all var(--transition-fast);
  user-select: none;
  position: relative;
}
.modal-modul .gl-toggle:hover {
  background: rgba(47,84,150,.06);
}
.modal-modul .gl-toggle input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
  pointer-events: none;
}
.modal-modul .gl-toggle .toggle-track {
  width: 32px; height: 18px;
  background: #d1d5db;
  border-radius: 10px;
  position: relative;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.modal-modul .gl-toggle .toggle-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: all var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.modal-modul .gl-toggle input:checked + .toggle-track {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  box-shadow: 0 0 8px var(--accent-glow);
}
.modal-modul .gl-toggle input:checked + .toggle-track::after {
  left: 16px;
  transform: scale(1.05);
}
.modal-modul .gl-toggle .toggle-label {
  color: #374151;
  transition: color var(--transition-fast);
}
.modal-modul .gl-toggle input:checked ~ .toggle-label {
  color: var(--accent);
  font-weight: 600;
}

/* === Green toggle variant === */
.modal-modul .gl-toggle-green input:checked + .toggle-track {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  box-shadow: 0 0 8px rgba(39,174,96,.25);
}

/* === Orange toggle variant === */
.modal-modul .gl-toggle-orange input:checked + .toggle-track {
  background: linear-gradient(135deg, #f39c12, #f1c40f);
  box-shadow: 0 0 8px rgba(243,156,18,.25);
}

/* === Purple toggle variant === */
.modal-modul .gl-toggle-purple input:checked + .toggle-track {
  background: linear-gradient(135deg, #8e44ad, #9b59b6);
  box-shadow: 0 0 8px rgba(142,68,173,.25);
}

/* === Red toggle variant === */
.modal-modul .gl-toggle-red input:checked + .toggle-track {
  background: linear-gradient(135deg, #e74c3c, #e74c3c);
  box-shadow: 0 0 8px rgba(231,76,60,.25);
}

/* === Subcards (grouped sections within cards) === */
.modal-modul .gl-subcard {
  background: rgba(255,255,255,.55);
  border-radius: var(--radius-sm);
  padding: .7rem;
  border: 1px solid rgba(0,0,0,.04);
  margin-bottom: .6rem;
  transition: all var(--transition-fast);
}
.modal-modul .gl-subcard:hover {
  background: rgba(255,255,255,.75);
  border-color: rgba(0,0,0,.06);
}
.modal-modul .gl-subcard-title {
  font-weight: 700;
  font-size: .76rem;
  margin-bottom: 6px;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 6px;
}
.modal-modul .gl-subcard-title::before {
  content: '';
  width: 3px; height: 14px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}
.modal-modul .gl-subcard-hint {
  font-size: .66rem;
  color: #9ca3af;
  margin-bottom: 6px;
}

/* === Grids === */
.modal-modul .gl-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-modul .gl-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.modal-modul .gl-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px; }
.modal-modul .gl-grid-auto { display: flex; flex-wrap: wrap; gap: 6px; }

/* === Dividers === */
.modal-modul hr {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,.06), transparent);
  border: none;
  margin: .6rem 0;
}

/* === Buttons === */
.modal-modul .gl-btn {
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}
.modal-modul .gl-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.15), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.modal-modul .gl-btn:active::after {
  opacity: 1;
}
.modal-modul .gl-btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.modal-modul .gl-btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px var(--accent-glow);
}
.modal-modul .gl-btn-primary:active {
  transform: translateY(0) scale(0.98);
}
.modal-modul .gl-btn-secondary {
  background: #f0f2f8;
  color: #4b5563;
  border: 1px solid rgba(0,0,0,.06);
}
.modal-modul .gl-btn-secondary:hover {
  background: #e5e7ef;
  transform: translateY(-1px);
}
.modal-modul .gl-btn-secondary:active {
  transform: translateY(0);
}
.modal-modul .gl-btn-success {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  color: #fff;
  box-shadow: 0 4px 14px rgba(39,174,96,.25);
}
.modal-modul .gl-btn-success:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px rgba(39,174,96,.25);
}
.modal-modul .gl-btn-danger {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #fff;
  box-shadow: 0 4px 14px rgba(231,76,60,.2);
}
.modal-modul .gl-btn-danger:hover {
  transform: translateY(-2px);
}

/* === Button Group === */
.modal-modul .gl-btn-group {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* === Hide spinners on ALL number inputs === */
.modal-modul input[type=number]::-webkit-inner-spin-button,
.modal-modul input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}
.modal-modul input[type=number] {
  -moz-appearance: textfield !important;
}

/* === Number Input with Stepper === */
.modal-modul .gl-number {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid rgba(0,0,0,.06);
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: #fff;
  transition: border-color var(--transition-fast);
}
.modal-modul .gl-number:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}
.modal-modul .gl-number input {
  width: 50px;
  padding: 6px 4px;
  border: none;
  text-align: center;
  font-size: .82rem;
  font-family: inherit;
  outline: none;
  -moz-appearance: textfield;
}
.modal-modul .gl-number input::-webkit-inner-spin-button,
.modal-modul .gl-number input::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
.modal-modul .gl-number button {
  width: 28px;
  border: none;
  background: #f8f9fa;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 700;
  color: #4b5563;
  padding: 4px 0;
  transition: all var(--transition-fast);
  line-height: 1;
}
.modal-modul .gl-number button:hover {
  background: var(--accent);
  color: #fff;
}
.modal-modul .gl-number button:active {
  transform: scale(0.9);
}

/* === Field wrapper for layout === */
.modal-modul .gl-field {
  margin-bottom: 2px;
}

/* === Scrollbar styling === */
.modal-modul ::-webkit-scrollbar {
  width: 5px; height: 5px;
}
.modal-modul ::-webkit-scrollbar-track {
  background: transparent;
}
.modal-modul ::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.12);
  border-radius: 3px;
}
.modal-modul ::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,.2);
}

/* === Focus ring for accessibility === */
.modal-modul *:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* === Responsive === */
@media screen and (max-width: 768px) {
  .modal-modul .gl-grid-2,
  .modal-modul .gl-grid-3,
  .modal-modul .gl-grid-4 {
    grid-template-columns: 1fr;
  }
  .modal-modul .gl-card {
    padding: .85rem;
  }
}

/* === Select styling === */
.modal-modul .gl-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 12 12'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%236b7280' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

/* === Glow pulse for submit button === */
.modal-modul .gl-btn-primary.gl-btn-pulse {
  animation: btnPulse 2s infinite;
}
@keyframes btnPulse {
  0%, 100% { box-shadow: 0 4px 14px var(--accent-glow); }
  50% { box-shadow: 0 4px 24px var(--accent-glow), 0 0 40px rgba(47,84,150,.1); }
}

/* === Checkbox grid dense layout === */
.modal-modul .gl-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 4px;
}

/* === Compact toggle for dense areas === */
.modal-modul .gl-toggle-compact {
  padding: 2px 6px 2px 2px;
  font-size: .74rem;
}
.modal-modul .gl-toggle-compact .toggle-track {
  width: 26px; height: 15px;
}
.modal-modul .gl-toggle-compact .toggle-track::after {
  width: 11px; height: 11px;
  top: 2px; left: 2px;
}
.modal-modul .gl-toggle-compact input:checked + .toggle-track::after {
  left: 13px;
}
