:root {
  --primary-color: #2ecc71;
  --secondary-color: #27ae60;
  --animation-timing: 0.3s ease;
}

:root[data-bs-theme="dark"] {
  --bg-color: #1a1a1a;
  --card-bg: #2d2d2d;
  --text-color: #ffffff;
  --border-color: #404040;
  --input-bg: #2d2d2d;
  --input-border: #404040;
  --input-text: #ffffff;
  --input-placeholder: rgba(255, 255, 255, 0.5);
  --card-shadow: 0 4px 16px 0 rgba(46, 204, 113, 0.1),
    0 1.5px 8px 0 rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(46, 204, 113, 0.08);
  --card-hover-shadow: 0 8px 32px 0 rgba(46, 204, 113, 0.18),
    0 3px 16px 0 rgba(0, 0, 0, 0.13), 0 0 0 3px rgba(46, 204, 113, 0.12);
  --prism-bg: #2d2d2d;
  --prism-text: #ffffff;
  --prism-comment: #6a9955;
  --prism-string: #ce9178;
  --prism-keyword: #569cd6;
  --prism-function: #dcdcaa;
  --prism-number: #b5cea8;
  --prism-operator: #d4d4d4;
  --prism-punctuation: #d4d4d4;
}

:root[data-bs-theme="light"] {
  --bg-color: #f8f9fa;
  --card-bg: #ffffff;
  --text-color: #212529;
  --border-color: #dee2e6;
  --input-bg: #ffffff;
  --input-border: #ced4da;
  --input-text: #212529;
  --input-placeholder: rgba(0, 0, 0, 0.5);
  --card-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.1),
    0 1.5px 8px 0 rgba(0, 0, 0, 0.05), 0 0 0 2px rgba(0, 0, 0, 0.05);
  --card-hover-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1),
    0 3px 16px 0 rgba(0, 0, 0, 0.08), 0 0 0 3px rgba(0, 0, 0, 0.08);
  --prism-bg: #f5f5f5;
  --prism-text: #333333;
  --prism-comment: #008000;
  --prism-string: #a31515;
  --prism-keyword: #0000ff;
  --prism-function: #795e26;
  --prism-number: #098658;
  --prism-operator: #000000;
  --prism-punctuation: #000000;
}

body {
  background: var(--bg-color);
  color: var(--text-color);
  transition: background-color var(--animation-timing),
    color var(--animation-timing);
}

.preview-frame {
  width: 100%;
  height: 500px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all var(--animation-timing);
  z-index: 1;
  position: relative;
  isolation: isolate;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.preview-frame::-webkit-scrollbar {
  display: none !important;
}

.preview-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.btn-preview {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-preview:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  color: white;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary-color);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.option-label {
  margin-left: 10px;
  vertical-align: middle;
}

.card {
  border: none;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.3s, transform 0.2s;
  background: var(--card-bg);
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--card-hover-shadow);
}

.card-header {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  border-radius: 12px 12px 0 0 !important;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  transition: transform 0.2s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

h1 {
  color: var(--primary-color);
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  display: inline-block;
  position: relative;
}

h1:hover {
  transform: scale(1.05);
  text-shadow: 0 0 10px rgba(46, 204, 113, 0.5),
    0 0 20px rgba(46, 204, 113, 0.3), 0 0 30px rgba(46, 204, 113, 0.2);
}

h1::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--primary-color),
    transparent
  );
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

h1:hover::after {
  transform: scaleX(1);
}

.magic-wand {
  animation: sparkle 2s infinite;
  display: inline-block;
  transition: all 0.3s ease;
}

h1:hover .magic-wand {
  animation: sparkle 1.2s infinite;
}

@keyframes sparkle {
  0% {
    transform: rotate(-15deg);
  }
  50% {
    transform: rotate(15deg);
  }
  100% {
    transform: rotate(-15deg);
  }
}

/* Add styles for the iframe content */
.preview-frame-content {
  width: 100%;
  min-height: 100%;
  transform: scale(0.8);
  transform-origin: top left;
  padding: 0;
  margin: 0;
  background-color: white !important;
}

.preview-content {
  width: 125%;
  min-height: 100%;
  padding: 0;
  margin: 0;
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 1rem;
}

.card-body textarea,
.card-body pre.form-control {
  flex: 1;
  margin: 0;
  height: 300px !important;
  min-height: 300px !important;
  max-height: 300px !important;
}

.form-control {
  display: block;
  width: 100%;
  padding: 0;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--input-text);
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 0.375rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

textarea,
pre.form-control {
  background-color: var(--input-bg) !important;
  color: var(--input-text) !important;
  border-color: var(--input-border) !important;
  font-family: monospace;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre;
  tab-size: 2;
  padding: 1rem;
  margin: 0;
  resize: none;
  overflow: auto;
}

pre.form-control {
  display: flex;
  flex-direction: column;
  padding: 0;
}

pre.form-control code {
  flex: 1;
  font-family: monospace;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre;
  tab-size: 2;
  padding: 1rem;
  margin: 0;
  height: 100%;
  display: block;
}

/* Syntax highlighting styles for output textarea */
#outputHtml {
  white-space: pre-wrap;
  word-wrap: break-word;
}

#outputHtml .token.comment,
#outputHtml .token.prolog,
#outputHtml .token.doctype,
#outputHtml .token.cdata {
  color: var(--prism-comment) !important;
}

#outputHtml .token.punctuation {
  color: var(--prism-punctuation) !important;
}

#outputHtml .token.property,
#outputHtml .token.tag,
#outputHtml .token.boolean,
#outputHtml .token.number,
#outputHtml .token.constant,
#outputHtml .token.symbol {
  color: var(--prism-number) !important;
}

#outputHtml .token.selector,
#outputHtml .token.attr-name,
#outputHtml .token.string,
#outputHtml .token.char,
#outputHtml .token.builtin {
  color: var(--prism-string) !important;
}

#outputHtml .token.operator,
#outputHtml .token.entity,
#outputHtml .token.url,
#outputHtml .language-css .token.string,
#outputHtml .style .token.string {
  color: var(--prism-operator) !important;
}

#outputHtml .token.atrule,
#outputHtml .token.attr-value,
#outputHtml .token.keyword {
  color: var(--prism-keyword) !important;
}

#outputHtml .token.function {
  color: var(--prism-function) !important;
}

#outputHtml .token.regex,
#outputHtml .token.important,
#outputHtml .token.variable {
  color: var(--prism-text) !important;
}

.card-header[data-bs-toggle="collapse"] {
  cursor: pointer;
  transition: background-color 0.2s;
}

.card-header[data-bs-toggle="collapse"]:hover {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  opacity: 0.9;
}

.toggle-icon {
  transition: transform 0.3s ease;
}

.collapsed .toggle-icon {
  transform: rotate(-180deg);
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
  transition: all 0.3s ease;
}

.btn-outline-primary:hover {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  border-color: var(--primary-color);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-success {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  border: none;
  transition: all 0.3s ease;
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  opacity: 0.9;
}

.social-icons a {
  text-decoration: none;
  transition: all 0.3s ease;
  opacity: 0.8;
  font-size: 1.5rem;
  margin: 0 0.5rem;
  position: relative;
  display: inline-block;
  color: var(--text-color) !important;
}

.social-icons a:hover {
  opacity: 1;
  transform: translateY(-3px) scale(1.1);
  color: var(--primary-color) !important;
  text-shadow: 0 0 10px rgba(46, 204, 113, 0.5),
    0 0 20px rgba(46, 204, 113, 0.3), 0 0 30px rgba(46, 204, 113, 0.2);
}

.social-icons a::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--primary-color),
    transparent
  );
  transform: translateX(-50%);
  transition: width 0.3s ease;
}

.social-icons a:hover::after {
  width: 100%;
}

.social-icons .fa-github:hover,
.social-icons .fa-linkedin:hover {
  color: var(--primary-color) !important;
  animation: iconPulse 1s infinite;
}

@keyframes iconPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 2rem;
}

/* Remove old mouse trail styles */
.mouse-trail,
.trail-particle,
.trail-particle.fade {
  display: none;
}

iframe {
  z-index: 1;
  position: relative;
}

/* Add a wrapper to ensure proper stacking context */
.preview-wrapper {
  position: relative;
  z-index: 1;
  isolation: isolate;
  width: 100%;
  height: 500px;
  overflow: hidden;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.preview-wrapper::-webkit-scrollbar {
  display: none !important;
}

/* Add a container for the entire page */
.page-container {
  position: relative;
  z-index: 1;
}

.preview-newtab-btn .fa-external-link-alt {
  color: var(--primary-color) !important;
}

/* Update code output box styling */
pre {
  background-color: var(--input-bg) !important;
  color: var(--input-text) !important;
  border: 1px solid var(--input-border) !important;
  border-radius: 8px;
  margin: 0;
  padding: 0;
  overflow: auto;
  height: 300px;
  transition: background-color var(--animation-timing),
    color var(--animation-timing), border-color var(--animation-timing);
}

pre:focus {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 0.25rem rgba(46, 204, 113, 0.25) !important;
  outline: none;
}

pre code {
  font-family: monospace;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre;
  tab-size: 2;
}

/* Override Prism.js default focus styles */
pre:focus {
  outline: none !important;
  box-shadow: 0 0 0 0.25rem rgba(46, 204, 113, 0.25) !important;
}

/* Override Prism.js theme colors */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: var(--prism-comment) !important;
}

.token.punctuation {
  color: var(--prism-punctuation) !important;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol {
  color: var(--prism-number) !important;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin {
  color: var(--prism-string) !important;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
  color: var(--prism-operator) !important;
}

.token.atrule,
.token.attr-value,
.token.keyword {
  color: var(--prism-keyword) !important;
}

.token.function {
  color: var(--prism-function) !important;
}

.token.regex,
.token.important,
.token.variable {
  color: var(--prism-text) !important;
}

/* Theme toggle positioning */
#themeToggle,
#mouseEffectsToggle {
  margin-top: -5px;
}

#themeToggle:hover,
#mouseEffectsToggle:hover {
  color: #2ecc71 !important;
  border-color: #2ecc71 !important;
  background-color: transparent !important;
}

#themeToggle:hover i,
#mouseEffectsToggle:hover i {
  color: #2ecc71 !important;
}

.preview-zoom {
  width: 100%;
  height: 500px;
  border: 1px solid #e0e0e0;
  background: white;
  overflow: auto;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.preview-zoom::-webkit-scrollbar {
  display: none !important;
}

/* Add a new class for the preview container */
.preview-container {
  width: 100%;
  height: 500px;
  overflow: hidden;
  position: relative;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.preview-container::-webkit-scrollbar {
  display: none !important;
}
