/* CSS Variables for light/dark theme */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-tertiary: #9ca3af;
  --border-color: #e5e7eb;
  --accent-color: #4a90d9;
  --accent-hover: #357abd;
  --success-color: #2d7a3a;
  --error-color: #c0392b;
  --input-bg: #ffffff;
  --input-border: #d1d5db;
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-hover: rgba(0, 0, 0, 0.15);
  font-size: 14pt;
}

[data-theme="dark"] {
  --bg-primary: #111827;
  --bg-secondary: #1f2937;
  --bg-tertiary: #374151;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-tertiary: #9ca3af;
  --border-color: #374151;
  --accent-color: #60a5fa;
  --accent-hover: #3b82f6;
  --success-color: #34d399;
  --error-color: #f87171;
  --input-bg: #1f2937;
  --input-border: #4b5563;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-hover: rgba(0, 0, 0, 0.4);
}

/* Base styles */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  direction: rtl;
  text-align: right;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

/* Main content area */
.lp-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
  flex: 1;
  width: 100%;
}

/* Background image overlay */
.lp-has-bg .lp-container {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 12px;
  margin-top: 2rem;
  margin-bottom: 2rem;
  padding: 2rem 1.5rem;
  color: #f9fafb;
}

.lp-has-bg .lp-container h1,
.lp-has-bg .lp-container h2,
.lp-has-bg .lp-container h3,
.lp-has-bg .lp-container p,
.lp-has-bg .lp-container li,
.lp-has-bg .lp-container label {
  color: #f9fafb;
}

.lp-has-bg .lp-form input,
.lp-has-bg .lp-form select,
.lp-has-bg .lp-form textarea {
  background: rgba(255, 255, 255, 0.9);
  color: #1f2937;
}

/* Typography */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

h1,
h2,
h3 {
  line-height: 1.3;
  color: var(--text-primary);
}

h1 {
  margin-bottom: 2rem;
}

h2 {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

ul,
ol {
  padding-right: 1.5rem;
  list-style-position: inside;
}

li {
  margin-bottom: 0.25rem;
}

p {
  margin-bottom: 1.5rem;
}

/* Registration form styles */
.lp-form {
  margin: 1.5rem 0;
}

@media (min-width: 600px) {
  .lp-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
  }

  .lp-form .form-group:has(select[name="event_id"]),
  .lp-form .form-group:has(textarea),
  .lp-form button[type="submit"] {
    grid-column: 1 / -1;
  }
}

.lp-form .form-group {
  margin-bottom: 1rem;
}

.lp-form label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.lp-form input,
.lp-form select,
.lp-form textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  direction: rtl;
  background: var(--input-bg);
  color: var(--text-primary);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.lp-form input:focus,
.lp-form select:focus,
.lp-form textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color) 15%, transparent);
}

.lp-form button[type="submit"] {
  width: 100%;
  padding: 0.75rem;
  background: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.lp-form button[type="submit"]:hover {
  background: var(--accent-hover);
}

.lp-form select:disabled {
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
}

.lp-form .event-full {
  color: var(--text-tertiary);
}

/* Active landing pages grid */
.lp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.lp-grid a {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s;
}

.lp-grid a:hover {
  transform: translateY(-4px);
}

.lp-grid .lp-logo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-color);
  margin-bottom: 0.5rem;
}

.lp-grid .lp-title {
  font-weight: 600;
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.lp-no-pages {
  text-align: center;
  color: var(--text-tertiary);
  padding: 2rem 0;
}

/* Logo container */
.lp-logo-container {
  text-align: center;
  margin: 1rem 0 2rem 0;
}

.lp-logo-container .lp-logo-img {
  width: 100%;
  max-width: 640px;
  height: auto;
  margin: 0 auto;
  box-shadow: 0 0 20px #0017ca;
  border: 1px solid #666;
}

/* Box container */
.lp-box {
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

/* Confirmation & error pages */
.lp-confirmation,
.lp-error {
  text-align: center;
  padding: 3rem 1rem;
}

.lp-confirmation .lp-logo-img,
.lp-error .lp-logo-img {
  margin: 0 auto 1.5rem;
}

.lp-confirmation h1 {
  color: var(--success-color);
  margin-bottom: 1rem;
}

.lp-error h1 {
  color: var(--error-color);
  margin-bottom: 1rem;
}

.lp-error .back-link {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.5rem 1.5rem;
  background: var(--accent-color);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.2s;
}

.lp-error .back-link:hover {
  background: var(--accent-hover);
}

/* Footer */
.lp-footer {
  margin-top: auto;
  padding: 1.5rem 1rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

.lp-footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  width: 100%;
}

.lp-footer-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: opacity 0.2s;
}

.lp-footer-logo:hover {
  opacity: 0.8;
}

.lp-footer-logo img {
  height: 64px;
  width: auto;
}

.lp-footer-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
  justify-content: center;
}

.lp-footer-copyright {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.lp-footer-terms {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  background: var(--bg-tertiary);
  transition: all 0.2s;
  border: 1px solid var(--border-color);
  cursor: pointer;
}

.lp-footer-terms:hover {
  color: var(--text-primary);
  background: var(--bg-primary);
  border-color: var(--accent-color);
}

/* Theme toggle */
.lp-theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-tertiary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.lp-theme-toggle-btn {
  background: none;
  border: none;
  padding: 0.4rem;
  cursor: pointer;
  border-radius: 4px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.lp-theme-toggle-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.lp-theme-toggle-btn.active {
  background: var(--accent-color);
  color: #fff;
}

.lp-theme-toggle-btn svg {
  width: 18px;
  height: 18px;
}

.lp-theme-separator {
  width: 1px;
  height: 20px;
  background: var(--border-color);
}

/* Terms dialog */
.lp-terms-dialog-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lp-terms-dialog-overlay.open {
  display: flex;
  opacity: 1;
}

.lp-terms-dialog {
  background: var(--bg-primary);
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 20px 25px -5px var(--shadow),
    0 10px 10px -5px var(--shadow);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.lp-terms-dialog-overlay.open .lp-terms-dialog {
  transform: scale(1);
}

.lp-terms-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.lp-terms-dialog-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.lp-terms-dialog-close {
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.lp-terms-dialog-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.lp-terms-dialog-close svg {
  width: 20px;
  height: 20px;
}

.lp-terms-dialog-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  color: var(--text-primary);
  line-height: 1.7;
}

.lp-terms-dialog-body h2 {
  font-size: 1.1rem;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.lp-terms-dialog-body h2:first-child {
  margin-top: 0;
}

.lp-terms-dialog-body p {
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

.lp-terms-dialog-body ul,
.lp-terms-dialog-body ol {
  margin-bottom: 1rem;
  padding-right: 1.5rem;
  color: var(--text-secondary);
}

.lp-terms-dialog-body li {
  margin-bottom: 0.35rem;
}

/* Full screen on mobile */
@media (max-width: 768px) {
  .lp-terms-dialog-overlay {
    padding: 0;
  }

  .lp-terms-dialog {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .lp-footer {
    padding: 1rem;
  }

  .lp-footer-content {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }

  .lp-footer-logo img {
    height: 40px;
  }

  .lp-footer-links {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }
}

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

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

  .lp-grid .lp-logo {
    width: 90px;
    height: 90px;
  }

  .lp-confirmation,
  .lp-error {
    padding: 2rem 1rem;
  }
}

/* Smooth transitions for theme changes */
.lp-container,
.lp-footer,
.lp-form input,
.lp-form select,
.lp-form textarea,
.lp-box {
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease;
}

.text-left {
  text-align: left;
}
