/* Global Styles */
:root {
  --bg-color: #0f0f12;
  --text-color: #fff;
  --accent-color: #00c6ff;
  --secondary-color: #8e2de2;
  --panel-bg: rgba(255, 255, 255, 0.05);
  --panel-border: rgba(255, 255, 255, 0.1);
  --input-bg: rgba(255, 255, 255, 0.05);
  --font-family: 'Montserrat', system-ui, Segoe UI, Roboto, Arial;
}

body.light-theme {
  --bg-color: #f0f2f5;
  --text-color: #333;
  --panel-bg: rgba(0, 0, 0, 0.05);
  --panel-border: rgba(0, 0, 0, 0.1);
  --input-bg: rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-family);
  background: var(--bg-color);
  color: var(--text-color);
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

/* Background Canvas */
#bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

/* Hero Section */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  position: relative;
}

#sentence {
  font-size: min(10vw, 84px);
  line-height: 1.1;
  margin-bottom: 40px;
  text-shadow: 0 8px 30px rgba(142, 45, 226, 0.5);
  transition: all 0.3s ease;
  word-break: break-word;
}

.input-trigger {
  cursor: pointer;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 30px;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
}

.input-trigger:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

body.light-theme .input-trigger {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
}
body.light-theme .input-trigger:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* Settings Button */
.settings-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  background: transparent;
  border: none;
  color: var(--text-color);
  font-size: 24px;
  padding: 10px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.3s;
}
.settings-btn:hover { transform: rotate(90deg); }

/* Jump to Comments Button */
.jump-btn {
  margin-top: 40px;
  background: transparent;
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s;
}
.jump-btn:hover {
  background: var(--accent-color);
  color: #fff;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s;
}
.modal.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: var(--bg-color);
  padding: 30px;
  border-radius: 20px;
  width: 90%;
  max-width: 500px;
  border: 1px solid var(--panel-border);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  transform: scale(0.9);
  transition: transform 0.3s;
}
.modal.active .modal-content { transform: scale(1); }

.modal h2 { margin-bottom: 20px; }

.modal-select {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--input-bg);
  color: var(--text-color);
  font-size: 1rem;
  margin-bottom: 15px;
  outline: none;
  cursor: pointer;
  appearance: none; /* Remove default arrow */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}

body.light-theme .modal-select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

.modal-select option {
  background: #1a1a1a;
  color: #fff;
}
body.light-theme .modal-select option {
  background: #fff;
  color: #333;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0; /* Gap handled by margins now */
}

textarea {
  width: 100%;
  padding: 15px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--input-bg);
  color: var(--text-color);
  font-size: 1.1rem;
  resize: vertical;
  min-height: 100px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s;
}
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: linear-gradient(90deg, var(--secondary-color), var(--accent-color));
  color: #fff;
}
.btn-secondary {
  background: var(--panel-bg);
  color: var(--text-color);
  border: 1px solid var(--panel-border);
}

/* Settings Panel */
.settings-panel {
  position: fixed;
  top: 70px;
  right: 20px;
  width: 300px;
  background: var(--bg-color);
  border: 1px solid var(--panel-border);
  border-radius: 15px;
  padding: 20px;
  z-index: 99;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.settings-panel.active { transform: translateX(0); }

.setting-item {
  margin-bottom: 15px;
}
.setting-item label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  opacity: 0.8;
}
.setting-item input[type="range"],
.setting-item input[type="color"],
.setting-item input[type="text"] {
  width: 100%;
}
.setting-item input[type="text"] {
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: var(--input-bg);
  color: var(--text-color);
}

/* Waline Container */
.waline-wrapper {
  width: 100%;
  max-width: 100%;
  margin: 50px auto;
  padding: 20px 40px;
}

/* Waline Dark Mode Customization */
/* Force override Waline styles */
#waline {
  --waline-theme-color: #00c6ff;
  --waline-active-color: #8e2de2;
  --waline-bgcolor: transparent;
  --waline-bgcolor-light: rgba(255, 255, 255, 0.05);
  --waline-bgcolor-hover: rgba(255, 255, 255, 0.1);
  --waline-border-color: rgba(255, 255, 255, 0.1);
  --waline-disable-bgcolor: rgba(255, 255, 255, 0.1);
  --waline-info-bgcolor: rgba(255, 255, 255, 0.1);
  --waline-info-color: rgba(255, 255, 255, 0.6);
  --waline-text-color: #eee;
  
  /* Specific overrides for the white background issue */
  --waline-white: transparent;
  --waline-light-grey: #666;
  --waline-dark-grey: #999;
}

/* Force transparent backgrounds on specific elements */
#waline .wl-panel {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  margin: 0 !important;
}

#waline .wl-editor, 
#waline .wl-header input {
  background: transparent !important;
  color: var(--text-color) !important;
}

#waline .wl-header label {
  color: rgba(255, 255, 255, 0.7) !important;
}

#waline .wl-card {
  background: transparent !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

#waline .wl-btn.primary {
  border: none !important;
  background: linear-gradient(90deg, var(--secondary-color), var(--accent-color)) !important;
  color: #fff !important;
}

/* Fix for meta tags (OS, Browser, Location) */
#waline .wl-meta span {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ccc !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Light Theme Overrides for Waline */
body.light-theme #waline {
  --waline-text-color: #333;
  --waline-bgcolor-light: rgba(0, 0, 0, 0.05);
  --waline-bgcolor-hover: rgba(0, 0, 0, 0.1);
  --waline-border-color: rgba(0, 0, 0, 0.1);
  --waline-white: #fff;
}

body.light-theme #waline .wl-panel {
  background: #fff !important;
  border-color: rgba(0,0,0,0.1) !important;
}

body.light-theme #waline .wl-header label {
  color: #666 !important;
}

body.light-theme #waline .wl-meta span {
  background: rgba(0, 0, 0, 0.05) !important;
  color: #666 !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
}

body.light-theme #waline .wl-editor, 
body.light-theme #waline .wl-header input {
  color: #333 !important;
}

/* Typewriter Effect */
.typewriter {
  border-right: 2px solid rgba(255, 255, 255, 0.75);
  white-space: pre-wrap;
  animation: blink-caret 0.75s step-end infinite;
}

@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: rgba(255, 255, 255, 0.75); }
}

/* Responsive */
@media (max-width: 768px) {
  #sentence { font-size: 12vw; }
  .modal-content { width: 95%; padding: 20px; }
}

/* Feature Classes */
.glow { text-shadow: 0 0 10px var(--accent-color), 0 0 20px var(--secondary-color); }
.outline { -webkit-text-stroke: 1px var(--text-color); color: transparent; text-shadow: none; }
.gradient-text {
  background: linear-gradient(90deg, #ff8a00, #e52e71, #8e2de2, #00c6ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
