@import url("https://fonts.googleapis.com/icon?family=Material+Icons");

:root {
  --bg-color: #f8f9fa;
  --surface-color: #ffffff;
  --text: #1c1b1f;
  --text-sec: #49454f;
  --border-color: #e7e0ec;
  --input-bg: #f3f4f6;

  --color-error: #ffb4ab;
  --shadow: 0 2px 6px 2px rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 8px 3px rgba(0, 0, 0, 0.08),
    0 1px 3px 0 rgba(0, 0, 0, 0.15);
  --radius: 16px;
  --transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
}

body.theme-dark {
  --bg-color: #141218;
  --surface-color: #1d1b20;
  --text: #e6e1e5;
  --text-sec: #cac4d0;
  --border-color: #49454f;
  --input-bg: #2b2930;

  --shadow: 0 4px 8px 3px rgba(0, 0, 0, 0.3);
}

body.theme-amoled {
  --bg-color: #000000;
  --surface-color: #000000;
  --text: #ffffff;
  --text-sec: #a1a1aa;
  --border-color: #333333;
  --input-bg: #121212;
}

body.theme-dracula {
  --bg-color: #282a36;
  --surface-color: #44475a;
  --text: #f8f8f2;
  --text-sec: #bd93f9;
  --border-color: #6272a4;
  --input-bg: #282a36;
}

body.theme-cyberpunk {
  --bg-color: #050510;
  --surface-color: #0b0b1e;
  --text: #be00ff;
  --text-sec: #804f93;
  --border-color: #2f113a;
  --input-bg: #000000;

  --shadow: 0 0 20px rgb(216 0 255 / 20%);
}

body.theme-forest {
  --bg-color: #1a211d;
  --surface-color: #242e28;
  --text: #e6f5e8;
  --text-sec: #8ba892;
  --border-color: #3a4b3f;
  --input-bg: #111613;
}

body.theme-sunset {
  --bg-color: #2d1b2e;
  --surface-color: #442745;
  --text: #fce7cf;
  --text-sec: #e08e79;
  --border-color: #6d3d58;
  --input-bg: #1f1020;
}

body.theme-monokai {
  --bg-color: #272822;
  --surface-color: #3e3d32;
  --text: #f8f8f2;
  --text-sec: #e6db74;
  --border-color: #75715e;
  --input-bg: #272822;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Roboto", "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-color);
  color: var(--text);
  transition: background-color 0.3s ease, color 0.3s ease;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

.material-icons {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.app-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.bg-watermark {
  position: fixed;
  z-index: -1;
  pointer-events: none;
  opacity: 0.05;
  width: 600px;
  bottom: -80px;
  right: -90px;
  transform: rotate(-15deg);
}

.bg-watermark.alt {
  bottom: auto;
  top: -28px;
  right: auto;
  left: -10px;
}

.bg-watermark svg {
  width: 100%;
  height: auto;
  fill: var(--text);
}

@media (max-width: 600px) {
  .bg-watermark {
    width: 90%;
    bottom: 40px;
    right: -20px;
    max-width: 350px;
  }
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  padding: 0 0.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo .material-icons {
  color: var(--accent);
  font-size: 2.2rem;
}

.logo span {
  color: var(--accent);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.75rem;
  border-radius: 50%;
  transition: var(--transition);
  display: inline-flex;
  text-decoration: none;
}

.icon-btn:hover {
  background: var(--input-bg);
  color: var(--accent);
}

main {
  min-height: 60vh;
}

.fix {
  position: fixed;
  top: 60%;
  right: 50%;
  transform: translate(50%);
  font-size: 20px;
  color: var(--text-sec);
  text-transform: capitalize;
  text-decoration: none;
}

.fix p a {
  text-decoration: none;
  color: var(--accent);
}

.input-card {
  background: var(--surface-color);
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
  transition: var(--transition);
}

.input-card:hover {
  box-shadow: var(--shadow-hover);
}

.url-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.2rem 1rem;
  margin-bottom: 1.5rem;
  transition: var(--transition);
  position: relative;
  height: 56px;
}

.url-input-wrapper:focus-within {
  border-color: var(--accent);
  border-width: 2px;
  background: var(--input-bg);
}

.url-input-wrapper.compact {
  height: 48px;
  margin-bottom: 1.5rem;
  opacity: 0.85;
}

.url-input-wrapper.compact:focus-within {
  opacity: 1;
}

.input-icon {
  color: var(--text-sec);
  margin-right: 1rem;
  font-size: 1.4rem;
}

input[type="text"],
input[type="password"] {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.05rem;
  width: 100%;
  height: 100%;
  outline: none;
  font-weight: 400;
}

input::placeholder {
  color: var(--text-sec);
  opacity: 0.6;
}

#paste-btn {
  background: transparent;
  border: none;
  color: var(--text-sec);
  cursor: pointer;
  font-size: 1.3rem;
  padding: 0.5rem;
  border-radius: 50%;
  transition: 0.2s;
}

#paste-btn:hover {
  background: var(--border-color);
  color: var(--accent);
}

input[type="number"] {
  padding-left: 5px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.05rem;
  width: 100%;
  height: 100%;
  outline: none;
  font-weight: 400;
}

/* Chrome, Edge, Safari */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
input[type="number"] {
  appearance: textfield;
}

.action-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.button-group {
  display: flex;
  gap: 12px;
}

.primary-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  flex: 1;
  height: 52px;
  border-radius: var(--radius);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.primary-btn:hover {
  filter: brightness(110%);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.primary-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(1);
  box-shadow: none;
}

.secondary-btn {
  width: 52px;
  height: 52px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--text-sec);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: var(--transition);
}

.secondary-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--input-bg);
}

.status-card {
  background: var(--surface-color);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  margin-top: 2rem;
  animation: slideUp 0.3s ease-out;
}

.hidden {
  display: none !important;
}

.status-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  align-items: center;
}

.status-header h3 {
  font-size: 1.1rem;
  font-weight: 500;
}

.badge {
  background: var(--input-bg);
  padding: 0.3rem 0.8rem;
  border-radius: 50px;
  font-size: 0.8rem;
  color: var(--text-sec);
  border: 1px solid var(--border-color);
  font-weight: 500;
}

.progress-container {
  background: var(--input-bg);
  height: 6px;
  border-radius: 10px;
  overflow: hidden;
  margin: 1rem 0;
  border: none;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 10px;
}

#status-text {
  color: var(--text-sec);
  font-size: 0.9rem;
}

.file-preview {
  margin-top: 1.5rem;
  max-height: 250px;
  overflow-y: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 0.5rem;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  font-size: 0.9rem;
  color: var(--text);
  border-bottom: 1px solid var(--border-color);
  transition: 0.2s;
}

.file-item:last-child {
  border-bottom: none;
}

.file-item:hover {
  background: var(--input-bg);
  border-radius: 8px;
}

.file-item .material-icons,
.file-item i {
  color: var(--accent);
  opacity: 0.8;
  font-size: 1.1rem;
}

.loader-container {
  position: relative;
  width: 64px;
  height: 64px;
  margin-bottom: 24px;
}

.circular-progress {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 6px solid var(--border-color);
  border-top-color: var(--accent);
  animation: spin 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.icon-success,
.icon-error {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--accent);
  background: var(--bg-color);
  border-radius: 50%;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.icon-error {
  background: var(--color-error);
  color: #690005;
}

.state-success .circular-progress {
  display: none;
}

.state-success .icon-success {
  display: flex;
}

.state-error .circular-progress {
  display: none;
}

.state-error .icon-error {
  display: flex;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  backdrop-filter: blur(5px);
}

.modal-content {
  background: var(--surface-color);
  width: 90%;
  max-width: 420px;
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  animation: zoomIn 0.25s cubic-bezier(0.2, 0, 0, 1);
}

.modal-header {
  padding: 1.5rem 1.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: none;
}

.modal-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

.close-modal.bb {
  background: var(--input-bg);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.2rem;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

.close-modal:hover {
  background: var(--border-color);
  border: none;
}

.modal-body {
  padding: 0 1.5rem 1.5rem;
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

.modal-footer .primary-btn {
  width: auto;
  padding: 0 2rem;
  flex: none;
}

.setting-group {
  margin-bottom: 1.5rem;
}

.setting-group label {
  display: block;
  margin-bottom: 0.6rem;
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
}

.setting-group input[type="color"] {
  background: var(--accent);
  border: none;
  width: 100%;
  height: 50px;
  margin: 0 10px;
  cursor: pointer;
}

.input-with-icon {
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  padding: 0.8rem 1rem;
  border-radius: 12px;
}

.input-with-icon:focus-within {
  border-color: var(--accent);
}

.input-with-icon .material-icons {
  color: var(--text-sec);
  margin-right: 0.8rem;
}

select {
  width: 100%;
  padding: 0.9rem;
  border-radius: 12px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text);
  font-size: 1rem;
  appearance: none;
  cursor: pointer;
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.2em;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 32px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--border-color);
  transition: 0.3s;
  border-radius: 32px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 24px;
  width: 24px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.3s cubic-bezier(0.2, 0, 0, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

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

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

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: var(--surface-color);
  color: var(--text);
  padding: 1rem 1.25rem;
  border-radius: 10px;
  min-width: 280px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  border-left: 3px solid;
  animation: slideUpToast 0.4s cubic-bezier(0.2, 0, 0, 1);
}

.toast.success {
  border-left-color: #22c55e;
}

.toast.error {
  border-left-color: #ef4444;
}

.toast .material-icons,
.toast i {
  font-size: 1.4rem;
}

@keyframes slideUpToast {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wiki-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  animation: slideUp 0.4s ease-out;
}

.wiki-toc {
  position: fixed;
  top: 20%;
  right: 10px;
  width: 220px;
  background: var(--input-bg);
  color: var(--accent);
  border: 0.5px solid var(--border-color);
  padding: 4px 15px 10px;
  border-radius: 15px;
  max-height: 70vh;
  overflow: auto;
  box-shadow: var(--shadow);
}

.wiki-toc-list {
  list-style: none;
  padding-left: 0;
  color: var(--accent);
  margin: 0;
}

.wiki-header {
  text-align: center;
  margin-bottom: 3rem;
}

.wiki-header h1 {
  font-size: 2.5rem;
  margin-top: 1rem;
}

.wiki-card {
  background: var(--surface-color);
  padding: 2.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.wiki-card h2 {
  color: var(--accent);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.code-block {
  background: var(--input-bg);
  padding: 1.25rem;
  border-radius: 12px;
  word-break: break-word;
  border: 1px solid var(--border-color);
  font-family: "Fira Code", monospace;
  font-size: 0.9rem;
  overflow-x: auto;
  color: var(--accent);
  margin: 1rem 0;
}

.step-num {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

.feature-item {
  padding: 1.75rem;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  text-align: left;
  transition: var(--transition);
}

.feature-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.feature-item .material-icons,
.feature-item i {
  background: var(--input-bg);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--accent);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

footer {
  text-align: center;
  color: var(--text-sec);
  padding: 3rem 0;
  font-size: 0.9rem;
  opacity: 0.8;
}

@media (max-width: 768px) {
  .wiki-toc {
    display: none;
  }
}

@media (max-width: 600px) {
  .app-container {
    padding: 1rem;
  }

  .input-card {
    padding: 1.5rem;
  }

  .url-input-wrapper {
    padding: 0.5rem;
  }

  h1 {
    font-size: 1.5rem;
  }
}

@media (max-width: 1024px) {

  .app-container,
  .wiki-container {
    padding: 2rem 1rem;
  }

  .wiki-card,
  .input-card,
  .card {
    padding: 2rem;
  }

  .feature-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  .step-num {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .wiki-toc {
    top: 15%;
    right: 5px;
    width: 200px;
    padding: 3px 12px 8px;
    max-height: 65vh;
  }
}

@media (max-width: 768px) {

  .app-container,
  .wiki-container {
    padding: 1.5rem 0.75rem;
  }

  .wiki-card,
  .input-card,
  .card {
    padding: 1.5rem;
  }

  .feature-grid {
    grid-template-columns: 1fr 1fr;
  }

  .wiki-toc {
    display: none;
    /* keep TOC hidden on tablet/small screens */
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  .step-num {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }
}

@media (max-width: 600px) {

  .app-container,
  .wiki-container {
    padding: 1rem 0.5rem;
  }

  .input-card,
  .wiki-card,
  .card {
    padding: 1rem;
  }

  .url-input-wrapper {
    padding: 0.4rem 0.8rem;
    height: 48px;
  }

  .feature-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1rem;
  }

  .step-num {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  .bg-watermark {
    width: 80%;
    bottom: 20px;
    right: -10px;
    max-width: 250px;
  }


}

/* Ensure TOC scrolls nicely on mobile if enabled */
@media (max-height: 600px) {
  .wiki-toc {
    max-height: 50vh;
  }
}



/* Feature items text wraps on small screens */
.feature-item {
  word-break: break-word;
}

.modal-content {
  width: 95%;
  max-width: 400px;
}

.modal-footer .primary-btn {
  width: 100%;
  text-align: center;
}

/* File preview adjustments */
.file-preview {
  max-height: 200px;
}

.file-item {
  font-size: 0.85rem;
  gap: 0.5rem;
}

.material-icons {
  font-size: 1.2rem;
}

.feature-item .material-icons,
.feature-item i {
  width: 40px;
  height: 40px;
  font-size: 1.3rem;
}

.card {
  background: var(--surface-color);
  padding: 40px;
  border-radius: 28px;
  box-shadow: var(--shadow);
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.github-corner {
     position: fixed;
    z-index: 100;
    top: 0;
    right: 0;
}