/* Import Fonts from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Playfair+Display:wght@400;700&family=Great+Vibes&family=Lora:wght@400;500&family=Dancing+Script:wght@400;700&family=Roboto:wght@400;500&family=Montserrat:wght@400;700&family=Open+Sans:wght@400;500&display=swap');

/* CSS Variables */
:root {
  --background-color: #f5f5f4; /* Elfenbein */
  --header-color: #0f172a; /* Mitternachtsblau */
  --text-color: #0f172a; /* Mitternachtsblau */
  --shadow-color: rgba(0, 0, 0, 0.15);
  --transition: all 0.3s ease;
}


/* Settings Modal Styling */
.settings-modal-content {
  border-radius: 16px;
  box-shadow: 0 12px 48px var(--shadow-color);
  font-family: 'Poppins', sans-serif;
  transition: transform 0.4s ease, opacity 0.4s ease;
  overflow: hidden;
  position: relative;
  animation: slideIn 0.4s ease;
  background-size: cover;
  background-position: center;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Modal Header */
.header-logo {
  flex: 0 0 auto;
}

.logo-img {
  max-height: 40px;
  filter: brightness(1.2);
  transition: var(--transition);
}

.logo-img:hover {
  transform: scale(1.05);
}

/* Modal Title */
.modal-title {
  font-size: 1rem;
  text-align: center;
  margin: 0;
  text-shadow: 0 1px 4px var(--shadow-color);
  flex: 1;
}

/* Close Button */
.btn-close {
  opacity: 0.7;
  transition: var(--transition);
  right: 1.5rem;
  top: 1.5rem;
}

.btn-close:hover {
  opacity: 1;
  transform: scale(1.15);
}

/* Modal Body */
.modal-body {
  padding: 2rem;
  max-height: 70vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-color) #e5e7eb;
  max-width: -webkit-fill-available;
}

/* Dropdown Navigation */
.settings-dropdown-wrapper {
  position: relative;
}

#settingsDropdown {
  border-radius: 10px;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
  box-shadow: 0 4px 20px var(--shadow-color);
  transition: var(--transition);
  min-height: 50px;
}

#settingsDropdown:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 0.25rem rgba(232, 185, 35, 0.25);
  transform: translateY(-1px);
}

#settingsDropdown option {
  display: flex;
  align-items: center;
}

/* Form Elements */
.form-label {
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.form-control,
.form-select {
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 400;
  background: #fff;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: var(--transition);
  min-height: 50px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 0.25rem rgba(232, 185, 35, 0.25);
  transform: translateY(-1px);
}

.form-range {
  accent-color: var(--accent-color);
  height: 1.2rem;
  padding: 0;
  background: #e5e7eb;
  border-radius: 10px;
}

/* Color Picker */
.color-picker-wrapper {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.form-control-color {
  width: 45px;
  height: 45px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  box-shadow: 0 2px 10px var(--shadow-color);
  transition: var(--transition);
}

.form-control-color:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 14px var(--shadow-color);
}

.form-control-color:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 0.25rem rgba(232, 185, 35, 0.25);
}

.color-hex-input {
  width: 90px;
  font-size: 0.9rem;
  text-transform: uppercase;
}

/* Color Swatches */
.swatch-container {
  gap: 0.75rem;
}

.color-swatch {
  border: 2px solid transparent;
  transition: var(--transition);
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
}

.color-swatch:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px var(--shadow-color);
  border-color: var(--accent-color);
}

.color-swatch.selected-sw {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(232, 185, 35, 0.2);
}

.color-swatch.reset {
  background: transparent;
  border: 2px dashed #6b7280;
  position: relative;
}

.color-swatch.reset::after {
  content: 'Reset';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7rem;
  color: #6b7280;
}

.color-swatch.reset:hover::after {
  color: var(--accent-color);
}

/* Dropzone for Image Upload */
.dropzone {
  border: 2px dashed var(--accent-color);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  background: #fff;
  transition: var(--transition);
  position: relative;
  cursor: pointer;
}

.dropzone.dragover {
  border-color: var(--header-color);
  background: #f1f5f9;
}

.dropzone-text {
  font-size: 0.9rem;
  color: #6b7280;
  pointer-events: none;
}

/* Font Preview */
.font-preview {
  background: #f1f5f9;
  border-radius: 10px;
  transition: var(--transition);
  font-size: 1.2rem;
  padding: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

#titleFontPreview {
  font-size: 1.5rem;
  font-weight: 700;
}

#descriptionFontPreview {
  font-size: 1rem;
  line-height: 1.5;
}

/* Preview Mode */
.settings-modal-content.preview-mode {
  background: transparent !important;
  box-shadow: none !important;
  pointer-events: none;
}

/* Modal Backdrop in Preview Mode */
.modal-backdrop.preview-hidden {
  display: none !important;
}

/* Preview Button Container */
.preview-button-container {
  position: fixed;
  top: 15px;
  right: 15px;
  transition: var(--transition);
  z-index: 2000
}

.preview-button-container.d-none {
  display: none !important;
}

.preview-button {
  border-radius: 10px;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--header-color);
  border: none;
  color: #fff;
  min-height: 50px;
  box-shadow: 0 4px 20px var(--shadow-color);
  transition: var(--transition);
  opacity: 0.9;
}

.preview-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--shadow-color);
  background: #1e3a8a;
}

.preview-button.preview-active {
  background: #dc2626;
}

.preview-button.preview-active:hover {
  background: #b91c1c;
}

/* Modal Footer */
.modal-footer {
  border-top: none;
  padding: 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--background-color);
  border-radius: 0 0 16px 16px;
}

.btn {
  border-radius: 10px;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  transition: var(--transition);
  min-height: 50px;
  box-shadow: 0 4px 20px var(--shadow-color);
}

.btn-primary {
  background: var(--header-color);
  border: none;
  color: #fff;
}

.btn-primary:hover {
  background: #1e3a8a;
  transform: translateY(-1px);
}

.btn-success {
  background: var(--accent-color);
  border: none;
  color: #fff;
  position: relative;
}

.btn-success:hover {
  background: #d4a373;
  transform: translateY(-1px);
}

.btn-success .spinner-border {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.btn-success:active {
  animation: pulse 0.3s ease;
}

.btn-secondary {
  background: #6b7280;
  border: none;
  color: #fff;
}

.btn-secondary:hover {
  background: #4b5563;
  transform: translateY(-1px);
}

/* Spinner Animation */
.spinner-border {
  border-width: 0.2em;
  animation: spin 0.8s linear infinite;
}

/* Pulse Animation for Save Button */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Tab Content Animation */
.tab-pane {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.tab-pane.show {
  opacity: 1;
  transform: translateY(0);
  animation: zoomIn 0.3s ease;
}

.tab-pane {
  opacity: 0;
  transform: translateY(15px);
}

@keyframes zoomIn {
  from { transform: scale(0.98); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .modal-dialog {
    max-width: 95%;
    margin: 0.75rem auto;
  }

  .modal-content {
    border-radius: 12px;
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-title {
    font-size: 1.25rem;
  }

  .logo-img {
    max-height: 32px;
  }

  .modal-body {
    padding: 1.5rem;
    max-height: 75vh;
  }

  #settingsDropdown,
  .form-control,
  .form-select {
    font-size: 0.9rem;
    min-height: 45px;
    padding: 0.65rem 1.15rem;
  }



  .preview-button {
    padding: 0.65rem 1.3rem;
    font-size: 0.9rem;
  }

  .btn {
    padding: 0.65rem 1.3rem;
    font-size: 0.9rem;
    min-height: 45px;
  }

  .color-swatch {
    width: 36px;
    height: 36px;
  }

  .form-control-color {
    width: 40px;
    height: 40px;
  }

  .color-hex-input {
    width: 85px;
  }

  #titleFontPreview {
    font-size: 1.2rem;
  }

  #descriptionFontPreview {
    font-size: 0.9rem;
  }
}

@media (max-width: 576px) {
  .modal-dialog {
    height: 100%;
  }

  .modal-content {
    border-radius: 0;
    min-height: 100vh;
  }

  .modal-body {
    padding: 1.25rem;
    max-height: 80vh;
  }

  .form-label {
    font-size: 0.9rem;
  }

  .color-swatch {
    width: 32px;
    height: 32px;
  }

  .form-control-color {
    width: 35px;
    height: 35px;
  }

  .color-hex-input {
    width: 80px;
  }
}