/* --------------------- Reset & Base --------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #f9f9f9;
  color: #1a1a1a;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------- Hidden utility --------------------- */
.hidden {
  display: none !important;
}

.fade-out {
  opacity: 0;
  transition: opacity 0.6s ease;
}

/* --------------------- Main Content --------------------- */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px;
}

/* --------------------- Hero Section --------------------- */
.hero-section {
  background: linear-gradient(135deg, #eef3f9 0%, #ffffff 100%);
  border-radius: 15px;
  padding: 10px 20px;
  text-align: center;
  margin-bottom: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.hero-content h2 {
  font-size: 2.2rem;
  color: #1a3e5c;
  margin-bottom: 20px;
  font-weight: 600;
}

.hero-content h1 {
  font-size: 2.2rem;
  color: #1a3e5c;
  margin-bottom: 20px;
  font-weight: 600;
}

.hero-content p {
  font-size: 1rem;
  color: #666;
  max-width: 600px;
  margin: 0 auto 30px;
}

.format-support {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 20px;
}

/* --------------------- Converter Section --------------------- */
.converter-section {
  background: white;
  border-radius: 15px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}

/* --------------------- Guide Card --------------------- */
.guide-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: white;
  padding: 10px 20px;
  border-radius: 25px;
  margin-top: 10px;
  margin-bottom: 20px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.guide-card:hover {
  background: #eef3fb;
  transform: translateY(-2px);
  border-color: #d0d8e3;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.guide-card a {
  text-decoration: none;
  color: #1a3e5c;
  font-weight: 600;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* --------------------- Drop Area --------------------- */
.drop-area {
  border: 2px solid transparent;
  padding: 15px 20px;
  border-radius: 12px;
  background: linear-gradient(white, white) padding-box,
    linear-gradient(135deg, #1a3e5c, #42a5f5) border-box;
  cursor: pointer;
  margin: 0 auto 10px auto;
  transition: all 0.3s ease;
  max-width: 500px;
  text-align: center;
  position: relative;
}

.drop-area.highlight {
  background-color: #eaf6ff;
  border-color: #1976d2;
  box-shadow: 0 10px 30px rgba(25, 118, 210, 0.1);
}

.drop-icon {
  font-size: 2rem;
  margin-bottom: 10px;
  opacity: 0.7;
}

.drop-area p {
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: #666;
}

.muted {
  color: #888;
  font-size: 0.85rem;
}

.drop-area.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  border-color: #ccc;
  background-color: #f5f5f5;
}

.drop-area.disabled:hover {
  transform: none;
  border-color: #ccc;
  background-color: #f5f5f5;
}

.file-label {
  display: inline-block;
  padding: 10px 25px;
  background: #1976d2;
  color: white;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.file-label:hover {
  background: #115293;
  transform: translateY(-2px);
}

.file-label.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #ccc;
}

.file-label.disabled:hover {
  background-color: #ccc;
  transform: none;
}

.file-name {
  display: block;
  margin-top: 10px;
  color: #666;
  font-style: italic;
}

.file-name.has-file {
  color: #1976d2;
  font-weight: 600;
  font-style: normal;
}

#fileInput {
  display: none;
}

/* Drop Area Disabled State */
.drop-area.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  border-color: #ccc;
  background: linear-gradient(white, white) padding-box,
    linear-gradient(135deg, #ccc, #999) border-box;
}

.drop-area.disabled .file-label {
  background: #ccc;
  cursor: not-allowed;
}

.drop-area.disabled .file-label:hover {
  background: #ccc;
  transform: none;
}

.drop-area.disabled .drop-icon,
.drop-area.disabled p {
  opacity: 0.7;
}

/* --------------------- Action Buttons --------------------- */
.action-buttons {
  text-align: center;
  margin-top: 30px;
  width: 100%;
}

/* --------------------- Download Button --------------------- */
.export-btn {
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
  border: none;
  padding: 15px 40px;
  font-size: 1.1rem;
  font-weight: 400;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
  display: inline-block;
  margin: 0 auto;
}

.export-btn:hover {
  background: linear-gradient(135deg, #218838, #1e9e8a);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
}

.export-btn:active {
  transform: translateY(-1px);
}

/* Ensure it's visible when not hidden */
.export-btn:not(.hidden) {
  display: inline-block;
}

/* --------------------- Offline Warning --------------------- */
.offline-warning {
  background: #fff3cd;
  border-radius: 8px;
  padding: 8px 16px;
  max-width: 100%;
  margin: 10px auto 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  animation: slideDown 0.6s ease, blinkSoft 2s infinite;
  box-sizing: border-box;
  text-align: center;
}

@keyframes blinkSoft {
  0%,
  100% {
    background-color: #fff3cd;
  }
  50% {
    background-color: #ffeeba;
  }
}

/* Icon */
.offline-icon {
  font-size: 1.2rem;
  color: #ff9800;
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

/* Text container - now horizontal */
.offline-content {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  line-height: 1.3;
  flex-wrap: wrap;
  justify-content: center;
}

/* Title inline with text */
.offline-content strong {
  color: #856404;
  margin: 0;
  white-space: nowrap;
  animation: slideDown 0.6s ease, blinkSoft 2s infinite;
}

.offline-content p {
  color: #856404;
  margin: 0;
  font-size: 0.75rem;
  display: inline;
}

/* Animation definitions */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* --------------------- Security Section --------------------- */
.security-section {
  background: #fff3cd; /* same as offline-warning */
  border-radius: 8px;
  padding: 8px 16px;
  max-width: 100%;
  margin: 10px auto 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  animation: slideDown 0.6s ease, blinkSoft 2s infinite; /* same blinking animation */
  box-sizing: border-box;
  text-align: center;
}

/* Inner warning box now simplified */
.warning-box {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 800px;
  margin: 0 auto;
}

/* Icon consistent with offline icon */
.warning-icon {
  font-size: 1.2rem;
  color: #ff9800;
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

/* Content text styling consistent with offline-content */
.warning-content {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.75rem;
  line-height: 1.3;
  justify-content: center;
  color: #856404;
}

.warning-content strong {
  color: #856404;
  text-align: center;
  margin: 0;
  white-space: nowrap;
  animation: slideDown 0.6s ease, blinkSoft 2s infinite;
}

.warning-content p {
  margin: 0;
  text-align: center;
  font-size: 0.75rem;
  display: inline;
  color: #856404;
}

/* --------------------- Info icon (tooltip trigger) --------------------- */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #007bff;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  margin-left: 6px;
  line-height: 1;
  transition: background-color 0.18s ease;
}

.info-icon:hover {
  background-color: #0056b3;
}

/* --------------------- Tooltip styles --------------------- */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 260px;
  background-color: #333;
  color: #fff;
  text-align: left;
  border-radius: 6px;
  padding: 8px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  font-size: 0.85em;
  line-height: 1.3em;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* --------------------- Floating Button --------------------- */
.floating-btn {
  position: fixed;
  top: 30px;
  right: 30px;
  z-index: 1000;
  background: linear-gradient(135deg, #1976d2, #42a5f5);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  font-size: 30px;
  cursor: pointer;
  box-shadow: 0 5px 20px rgba(25, 118, 210, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.floating-btn:hover {
  transform: rotate(20deg) scale(1.1);
  box-shadow: 0 8px 25px rgba(25, 118, 210, 0.4);
}

/* --------------------- Floating M&N --------------------- */
.floating-mn {
  position: fixed;
  top: 30px;
  left: 30px;
  z-index: 1000;
  background: linear-gradient(135deg, #1976d2, #42a5f5);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 5px 20px rgba(25, 118, 210, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.floating-mn:hover {
  transform: rotate(-20deg) scale(1.1);
  box-shadow: 0 8px 25px rgba(25, 118, 210, 0.4);
}

/* --------------------- Message --------------------- */
#message {
  font-weight: 500;
  margin-top: 10px;
  padding: 8px 0;
  min-height: 20px;
  text-align: center;
  width: 100%;
}

.error-message {
  background: #ffe6e6;
  color: #d63031;
  border: 1px solid #ff7675;
  padding: 1rem;
  border-radius: 10px;
  margin: 1rem 0;
}

.warning-message {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
  padding: 1rem;
  border-radius: 10px;
  margin: 1rem 0;
}

.success-message {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  padding: 1rem;
  border-radius: 10px;
  margin: 1rem 0;
}

/* --------------------- Group Container --------------------- */
#groupContainer {
  text-align: center;
  margin: 30px auto;
  max-width: 600px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.4s ease;
}

#groupContainer label {
  display: block;
  margin-bottom: 15px;
  font-weight: 600;
  color: #1a3e5c;
  font-size: 1.1rem;
  text-align: center;
}

#groupContainer:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
}

#groupInput {
  display: block;
  margin: 0 auto 15px auto;
  padding: 12px 20px;
  border: 2px solid #e2e6ea;
  border-radius: 8px;
  font-size: 1rem;
  width: 100%;
  max-width: 400px;
  transition: border-color 0.3s ease;
}

#groupInput:focus {
  outline: none;
  border-color: #1976d2;
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

#groupWarning {
  text-align: center;
  margin: 10px 0;
  color: red;
  font-weight: 600;
}

/* --------------------- Footer --------------------- */
footer {
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(135deg, #1a3e5c 0%, #2c5c8a 100%);
  color: white;
  text-align: center;
  padding: 15px 20px;
  z-index: 1000;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-main {
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 1rem;
}

.footer-sub {
  opacity: 0.8;
  font-size: 0.9rem;
}

main {
  padding-bottom: 100px;
}

/* --------------------- Results Container --------------------- */
#resultsContainer {
  margin-top: 2rem;
}

#previewTitle {
  color: #1a3e5c;
  margin: 40px 0 20px 0;
  font-size: 1.8rem;
  font-weight: 600;
  text-align: center;
  width: 100%;
}

#previewContainer {
  overflow-x: auto;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

/* --------------------- Table styles --------------------- */
#previewTable {
  width: 100%;
  border-collapse: collapse;
  background-color: #fff;
  font-family: "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: #1a1a1a;
}

#previewTable th,
#previewTable td {
  border: 1px solid #d0d7dd;
  padding: 8px 10px;
  vertical-align: top;
}

#previewTable th {
  background-color: #1976d2;
  color: #fff;
  font-weight: 600;
}

#previewTable tr:nth-child(even) {
  background-color: #f7fbff;
}

#previewTable td pre {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.4;
  padding: 4px 6px;
  background-color: #f4f7fa;
  border-radius: 4px;
  font-family: "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
}

#previewTable td pre span.correct {
  color: #155724;
  font-weight: 600;
}

/* --------------------- Table Column Widths --------------------- */
#previewTable th:nth-child(1),
#previewTable td:nth-child(1) {
  width: 5%;
  text-align: center;
}

#previewTable th:nth-child(2),
#previewTable td:nth-child(2) {
  width: 10%;
  text-align: center;
}

#previewTable th:nth-child(3),
#previewTable td:nth-child(3) {
  width: 25%;
}

#previewTable th:nth-child(4),
#previewTable td:nth-child(4) {
  width: 30%;
}

#previewTable th:nth-child(5),
#previewTable td:nth-child(5) {
  width: 5%;
  text-align: center;
}

#previewTable th:nth-child(6),
#previewTable td:nth-child(6) {
  width: 25%;
}

/* Validation styles */
.flag-present {
  color: #155724;
  font-weight: 400;
}

.flag-absent {
  color: #d63031;
  font-weight: 400;
}

.answer-cell {
  font-size: 0.9rem;
  text-align: center;
}

.validation-issue {
  color: #d63031;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.validation-issue:last-child {
  margin-bottom: 0;
}

/* --------------------- File Info --------------------- */
.file-info {
  text-align: center;
  margin-bottom: 20px;
}

.file-type-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0 10px;
}

.file-type-badge.txt {
  background: #e3f2fd;
  color: #1976d2;
  border: 1px solid #1976d2;
}

.file-type-badge.xlsx {
  background: #e8f5e8;
  color: #2e7d32;
  border: 1px solid #2e7d32;
}

.sheet-info {
  color: #666;
  font-style: italic;
  margin-top: 5px;
  display: block;
}

/* --------------------- Intro Steps --------------------- */
.intro-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, auto));
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin-bottom: 1.5rem;
}

.step-card {
  width: 70px;
  height: 70px;
  background: #f8f9fa;
  border-radius: 50%;
  margin: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.3s ease, background 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  cursor: default;
}

.step-card:hover {
  transform: translateY(-3px);
  background: #e9ecef;
}

.step-icon {
  width: 50px;
  height: 50px;
}

#toast-container {
  position: fixed;
  top: 25px;
  right: 25px;
  z-index: 10000;
  pointer-events: none;
}

.toast {
  background: #1a3e5c;
  color: white;
  padding: 18px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
  margin-bottom: 15px;
  max-width: 380px;
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.4s ease;
  border-left: 4px solid;
  pointer-events: auto; /* Add this to make toast clickable if needed */
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.success {
  background: #28a745;
  border-left-color: #1e7e34;
}
.toast.error {
  background: #dc3545;
  border-left-color: #c82333;
}
.toast.warning {
  background: #ffc107;
  color: #000;
  border-left-color: #e0a800;
}
.toast.info {
  background: #17a2b8;
  border-left-color: #138496;
}

/* --------------------- Header --------------------- */
.main-header {
  background: linear-gradient(135deg, #1a3e5c 0%, #2c5c8a 100%);
  color: white;
  padding: 10px 20px;
  text-align: center;
}

.header-content h1 {
  font-size: 1rem;
  font-weight: 300;
  margin-bottom: 10px;
}

.header-subtitle {
  font-size: 0.8rem;
  opacity: 0.9;
  max-width: 800px;
  margin: 0 auto;
}

/* Responsive */
@media (max-width: 768px) {
  .offline-warning {
    padding: 8px 12px;
    margin: 10px auto 15px auto;
  }

  .offline-icon {
    font-size: 1rem;
  }

  .offline-content {
    font-size: 0.7rem;
    gap: 6px;
  }

  .offline-content strong {
    font-size: 0.7rem;
  }
}
/* --------------------- Responsive Design --------------------- */
@media (max-width: 768px) {
  .hero-section {
    padding: 20px 20px;
  }

  .hero-content h1,
  .hero-content h2 {
    font-size: 1.8rem;
  }

  .converter-section {
    padding: 20px 20px;
  }

  .step-card {
    width: 60px;
    height: 60px;
    margin: 30px auto 20px auto;
  }

  .step-icon {
    width: 25px;
    height: 25px;
  }

  .drop-area {
    padding: 12px 15px;
  }

  .floating-btn {
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
  }

  #previewTable {
    font-size: 12px;
  }

  #previewTable th,
  #previewTable td {
    padding: 6px 8px;
  }

  .intro-steps {
    grid-template-columns: 1fr;
  }
}

/* --------------------- Format Guide Specific Styles --------------------- */

/* Guide Section */
.guide-section {
  background: white;
  border-radius: 15px;
  padding: 40px;
  margin-bottom: 40px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
  text-align: left;
}

.guide-intro {
  text-align: center;
  margin-bottom: 30px;
  font-size: 1.1rem;
  color: #666;
}

.guide-intro code {
  background: #f0f4f8;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  color: #1a3e5c;
}

/* Format Rules */
.format-rules {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 10px;
  margin-bottom: 30px;
  border-left: 4px solid #1a3e5c;
  border-right: 4px solid #1a3e5c;
}

.format-rules h3 {
  color: #1a3e5c;
  margin-bottom: 15px;
  font-size: 1.3rem;
}

.format-rules ul {
  list-style: none;
  padding: 0;
}

.format-rules li {
  padding: 8px 0;
  padding-left: 25px;
  position: relative;
  line-height: 1.4;
}

.format-rules li:before {
  content: "•";
  color: #1976d2;
  font-weight: bold;
  position: absolute;
  left: 0;
}

.format-rules em {
  color: #666;
  font-style: italic;
}

/* Example Container */
.example-container {
  margin-bottom: 30px;
}

.example-container h3 {
  color: #1a3e5c;
  margin-bottom: 15px;
  font-size: 1.3rem;
  text-align: center;
}

.example {
  background: #1a3e5c;
  color: #e0f7ff;
  padding: 25px;
  border-radius: 10px;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-x: auto;
  border: 1px solid #2c5c8a;
  margin: 0 auto;
  max-width: 800px;
}

/* Notes Section */
.notes {
  background: #fff3cd;
  border: 1px solid #ffeeba;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 30px;
}

.notes h3 {
  color: #856404;
  margin-bottom: 10px;
  font-size: 1.3rem;
}

.note-item {
  padding: 4px 0;
  border-bottom: 1px solid #ffeeba;
}

.note-item:last-child {
  border-bottom: none;
}

.note-item strong {
  color: #856404;
}

/* Back Button */
.back-btn {
  display: inline-block;
  padding: 12px 30px;
  background: linear-gradient(135deg, #6c757d, #868e96);
  color: white;
  text-decoration: none;
  border-radius: 50px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 3px 10px rgba(108, 117, 125, 0.3);
}

.back-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
  color: white;
  text-decoration: none;
}

/* Responsive Design for Format Guide */
@media (max-width: 768px) {
  .guide-section {
    padding: 25px 20px;
  }

  .format-rules,
  .notes {
    padding: 20px;
  }

  .example {
    padding: 20px;
    font-size: 13px;
  }
}
