/* Variables for consistent colors */
:root {
  --primary: #ff0000;
  --primary-hover: #cc0000;
  --primary-light: #ffcccc;
  --secondary: #0066ff;
  --secondary-hover: #0044cc;
  --secondary-light: #cce0ff;
  --yellow: #ffcc00;
  --yellow-light: #fff5cc;
  --text-dark: #222222;
  --text-light: #666666;
  --text-white: #ffffff;
  --bg-light: #f9f9f9;
  --bg-dark: #333333;
  --border-light: #dddddd;
  --error: #d50000;
  --success: #00aa00;
  --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  --card-bg: #ffffff;
  --card-border-radius: 12px;
  --card-padding: 25px;
  --error-rgb: 213, 0, 0;
}

/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Arial', sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
  line-height: 1.6;
  padding: 0;
  margin: 0;
  overflow-x: hidden;
  width: 100%;
}

/* Container styles */
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  padding: 20px;
}

.form-container {
  width: 100%;
  max-width: 1000px; /* Much wider to accommodate the full table */
  padding: 30px;
  transition: all 0.3s ease;
  overflow: hidden; /* Ensures internal content doesn't create unwanted scrollbars */
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Card styles - new style for each section */
.card {
  background-color: var(--card-bg);
  border-radius: var(--card-border-radius);
  box-shadow: var(--card-shadow);
  padding: var(--card-padding);
  width: 100%;
  margin-bottom: 0;
}

/* Header styles */
.header {
  text-align: center;
  margin-bottom: 25px;
}

.header h1 {
  color: var(--primary);
  font-size: 30px;
  font-weight: bold;
}

.header h1 i {
  margin-right: 10px;
  color: var(--primary);
}

/* Progress bar styles */
.progress-container {
  margin-bottom: 20px;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background-color: var(--border-light);
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--primary);
  border-radius: 5px;
  transition: width 0.5s ease;
}

.progress-text {
  text-align: center;
  margin-top: 10px;
  font-weight: bold;
  color: var(--text-dark);
}

/* Form group styles */
.form-group {
  margin-bottom: 25px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: var(--text-dark);
  font-size: 18px;
}

input {
  width: 100%;
  padding: 15px;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
}

input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Styled error message with link */
.error-message {
  color: var(--error);
  background-color: rgba(var(--error-rgb, 213, 0, 0), 0.1);
  padding: 15px;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
  margin: 15px 0;
  border: 1px solid rgba(var(--error-rgb, 213, 0, 0), 0.2);
  display: none;
}

.error-with-link {
  font-size: 16px;
  line-height: 1.5;
}

.error-with-link a {
  color: var(--primary);
  text-decoration: none;
  font-weight: bold;
  transition: color 0.2s ease, text-decoration 0.2s ease;
  display: inline-block;
  margin-top: 8px;
}

.error-with-link a:hover {
  text-decoration: underline;
  color: var(--primary-hover);
}

/* Button styles */
.btn {
  display: block;
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s;
  text-align: center;
}

.primary-btn {
  background-color: var(--primary);
  color: var(--text-white);
}

.primary-btn:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

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

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

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

/* Step container styles */
.step-container {
  transition: all 0.5s ease;
}

/* Response message styles */
.response-message {
  padding: 15px 0;
  margin-bottom: 25px;
  font-size: 2.5em;
  font-weight: bold;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--primary);
}

.intro-message {
  background-color: var(--bg-light);
  padding: 20px;
  margin-bottom: 25px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-dark);
}

/* Gender cards styles */
.gender-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 20px;
}

.gender-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}

.gender-card:hover {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.gender-card.selected {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.gender-card i {
  font-size: 30px;
  margin-bottom: 10px;
}

.gender-card[data-gender="male"] i {
  color: var(--secondary);
}

.gender-card[data-gender="female"] i {
  color: var(--primary);
}

/* Contact options styles */
.contact-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 15px;
}

.contact-option {
  display: flex;
  align-items: center;
  padding: 10px;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}

.contact-option:hover {
  border-color: var(--primary);
}

.contact-option.selected {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.contact-option i {
  margin-right: 10px;
}

/* Contact inputs styles */
.contact-inputs {
  margin-bottom: 25px;
}

.contact-input-group {
  margin-bottom: 15px;
}

/* Loading animation */
.loading {
  text-align: center;
  padding: 30px;
  display: none;
}

.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 0, 0, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 10px;
}

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

/* Results section styling with separate cards */
#results {
  display: flex;
  flex-direction: column;
  gap: 25px;
  width: 100%;
}

#output {
  display: flex;
  flex-direction: column;
  gap: 25px;
  width: 100%;
}

/* Results table container styling */
.results-table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Match card styling */
#results h2, 
.card h2 {
  color: var(--text-dark);
  margin-bottom: 20px;
  text-align: center;
  font-size: 1.8em;
}

/* Social share card styling - updated for standalone card */
.social-share-card {
  padding: 30px;
  text-align: center;
  border-left: 4px solid var(--primary);
  background: linear-gradient(to right, var(--primary-light) 0%, white 15%);
}

.social-share-title {
  font-size: 1.8em !important;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 20px;
  line-height: 1.2;
}

.social-share-description {
  font-size: 1.1em;
  line-height: 1.5;
  color: var(--text-dark);
  margin-bottom: 25px;
}

/* ProTip card styling - updated for standalone card */
.protip-card {
  padding: 30px;
  background: linear-gradient(to right, var(--secondary-light) 0%, white 15%);
  border-left: 4px solid var(--secondary);
}

.protip-title {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--secondary);
  font-weight: bold;
}

/* Table Styles */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  margin-top: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  overflow: hidden;
  table-layout: fixed;
}

thead {
  background-color: var(--primary);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}

th {
  font-weight: 600;
}

tr:last-child td {
  border-bottom: none;
}

tr:nth-child(even) {
  background-color: var(--bg-light);
}

.match-icon {
  font-size: 1.25rem;
  margin-right: 0.5rem;
  color: var(--yellow);
}

.match-pill {
  display: inline-flex;
  align-items: center;
  background-color: var(--primary-light);
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.875rem;
  margin: 0.25rem;
  white-space: nowrap;
}

.match-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background-color: var(--primary);
  color: white;
  font-weight: bold;
}

.match-count-title {
  margin: 0;
  font-size: 1em;
}

/* Match Styles */
.match-row-romantic {
  background-color: #d0f0c0;
}

/* Define column widths */
th:nth-child(1), td:nth-child(1) { width: 15%; } /* Super Compatibilities */
th:nth-child(2), td:nth-child(2) { width: 15%; } /* Contact 1 */
th:nth-child(3), td:nth-child(3) { width: 15%; } /* Contact 2 */
th:nth-child(4), td:nth-child(4) { width: 10%; } /* Gender */
th:nth-child(5), td:nth-child(5) { width: 10%; } /* City */
th:nth-child(6), td:nth-child(6) { width: 10%; } /* Count */
th:nth-child(7), td:nth-child(7) { width: 25%; } /* Matches */

td {
  overflow: hidden;
  text-overflow: ellipsis;
  word-wrap: break-word;
}

/* Social Share Card Styles */
.social-share-card {
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 30px;
  margin-top: 40px;
  margin-bottom: 30px;
  text-align: center;
  border: 2px solid var(--primary-light);
}

.social-share-title {
  font-size: 2em;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 20px;
  line-height: 1.2;
}

.social-share-description {
  font-size: 1.2em;
  line-height: 1.5;
  color: var(--text-dark);
  margin-bottom: 30px;
}

.social-share-button-container {
  display: flex;
  justify-content: center;
}

.seek-btn {
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 30px;
  padding: 12px 40px;
  font-size: 1.2em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(255, 0, 0, 0.25);
}

.seek-btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(255, 0, 0, 0.3);
}

.seek-btn i {
  margin-right: 10px;
  font-size: 1.1em;
}

/* Copy Popup Styles */
.copy-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background-color: rgba(0, 0, 0, 0.85);
  color: white;
  border-radius: 12px;
  padding: 0;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  max-width: 90%;
  width: 350px;
}

.copy-popup.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.copy-popup-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  text-align: center;
}

.copy-popup i {
  font-size: 42px;
  color: var(--primary);
  margin-bottom: 15px;
}

.copy-popup p {
  font-size: 18px;
  margin: 0;
  line-height: 1.4;
  font-weight: 500;
}

/* Language Selector */
.language-selector {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  gap: 10px;
}

.lang-btn {
  padding: 8px 16px;
  border: 2px solid var(--primary);
  border-radius: 20px;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.lang-btn:hover {
  background-color: var(--primary-light);
}

.lang-btn.active {
  background-color: var(--primary);
  color: white;
}

/* Footer Styles */
.footer {
  background-color: var(--bg-dark);
  color: var(--text-light);
  padding: 2rem 0;
  margin-top: 3rem;
  border-top: 1px solid var(--border-light);
}

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

.footer-section h3 {
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.footer-section a {
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.3s ease;
}

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

.footer-section p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

/* Language Toggle Styles */
.lang-en, .lang-ko {
  display: inline;
}

.lang-en.hidden, .lang-ko.hidden {
  display: none;
}

/* Code Window Styles - NEW */
.code-window {
  background-color: #f5f5f5;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  font-family: 'Courier New', monospace;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #e0e0e0;
  padding: 8px 15px;
  border-bottom: 1px solid #ccc;
}

.code-title {
  font-weight: bold;
  color: #333;
}

.copy-code-btn {
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background-color 0.2s;
}

.copy-code-btn:hover {
  background-color: var(--primary-hover);
}

.copy-code-btn i {
  font-size: 0.9rem;
}

.code-content {
  padding: 15px;
  overflow-x: auto;
  background-color: #fff;
}

.code-content pre {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.code-content code {
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  color: #333;
  line-height: 1.5;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .form-container {
    padding: 15px;
    margin: 10px;
    width: calc(100% - 20px);
    max-width: none;
    gap: 20px;
  }
  
  .card {
    padding: 20px;
  }
  
  .gender-cards,
  .contact-options {
    grid-template-columns: 1fr;
  }
  
  th, td {
    padding: 8px 6px;
    font-size: 0.8rem;
  }
  
  .match-pill {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
  }
  
  .match-icon {
    font-size: 1rem;
  }
  
  /* Improve table display on mobile */
  table {
    min-width: 500px; /* Ensure horizontal scrolling on mobile */
  }
  
  /* Improve form elements on mobile */
  input {
    padding: 12px;
    font-size: 14px;
  }
  
  .btn {
    padding: 12px;
    font-size: 16px;
  }
  
  label, h2 {
    font-size: 16px;
  }
  
  .social-share-title {
    font-size: 1.5em !important;
  }
  
  .social-share-description {
    font-size: 1em;
  }
  
  .seek-btn {
    padding: 10px 30px;
    font-size: 1em;
  }
  
  .copy-popup {
    width: 300px;
  }
  
  .copy-popup i {
    font-size: 36px;
  }
  
  .copy-popup p {
    font-size: 16px;
  }
  
  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .footer-section {
    padding: 1rem 0;
  }
  
  .language-selector {
    top: 10px;
    right: 10px;
  }
  
  .lang-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .protip-card {
    padding: 20px;
  }
  
  .protip-title {
    font-size: 1.3rem;
  }
  
  .protip-content {
    padding: 1rem;
  }
  
  .protip-content p {
    font-size: 0.95rem;
  }
  
  .code-window {
    margin-bottom: 1rem;
  }
  
  .code-header {
    padding: 6px 10px;
  }
  
  .code-content {
    padding: 10px;
  }
  
  .copy-code-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
  }
  
  #output {
    gap: 20px;
  }
}
  
/* Landscape orientation for mobile */
@media (max-width: 896px) and (orientation: landscape) {
  .container {
    padding: 10px 0;
  }
  
  .form-container {
    padding: 15px;
    margin: 0 10px;
    gap: 15px;
  }
  
  .card {
    padding: 15px;
  }
  
  .progress-container {
    margin-bottom: 15px;
  }
  
  .form-group {
    margin-bottom: 12px;
  }
  
  /* Two-column layout for gender and contact options in landscape */
  .gender-cards,
  .contact-options {
    grid-template-columns: 1fr 1fr;
  }
}
  
/* Tablet specific styles */
@media (min-width: 769px) and (max-width: 1024px) {
  .form-container {
    max-width: 700px;
    padding: 25px;
    gap: 25px;
  }
  
  .card {
    padding: 20px;
  }
  
  table {
    min-width: 650px;
  }
}
  
/* Extra large screens */
@media (min-width: 1200px) {
  .form-container {
    max-width: 1200px; /* Even wider for large screens */
    gap: 40px;
  }
  
  .card {
    padding: 30px;
  }
  
  .container {
    padding: 30px;
  }
}