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

:root {
  --color-primary: #667eea;
  --color-secondary: #8e6aeb;
  --color-accent: #3d4c9f;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(to bottom, var(--color-primary) 0%, var(--color-secondary) 100%);
  min-height: 100vh;
  padding: 2rem 1rem;
}

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

header {
  text-align: center;
  color: white;
  margin-bottom: 3rem;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* Link Cards */
.links-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  padding: 1.5rem 2rem;
  border-radius: 12px;
  text-decoration: none;
  color: #333;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.link-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.link-card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-accent);
}

.link-card svg {
  color: var(--color-accent);
  flex-shrink: 0;
}

/* Login Box */
.login-box {
  background: white;
  padding: 3rem;
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  margin: 0 auto;
}

.login-box h1 {
  color: #333;
  margin-bottom: 2rem;
  text-align: center;
}

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

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #555;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-accent);
}

button {
  width: 100%;
  padding: 0.875rem;
  background: var(--color-accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

button:hover {
  opacity: 0.85;
}

.back-link {
  display: block;
  text-align: center;
  margin-top: 1.5rem;
  color: var(--color-accent);
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.error {
  background: #fee;
  color: #c33;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  text-align: center;
}

.success {
  background: #efe;
  color: #3a3;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  text-align: center;
}

/* Admin Dashboard */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
  margin-bottom: 2rem;
}

.admin-header h1 {
  font-size: 2rem;
}

.admin-header a {
  color: white;
  text-decoration: none;
  margin-left: 1rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  transition: background 0.2s;
}

.admin-header a:hover {
  background: rgba(255, 255, 255, 0.3);
}

.admin-section {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.admin-section h2 {
  color: #333;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.admin-form {
  margin-top: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1rem;
}

.admin-form button {
  margin-top: 1rem;
}

.empty-state {
  color: #999;
  text-align: center;
  padding: 2rem;
}

.links-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.link-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  transition: all 0.2s;
}

.link-item:hover {
  background: #f0f0f0;
  border-color: #ccc;
}

.link-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.link-info strong {
  color: #333;
  font-size: 1.1rem;
}

.link-actions {
  display: flex;
  gap: 0.5rem;
}

.link-actions button {
  width: auto;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.link-actions button.move-btn {
  padding: 0.4rem 0.6rem;
  font-size: 1.1rem;
  background: #f0f0f0;
  color: #333;
  border: 1px solid #ddd;
}

.link-actions button.move-btn:hover {
  background: var(--color-accent);
  color: white;
  opacity: 1;
}

.link-actions .move-btn.disabled {
  padding: 0.4rem 0.6rem;
  font-size: 1.1rem;
  background: transparent;
  color: #ccc;
  cursor: default;
  opacity: 0.5;
}

.link-actions button.delete {
  background: #e74c3c;
}

.link-actions button.delete:hover {
  background: #c0392b;
  opacity: 1;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
}

.modal-content h2 {
  color: #333;
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
}

.modal-actions button {
  flex: 1;
}

.modal-actions button[type="button"] {
  background: #95a5a6;
}

.modal-actions button[type="button"]:hover {
  background: #7f8c8d;
}

/* Theme Customization */
.theme-row {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.color-input-group {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.color-input-group input[type="color"] {
  width: 60px;
  height: 45px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
}

.color-input-group input[type="text"] {
  width: 120px;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: monospace;
}

.color-preview {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.color-swatch {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  cursor: help;
  transition: transform 0.2s;
}

.color-swatch:hover {
  transform: scale(1.1);
}

/* Responsive */
@media (max-width: 600px) {
  body {
    padding: 1rem;
  }

  header h1 {
    font-size: 2rem;
  }

  .login-box {
    padding: 2rem 1.5rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .admin-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .link-item {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .link-info {
    flex: 1;
    min-width: 150px;
  }

  .link-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
