:root {
  --primary-color: #ff533d;
  --accent-color: #F5A623;
  --text-color: #333;
  --bg-color: #f5f5f5;
  --card-bg: #fff;
  --border-color: #e0e0e0;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --success-color: #4caf50;
}

body.dark {
  --text-color: #f5f5f5;
  --bg-color: #121212;
  --card-bg: #1e1e1e;
  --border-color: #333;
  --shadow-color: rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Poppins', sans-serif;
}

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

/* Header Styles */
header {
  background-color: var(--primary-color);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 5px var(--shadow-color);
}

.header-content h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

.theme-toggle button {
  background: none;
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: background-color 0.3s;
}

.theme-toggle button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

main {
  flex: 1;
  padding: 2rem;
}

.hero {
  text-align: center;
  margin-bottom: 2rem;
}

.tools {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.tool-card {
  background: var(--card-bg);
  padding: 1.5rem 2rem;
  border-radius: 10px;
  box-shadow: 0 2px 4px var(--shadow-color);
  cursor: pointer;
  transition: transform 0.2s;
  position: relative;
}

.tool-card.selected {
  border: 2px solid var(--primary-color);
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

.tool-card.selected::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -6px;
  height: 3px;
  background: var(--primary-color);
  border-radius: 2px;
}

.tool-card.dim {
  opacity: 0.6;
}

.tool-card:hover {
  transform: translateY(-5px);
}

.tool-section {
  max-width: 700px;
  margin: auto;
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 2px 8px var(--shadow-color);
  margin-bottom: 2rem;
  animation: fadeIn 0.3s ease-in-out;
}

.hidden {
  display: none;
}

.upload-area {
  border: 2px dashed var(--primary-color);
  padding: 2rem;
  text-align: center;
  border-radius: 10px;
  margin-bottom: 1rem;
  cursor: pointer;
}

.file-list {
  list-style: none;
  margin-bottom: 1rem;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: #fff;
  border-radius: 5px;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.welcome-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1rem 0;
}

.welcome-message {
  font-size: 1.3rem;
  opacity: 0.65;
  text-align: center;
}

.how-to {
  background: #eef2f7;
  border-left: 4px solid var(--primary-color);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-top: 1rem;
}

body.dark .how-to {
  background: #2a2a2a;
  color: #eee;
  border-left-color: var(--primary-color);
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
input[type="range"] {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
  transition: box-shadow 0.2s, border-color 0.2s;
}

body.dark input[type="text"],
body.dark input[type="password"],
body.dark input[type="number"],
body.dark select,
body.dark input[type="range"] {
  background: #2a2a2a;
  color: #eee;
  border: 1px solid #555;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.3);
}

.info-box {
  background: #e0e0e0;
  color: #333;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

body.dark .info-box {
  background: #444;
  color: #eee;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.primary {
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: background 0.2s;
}

.primary:hover {
  background: #e64b37;
}

.secondary {
  background: var(--accent-color);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: background 0.2s;
}

.secondary:hover {
  background: #e5941f;
}

.undo-redo {
  justify-content: center;
}

#undoRemove,
#redoRemove {
  background: var(--bg-color);
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, opacity 0.2s;
}

#undoRemove:hover:not(:disabled),
#redoRemove:hover:not(:disabled) {
  background: var(--primary-color);
  color: #fff;
  opacity: 0.9;
}

#undoRemove:disabled,
#redoRemove:disabled {
  opacity: 0.5;
  cursor: default;
}

.download-link {
  display: inline-block;
  margin-top: 1rem;
  background: var(--accent-color);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: background 0.2s;
}

.download-link:hover {
  background: #e5941f;
}

#imagesPreview a {
  display: block;
  margin-bottom: 0.5rem;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 1rem auto;
}

/* Footer Styles */
footer {
  background-color: var(--bg-color);
  padding: 2rem;
  text-align: center;
  border-top: 1px solid var(--border-color);
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
}

.heart {
  color: var(--primary-color);
}

.footer-links {
  margin: 1rem 0;
}

.footer-links a {
  color: #666;
  text-decoration: none;
  margin: 0 0.5rem;
  transition: color 0.3s;
}

.footer-links a:hover {
  color: var(--primary-color);
}

.copyright {
  font-size: 0.9rem;
  color: #888;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeScale {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@media (max-width: 600px) {
  .tools {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  .tool-card {
    width: 100%;
    text-align: center;
  }
}

/* Page preview grid and cards */
.scroll-container {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 1rem;
}

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

.page-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: box-shadow 0.2s, transform 0.2s, opacity 0.2s;
}

body.dark .page-card {
  background: #1E1E1E;
  border: 1px solid #555;
}

.page-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#removeList .page-card {
  cursor: pointer;
}

#removeList .page-card:hover {
  transform: translateY(-3px);
}

.page-card canvas,
.page-card img {
  width: 100%;
  height: auto;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.page-label {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.remove-checkbox {
  position: absolute;
  top: 6px;
  right: 6px;
}

.page-card.selected-remove {
  border-color: #e74c3c;
  background: rgba(231, 76, 60, 0.15);
  opacity: 0.8;
}

.page-card.removing {
  animation: fadeOut 0.4s forwards;
}

.sortable-chosen {
  opacity: 0.8;
}

.sortable-ghost {
  opacity: 0.4;
}

.page-card.dragging {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--primary-color);
}

/* SEO Description Styles */
.seo-description {
  background-color: var(--bg-color);
  padding: 3rem 0;
  border-top: 1px solid var(--border-color);
  margin-top: 3rem;
}

.seo-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.seo-content p {
  margin-bottom: 1.2rem;
  color: #666;
  line-height: 1.7;
}

.seo-content p:last-child {
  margin-bottom: 0;
}

/* Other Tools Styles */
.other-tools {
  background-color: var(--card-bg);
  padding: 3rem 0;
  border-top: 1px solid var(--border-color);
}

.other-tools h3 {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-color);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.other-tools .tool-card {
  background-color: var(--card-bg);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 2px 10px var(--shadow-color);
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: default;
}

.other-tools .tool-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px var(--shadow-color);
}

.tool-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.other-tools .tool-card h4 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.other-tools .tool-card p {
  color: #666;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.tool-btn {
  display: inline-block;
  background-color: var(--primary-color);
  color: white;
  padding: 0.6rem 1.5rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.3s;
}

.tool-btn:hover {
  background-color: #e64a35;
}

.tool-btn.disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.tool-btn.disabled:hover {
  background-color: #bbb;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .page-grid {
    grid-template-columns: 1fr;
  }
}
