/* =====================
   Root Variables
   ===================== */
:root {
    --text-base: #212529;
    --text-muted: #666363;
    --text-accent: #0c9244;
    --button-primary: #212529;
    --button-text: #fff;
    --button-primary-hover: #0c9244;
    --button-primary-active: #075025;
    --button-primary-disabled: #6c757d;
    --white: #fff;
    --black: #000;
    --table-even: #f6f6f6;
    --table-hover: #88dda98f;
    --table-head: #f8f9faaf;
    --danger: #c0392b;
}

/* =====================
   Global Styles & Reset
   ===================== */
body, html {
  width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
  font-family: "Roboto", sans-serif;
  font-optical-sizing: auto;
  font-style: normal;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

li {
    list-style: none;
}

/* =====================
   Typography
   ===================== */
h1, p {
    margin: 0;
    color: var(--text-base);
    text-align: center;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-condensed {
    font-family: "Roboto Condensed", sans-serif;
    font-optical-sizing: auto;
    font-style: normal;
}

.text-small {
    font-size: 0.875rem !important;
}

/* =====================
   Links
   ===================== */
a {
    text-decoration: none;
    color: var(--text-base);
}
a:hover {
    text-decoration: underline;
    color: var(--text-accent);
}   

/* =====================
   Header
   ===================== */
header {
    margin: 4rem 0;
}

/* =====================
   Buttons & Inputs
   ===================== */
button, input[type="submit"] {
    background-color: var(--button-primary);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: var(--button-text);
}
button:hover, input[type="submit"]:hover {
    background-color: var(--button-primary-hover);
}
button:active, input[type="submit"]:active {
    background-color: var(--button-primary-active);
}
button:disabled, input[type="submit"]:disabled {
    background-color: var(--button-primary-disabled);
    cursor: not-allowed;
    opacity: 0.3;
}
input[type="file"] {
    display: none;
}

button:focus, input[type="submit"]:focus, input[type="file"]:focus {
    outline: 3px solid var(--text-accent);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px var(--text-accent);
    z-index: 2;
}

/* =====================
   File Upload
   ===================== */
.file-upload {
    display: flex;
    margin: 1rem auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px dashed var(--text-muted);
    padding: 1rem;
    width: 75%;
    max-width: 600px;
    border-radius: 4px;
    background-color: var(--white);
}
.file-upload input[type="file"] {
    display: none;
}
.file-upload.drag-over {
    border-color: var(--text-accent);
    background-color: #e6f8ee;
    box-shadow: 0 0 0 2px var(--text-accent);
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

#drop {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* =====================
   Export Section
   ===================== */
.export {
    margin: 2rem 0;
    flex-grow: 1;
}

/* =====================
   Footer
   ===================== */
footer {
    background-color: #eee;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    bottom: 0;
}
footer ul {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    width: 100%;
}
footer li {
    list-style: none;
}

/* =====================
   Responsive Table Container
   ===================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 2rem 0;
}

/* =====================
   SheetJS Table Styles
   ===================== */
.sheetjs-table {
  width: 80%;
  padding: 1rem;
  max-width: 900px;
  border-collapse: collapse;
  margin: 0 auto;
  font-family: "Roboto", "Roboto Condensed", sans-serif;
  overflow: hidden;
}
#htmlout {
    padding: 1rem;
}
.sheetjs-table caption {
  caption-side: top;
  font-family: "Roboto Condensed", sans-serif;
  font-size: 1.2rem;
  color: var(--text-accent);
  padding: 0.5rem;
  letter-spacing: 0.05em;
}
.sheetjs-table thead {
  background: var(--table-head);
}
.sheetjs-table th, .sheetjs-table td {
  padding: 0.25rem 1rem;
  border: 1px solid var(--text-muted);
  text-align: left;
  font-size: 1rem;
}
.sheetjs-table th {
  color: var(--text-base);
  font-family: "Roboto Condensed", sans-serif;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.sheetjs-table tbody tr:nth-child(even) {
  background: var(--table-even);
}
.sheetjs-table tbody tr:hover {
  background: var(--table-hover);
}

/* =====================
   File Status/Loaded/Unload
   ===================== */
.file-status {
  margin-top: 10px;
  font-size: 1rem;
  color: var(--gray-888);
  min-height: 1.5em;
  transition: color 0.2s;
}
.file-loaded {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1em;
}
.unload-btn:hover {
  background: var(--danger);
  color: var(--white);
}

/* =====================
   Sheet Tabs
   ===================== */
.sheetjs-tab-container {
  display: flex;
  gap: 0.5rem;
  margin: 1rem auto 0.5rem auto;
  justify-content: center;
}
.sheetjs-tab-btn {
  background: var(--button-primary);
  border: none;
  padding: 0.5rem 1.2rem;
  border-radius: 6px 6px 0 0;
  font-family: "Roboto Condensed", sans-serif;
  font-size: 1rem;
  color: var(--button-text);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  outline: none;
  position: relative;
  top: 2px;
  box-shadow: 0 2px 6px rgba(12, 146, 68, 0.05);
  opacity: 0.94;
}
.sheetjs-tab-btn.active, .sheetjs-tab-btn:focus {
  background: var(--text-accent);
  color: var(--white);
  z-index: 2;
  opacity: 1;
  box-shadow: 0 4px 12px rgba(12, 146, 68, 0.12);
}
.sheetjs-tab-btn:hover:not(.active) {
  background: var(--button-primary-hover);
  color: var(--white);
  opacity: 1;
}
.sheetjs-tab-content {
  width: 100%;
}

/* Spinner Styles */
.spinner-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.spinner {
  border: 6px solid #f3f3f3;
  border-top: 6px solid var(--text-accent);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* =====================
   Media Queries
   ===================== */
@media (max-width: 700px) {
  .sheetjs-table th, .sheetjs-table td {
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
  }
  .sheetjs-table caption {
    font-size: 1rem;
    padding: 0.25rem;
  }
}