:root {
  --primary-color: #3498db;
  --secondary-color: #2980b9;
  --text-color: #333;
  --light-bg: #f5f5f5;
  --border-color: #ddd;
  --success-color: #2ecc71;
  --warning-color: #f39c12;
  --error-color: #e74c3c;
  --card-bg: white;
  --header-bg: white;
  --footer-bg: white;
}

/* Dark theme variables */
[data-theme="dark"] {
  --primary-color: #60a5fa;
  --secondary-color: #3b82f6;
  --text-color: #e5e7eb;
  --light-bg: #1f2937;
  --border-color: #4b5563;
  --success-color: #34d399;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --card-bg: #374151;
  --header-bg: #111827;
  --footer-bg: #111827;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.4;
  color: var(--text-color);
  background-color: var(--light-bg);
  height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: var(--primary-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Home page styles */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
  text-align: center;
}

header {
  margin-bottom: 2.3rem;
}

header h1 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.card {
  background-color: var(--card-bg);
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  margin-bottom: 2rem;
  transition: background-color 0.3s ease;
}

.url-example {
  background-color: var(--light-bg);
  padding: 1rem;
  border-radius: 4px;
  margin: 1.5rem 0;
  font-family: monospace;
  font-size: 1.1rem;
}

.base-url {
  color: var(--text-color);
}

.page-name {
  color: var(--primary-color);
  font-weight: bold;
}

.create-page {
  display: flex;
  gap: 0.5rem;
  max-width: 500px;
  margin: 0 auto;
}

.create-page input {
  flex: 1;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
}

.create-page button {
  padding: 0 1.5rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s;
}

.create-page button:hover {
  background-color: var(--secondary-color);
}

footer {
  margin-top: 3rem;
  color: #777;
  font-size: 0.9rem;
}

/* Editor page styles */
.editor-container {
  height: 100vh;
  display: -webkit-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  -webkit-flex-direction: column;
  flex-direction: column;
}

.editor-container header {
  background-color: var(--header-bg);
  padding: 0.1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.3s ease;
}

.editor-container header h1 {
  font-size: 1.3rem;
  margin: 0;
}

.page-info {
  display: -webkit-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-url {
  font-family: monospace;
  background-color: var(--light-bg);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
}

.status {
  font-size: 0.9rem;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
}

.status.connected {
  background-color: var(--success-color);
  color: white;
}

.status.disconnected {
  background-color: var(--error-color);
  color: white;
}

.status.saving {
  background-color: var(--warning-color);
  color: white;
}

.status.saved {
  background-color: var(--success-color);
  color: white;
}

.editor-container main {
  flex: 1;
  overflow: hidden;
  padding: 1rem;
  padding-top: 0;
  margin-top: -2.0rem; /* Alternative approach using margin */
}

.editor-wrapper {
  height: 100%;
  border-radius: 4px;
  overflow: hidden;
}

#editor {
  width: 100%;
  height: 100%;
  padding: 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  resize: none;
  min-height: 100%;
  box-sizing: border-box;
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
}

#editor:focus {
  outline: 2px solid var(--primary-color);
  border-color: var(--primary-color);
}

.editor-container footer {
  background-color: var(--footer-bg);
  padding: 0.8rem 1rem;
  font-size: 0.8rem;
  color: #777;
  border-top: 1px solid var(--border-color);
  margin-top: 0;
  transition: background-color 0.3s ease;
}

/* Estilo para o botão de tentativa */
.retry-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 10px 20px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  z-index: 10;
}

.retry-button:hover {
  background-color: var(--secondary-color);
}

/* Estilo para o status de erro */
.status.error {
  background-color: var(--error-color);
  color: white;
}

/* Theme toggle styles */
.theme-switch-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  margin-right: 1rem;
}

.theme-switch {
  position: relative;
  display: inline-block;
  height: 24px;
  width: 48px;
}

.theme-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: .4s;
  border-radius: 24px;
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
}

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

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

input:focus + .slider {
  box-shadow: 0 0 1px var(--primary-color);
}

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

.slider-icons {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 6px;
  box-sizing: border-box;
  pointer-events: none;
}

.slider-icons span {
  color: white;
  font-size: 12px;
}

/* Logo styling */
.logo-text {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: -0.5px;
  text-decoration: none;
  margin-bottom: 2px;
	margin-left:15px;
  display: inline-block;
  position: relative;
  background: linear-gradient(45deg, var(--primary-color), #FF8C00);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -moz-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -moz-text-fill-color: transparent;
  text-fill-color: transparent;
  animation: gradient 3s ease infinite;
}

.logo-text span {
  font-weight: 300;
  background: linear-gradient(45deg, #FF8C00, var(--secondary-color));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -moz-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -moz-text-fill-color: transparent;
  text-fill-color: transparent;
  animation: gradient 3s ease infinite;
  animation-delay: 1.5s;
}

@-webkit-keyframes gradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes gradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Dark theme adjustment for the logo */
[data-theme="dark"] .logo-text {
  background: linear-gradient(45deg, var(--primary-color), #FF8C00);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -moz-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -moz-text-fill-color: transparent;
  text-fill-color: transparent;
}

[data-theme="dark"] .logo-text span {
  background: linear-gradient(45deg, #FF8C00, var(--primary-color));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -moz-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -moz-text-fill-color: transparent;
  text-fill-color: transparent;
}

/* Firefox specific fix for text gradient */
@-moz-document url-prefix() {
  .logo-text, .logo-text span, [data-theme="dark"] .logo-text, [data-theme="dark"] .logo-text span {
    background-clip: text;
    -moz-text-fill-color: transparent;
  }
}

/* Cross-browser flexbox improvements */
.editor-container, .page-info, .create-page, .offline-banner {
  display: -webkit-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
}

/* Better cross-browser transition support */
.slider, .create-page button, body, #editor {
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
}

/* Fallbacks for older browsers */
.editor-container main {
  padding-top: 0;
  margin-top: -2.0rem;
}

/* Fix for textarea in Firefox */
#editor {
  min-height: 100%;
  box-sizing: border-box;
}

/* Fix for Chrome and Edge margin issues */
@supports (-webkit-appearance:none) {
  .editor-container main {
    margin-top: -1.8rem;
  }
}

/* Fix for Firefox animation rendering */
@-moz-document url-prefix() {
  @keyframes gradient {
    0% {
      background-position: 0% 50%;
    }
    50% {
      background-position: 100% 50%;
    }
    100% {
      background-position: 0% 50%;
    }
  }
}

/* Responsividade */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .card {
    padding: 1.5rem;
  }

  .create-page input {
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
  }

  .create-page button {
    padding: 0 1rem;
    font-size: 0.9rem;
  }

  .editor-container header h1 {
    font-size: 1rem;
  }

  .page-url {
    font-size: 0.8rem;
  }

  .status {
    font-size: 0.8rem;
  }

  #editor {
    font-size: 0.9rem;
    padding: 0.5rem;
  }

  footer {
    font-size: 0.8rem;
  }

  .logo-text {
    font-size: 1.8rem;
  }

  .editor-container .logo-text {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .create-page {
    flex-direction: column;
    gap: 0.8rem;
  }

  .create-page input {
    width: 100%;
  }

  .create-page button {
    width: 100%;
  }

  .editor-container header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .theme-switch-wrapper {
    margin-right: 0;
  }
}
