/* ===== Core Variables ===== */
:root {
  /* Default (Light) Theme */
  --primary: #1e3a5f;
  --primary-dark: #142c47;
  --primary-light: #345b88;

  --secondary: #2563eb;
  --secondary-dark: #1d4ed8;
  --secondary-light: #60a5fa;

  --light: #ffffff;
  --dark: #1a202c;

  --text-light: #2d3748;
  --border: #cbd5e0;

  --success: #059669;
  --error: #dc2626;
  --warning: #d97706;
  --info: #2563eb;

  --bg-light: #f9fafb;
  --bg-dark: #ffffff;
}

[data-theme="dark"] {
  /* Dark Theme Overrides */
  --light: #f7fafc;
  --dark: #0f172a;

  --text-light: #cbd5e1;
  --border: #334155;

  --bg-light: #1e293b;
  --bg-dark: #0f172a;
}

/* ===== Base Styles ===== */
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  line-height: 1.6;
  color: var(--text-light);
  background-color: var(--bg-dark);
  margin: 0;
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

main {
  padding: 2rem 0;
  min-height: 70vh;
}

/* ===== Header/Navigation ===== */
header {
  background: var(--primary);
  padding: 1rem 0;
  position: relative;
}

nav {
  display: flex;
  justify-content: center;
}

nav ul {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 1.5rem;
  transition: transform 0.3s ease;
}

nav a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background 0.2s;
  display: block;
}

/* Hamburger Menu */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  position: absolute;
  right: 1rem;
  top: 1rem;
  z-index: 101;
}

/* ===== Mobile Navigation ===== */
@media (max-width: 768px) {
  nav {
    justify-content: flex-start;
  }
  
  nav ul {
    position: fixed;
    top: 0;
    left: 0;
    width: 40%;
    height: 100vh;
    background: var(--primary-dark);
    flex-direction: column;
    padding: 4rem 1.5rem 1rem;
    transform: translateX(-100%);
    z-index: 100;
    gap: 0;
    /* Reset all possible alignment conflicts */
    align-items: initial;
    justify-content: initial;
    text-align: initial;
  }
  
  nav ul.active {
    transform: translateX(0);
  }
  
  /* Force left alignment at the link level */
  nav li {
    width: 100%;
    text-align: left;
    display: block;
  }
  
  nav a {
    display: block;
    padding: 1rem 0;
    border-radius: 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: left !important; /* Last resort for text only */
    margin: 0 !important; /* Last resort for spacing */
    width: 100%;
  }
  
  .menu-toggle {
    display: block;
  }
  
  .nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
  }
  
  .nav-overlay.active {
    opacity: 1;
    visibility: visible;
  }
}

footer {
  background: var(--primary);
  color: white;
  text-align: center;
  padding: 2rem 0;
  margin-top: 3rem;
}

/* ===== Typography ===== */
h1, h2, h3 {
  color: var(--primary);
  margin-top: 0;
  line-height: 1.3;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 2rem;
}

/* ===== Form Styles ===== */
.form-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2.5rem;
  background: var(--bg-light);
  color: var(--text-light);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-light);
}

input,
select,
textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  background: var(--bg-light);
  color: var(--text-light);
  border-radius: 6px;
  font-size: 1rem;
  transition: all 0.2s;
  font-family: inherit;
}

input::placeholder,
textarea::placeholder {
  color: rgba(203, 213, 224, 0.6);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23cbd5e1'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1em;
  padding-right: 2.5rem;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Buttons */
.btn-submit,
button[type="submit"] {
  background: var(--secondary);
  color: white;
  border: none;
  padding: 1rem;
  font-size: 1.1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
  width: 100%;
  display: block;
}

.btn-submit:hover,
button[type="submit"]:hover {
  background: var(--secondary-dark);
  transform: translateY(-2px);
}

button:disabled,
.btn-submit:disabled {
  background: #4b5563;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Outline Button */
.btn-outline {
  background: transparent;
  color: var(--secondary);
  border: 2px solid var(--secondary);
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.btn-outline:hover {
  background: var(--secondary);
  color: white;
}

/* Copy Button */
.btn-copy {
  background: var(--secondary-dark);
  color: white;
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-copy:hover {
  background: var(--secondary);
  transform: translateY(-2px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.btn-copy:active {
  transform: scale(0.98);
}

.btn-copy::after {
  content: "⎘";
  font-size: 1.1em;
  margin-left: 4px;
}

/* ===== Form Utilities ===== */
.hp-field {
  position: absolute;
  left: -9999px;
}

.response-message {
  margin-top: 2rem;
  padding: 1rem;
  border-radius: 6px;
  text-align: center;
}

.response-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.response-error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

/* ===== Markdown Content ===== */
.markdown-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
  line-height: 1.7;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
  margin: 2rem 0 1rem;
  color: var(--text-light);
}

.markdown-content p {
  margin: 1.5rem 0;
}

.markdown-content ul,
.markdown-content ol {
  margin: 1.5rem 0;
  padding-left: 2rem;
}

.markdown-content li {
  margin: 0.5rem 0;
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
}

.markdown-content th,
.markdown-content td {
  padding: 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}

.markdown-content th {
  background: var(--primary);
  color: white;
}

.markdown-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2rem auto;
  border-radius: 4px;
}

.markdown-content blockquote {
  border-left: 4px solid var(--secondary);
  padding: 0 1rem;
  margin: 2rem 0;
  color: var(--text-light);
  font-style: italic;
}

.markdown-content pre {
  background: var(--bg-dark);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
}

.markdown-content code {
  font-family: monospace;
  background: var(--bg-dark);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
}

/* ===== CTA Styles ===== */
.cta-section {
  margin-top: 2.5rem;
  text-align: center;
}

.cta-button {
  display: inline-block;
  background: var(--secondary);
  color: white;
  padding: 1rem 2rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
}

.cta-button:hover {
  background: var(--secondary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* ===== Theme Toggle ===== */
.theme-toggle {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 100;
  background: var(--secondary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background: var(--secondary-dark);
  transform: scale(1.1);
}

.theme-toggle i {
  font-size: 1.5rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  html {
    font-size: 15px;
  }

  .container {
    padding: 0 1rem;
  }

  .form-container {
    padding: 1.5rem 1rem;
  }

  .markdown-content {
    padding: 0 0.5rem;
  }

  input, select, textarea {
    padding: 0.75rem;
  }

  h1 {
    font-size: 2rem;
  }

  nav ul {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }

  .theme-toggle {
    width: 2.5rem;
    height: 2.5rem;
    bottom: 0.5rem;
    right: 0.5rem;
  }
  
   .menu-toggle {
    color: white; /* Ensures visibility against dark header */
    background: var(--primary); /* Match header background */
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
  } 
  
}


/* Small mobile devices (portrait) */
@media (max-width: 480px) {
    
   .date-select-group {
    flex-direction: column;
    gap: 0.75rem;
  }
  .container {
    padding: 0 0.75rem;
  }

  .form-container {
    padding: 1.25rem 0.75rem;
  }

  .markdown-content {
    padding: 0 0.25rem;
  }

  h1 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
  }
}

/* ===== Toggle Switch Only Update ===== */
.submission-toggle {
  margin-bottom: 2rem;
  padding: 0.75rem 1rem;
  background: rgba(37, 99, 235, 0.05);
  border-radius: 6px;
  border: 1px solid rgba(37, 99, 235, 0.1);
}

.toggle-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: .2s;
  border-radius: 11px;
}

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

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

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

.toggle-label {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-light);
}

/* ===== Date Selector Only Update ===== */
.date-select-group {
  display: flex;
  gap: 1rem;
}

.date-select-group select {
  flex: 1;
}

/* Success notification styles */
.success-notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--success);
  color: white;
  padding: 15px 25px;
  border-radius: 5px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 15px;
  animation: slideIn 0.3s ease-out;
  max-width: 400px;
}

.success-notification a {
  color: white;
  text-decoration: underline;
  font-weight: bold;
}

.success-notification a:hover {
  opacity: 0.9;
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.success-notification.fade-out {
  animation: fadeOut 0.5s ease-out forwards;
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateY(20px); }
}