/* Root Color System */
:root {
  /* Blues - primary action colors */
  --primary-50:  #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;
  --primary-950: #1d3660;

  /* Greys - structure, backgrounds, and text */
  --neutral-50:  #f9fafb;
  --neutral-100: #f3f4f6;
  --neutral-200: #e5e7eb;
  --neutral-300: #d1d5db;
  --neutral-400: #9ca3af;
  --neutral-500: #6b7280;
  --neutral-600: #4b5563;
  --neutral-700: #374151;
  --neutral-800: #1f2937;
  --neutral-900: #111827;
  --neutral-950: #0b0f19;

  /* Accent color (legacy compatibility) */
  --accent:       var(--primary-500);
  --accent-light: var(--primary-300);

  /* Legacy mappings (preserved for compatibility) */
  --bg-dark:       var(--neutral-900);
  --card-bg:       var(--neutral-800);
  --text-main:     var(--neutral-50);
  --text-secondary: var(--neutral-300);
  --border-light:  var(--neutral-600);
  --row-alt:       var(--neutral-800);
}

/* Updated styles continue below using the new root system */

body {
  margin: 0;
  /*font-family: 'Inter', sans-serif;*/
  /*font-family: 'Source Sans Pro', sans-serif;*/
  font-family: 'Source Sans Pro', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  display: flex;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  flex-direction: column;
  max-width: 1800px;
  margin: 0 auto;
}

h1, h2, h3 {
  font-family: 'Source Sans Pro', sans-serif;
}

.sidebar {
  width: clamp(280px, 22%, 360px);   /* Responsive width with safe bounds */
  background-color: var(--neutral-900);
  font-family: 'Source Sans Pro', sans-serif;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;                   /* Prevent shrinking on narrow screens */
  gap: 1.5rem;                      /* Space between elements inside */
  border-radius: 12px;
  
}


.sidebar h1 {
  color: var(--accent);
  font-size: 2.0rem;
  margin-bottom: 40px;
}

.sidebar .input-box {
  margin-bottom: 20%;
  
}

.sidebar label {
  font-size: 1.1rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
  font-weight: bold;
  font-family: 'IBM Plex Mono', monospace;
}

.sidebar input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--neutral-800);
  color: var(--text-main);
  font-weight: 600;
  font-size: 1.5rem;
}

.sidebar button:not(.tab-btn) {
  margin-top: 2rem;
  width: 100%;
  padding: 12px;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: var(--neutral-50);
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.3s ease;
  
}

.sidebar button:not(.tab-btn):hover {
  background: var(--accent-light);
}

.main {
  flex-grow: 1;
  padding: 30px;
}

.main h2 {
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 20px;
}

/* =============================
   Table Styling - Cleaner Look
   ============================= */

table {
  width: 100%;
  border-collapse: collapse;
  background-color: #111827;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 30px;
  font-size: 1.2rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

th, td {
  padding: 10px 12px;
  text-align: center;
  font-size: 1rem;
}

th {
  background: inherit;
  color: var(--accent);
  font-weight: 600;
  font-size: 1.3rem;
  border-bottom: 1px solid var(--neutral-700);
}

td {
  background: var(--card-bg);
  border-bottom: 1px solid var(--neutral-700);
}

/* Remove zebra striping — cleaner look */
tbody tr:nth-child(even) td,
tbody tr:nth-child(odd) td {
  background-color: transparent;
}

/* Row hover effect for usability */
tbody tr:hover td {
  background-color: var(--neutral-500);
  transition: background-color 0.2s ease-in-out;
}

/* =============================
   Input Styling Inside Table
   ============================= */



input.quantity,
input.feet,
input.inches {
  width: 90%;
  padding: 10px 12px;
  font-size: 1.2rem;
  font-weight: bold;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background-color: var(--neutral-800);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s;
}

/* =============================
   Remove Button Style
   ============================= */

.removeRow {
  color: #f94144;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.1s ease-in-out;
}

.removeRow:hover {
  transform: scale(1.2);
}



.removeRow {
  background: transparent;
  border: none;
  color: #f94144;
  font-size: 2rem;
  cursor: pointer;
}

.removeRow::after {
  content: '\1F5D1';
}

#dropzone {
  border: 2px dashed var(--text-secondary);
  padding: 1.5rem;
  border-radius: 6px;
  text-align: center;
  color: var(--text-secondary);
  margin-top: 10px;
  cursor: pointer;
}

#optimizeCuts.glow {
  position: relative;
  overflow: hidden;
  background-color: #ffd700;
  color: black;
  border: none;
}

#optimizeCuts.glow::before {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.0) 0%,
    rgba(255, 255, 255, 0.5) 50%,
    rgba(255, 255, 255, 0.0) 100%
  );
  transform: skewX(-20deg);
  animation: shineGlint 2s infinite;
}

@keyframes shineGlint {
  0% { left: -75%; }
  50% { left: 125%; }
  100% { left: 125%; }
}



/* === Tab Header Bar === */
.tab-header {
  display: flex;
  background-color: transparent;
  margin-bottom: 0;
  position: relative;
  z-index: 1;
  
}

/* === Tab Buttons (default state) === */
.tab-btn {
  flex: 1;
  padding: 10px;
  font-size: 1.3rem;
  background-color: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 6px 6px 0 0;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  font-family: 'IBM Plex Mono', monospace;
}

.tab-btn:hover {
  background-color: var(--neutral-700);
  color: var(--text-main);
}

/* === Active Tab Styling (sits over tab content box) === */
.tab-btn.active {
  background-color: var(--card-bg);
  color: var(--accent);
  font-weight: 600;
  border: 1px solid var(--border-light);
  border-bottom: none; /* blend with tab content */
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  position: relative;
  z-index: 2;
}

.cutform-flex {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  height: auto;
}

#cutform-panel {
  width: clamp(280px, 22%, 30px);   /* Responsive width with safe bounds */
  background-color: var(--neutral-900);
  padding: 16px;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--neutral-700);
  font-size: 0.95rem;
  color: var(--text-main);
  flex: 1;
}

.input-box input {
  width: 50%;
}

#addRow {
  display: block;
  margin: 0 auto;
  width: 50%;
}

.page-header {
  text-align: center;
  /*font-family: 'Inter', sans-serif;*/
  font-family: 'Source Sans Pro', sans-serif;
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 3rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.page-header h3 {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text-secondary);
}

h3 {
  font-size: 1.3rem;
}

.top-bar {
  width: 100%;
  background-color: var(--neutral-950);
  padding: 10px 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  z-index: 10;
}

.top-bar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1600px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent);
}

.nav-links a {
  color: var(--text-secondary);
  margin-left: 20px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-links a:hover {
  color: var(--text-main);
}

.content-row {
  display: flex;
  margin: 0;
  padding: 0;
  align-items: stretch; /* ensures children match height */
  flex: 1; /* so the content pushes the footer down */
}

/* === Tab Content Container === */
.tab-content {
  display: none;
  padding: 20px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-light);
  border-top: none;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  flex-grow: 1;
}

#import-tab.tab-content.active {
  max-height: 500px;
}

.tab-content.active {
  display: block;
  height: auto;           /* only as tall as content */
  min-height: 0;          /* no artificial minimum */
  max-height: none;       /* no upper cap unless you want one */
  overflow: hidden;       /* prevents scrollbars */
}

/* === Optional Tab Wrapper if used === */
.tab-wrapper {
  border-radius: 10px;
  overflow: hidden;
  
}
.sidebar .tab-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.brand .logo {
  width: 50px;
  height: 50px;
  object-fit: contain;
}


.tooltip-icon {
  display: inline-block;
  margin-left: 6px;
  background-color: var(--neutral-600);
  color: white;
  font-size: 0.75rem;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 50%;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
  text-decoration: none;
}

.tooltip-icon:hover {
  background-color: var(--accent);
}

.site-footer {
  margin-top: 200px; /* big space to push it far below */
  padding: 40px 0;
  text-align: center;
  color: var(--text-secondary);
  background-color: var(--neutral-900);
  font-size: 0.9rem;
}
.side-tab {
  display: none;
}

.side-tab.visible {
  opacity: 1;
  pointer-events: auto;
  box-shadow: 0 0 10px rgba(0, 128, 255, 0.6); /* optional glow */
  animation: pulse 2s infinite;
}

@media (max-width: 900px) {
  /* Toggle button for mobile sidebar */
  .side-tab {
    display: block;
    position: fixed;
    top: 50vh;
    right: 1.5rem;
    transform: translateY(-50%) rotate(-90deg);
    transform-origin: right center;
    z-index: 1001;
    background-color: var(--primary-600);
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    font-size: 1.0rem;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    cursor: pointer;


    /* HIDE by default */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, box-shadow 0.3s ease;
  }

  /* Stack layout vertically on mobile */
  .cutform,
  .cutform-flex,
  .content-row,
  .tab-content.active {
    flex-direction: column;
  }

  /* Collapsible sidebar (right panel) */
  #cutform-panel.sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 360px;
    height: 100%;
    z-index: 1000;
    background-color: var(--neutral-900);
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.4);
    transition: right 0.3s ease;
    overflow-y: auto;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
  }

  #cutform-panel.sidebar.open {
    right: 0;
  }

  .main,
  .sidebar-footer {
    width: 100%;
    padding: 20px;
    margin-left: 0;
  }

  .sidebar {
    width: 75%;
    margin-left: 10%;
  }
}

.sidebar-toggle {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sidebar-toggle.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 rgba(0, 0, 0, 0.4); }
  50% { box-shadow: 0 0 12px rgba(0, 128, 255, 0.6); }
  100% { box-shadow: 0 0 0 rgba(0, 0, 0, 0.4); }
}



.error-row {
    background-color: #ff0000;
    cursor: help;
}

/* Modal backdrop */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease-in-out;
}

/* Modal content */
.modal-content {
  background-color: #fff;
  margin: 10% auto;
  padding: 2rem;
  border-radius: 10px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  position: relative;
}

/* Close (×) button */
.close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 1.5rem;
  color: #aaa;
  cursor: pointer;
}

.modal-content h2 {
  text-align: center;
  margin-bottom: 1.5rem;
}

.modal-content input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 1rem;
}

.modal-content button {
  width: 100%;
  background-color: #2ecc71;
  color: white;
  border: none;
  padding: 0.75rem;
  font-size: 1rem;
  border-radius: 6px;
  margin-top: 0.5rem;
  cursor: pointer;
}

.modal-content button.cancelBtn {
  background-color: #e0e0e0;
  color: #333;
}

.modal-content a {
  color: #2ecc71;
  text-decoration: none;
}

.modal-content a:hover {
  text-decoration: underline;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#downloadPlaceholder {
    display: none;
    font-size: 2.5rem;
    color: #888;
    margin-top: 4rem;
    text-align: center;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: bold;
    
  }

  #downloadPlaceholder:hover {
    color: #3b82f6; /* nice blue */
    text-decoration: underline;
    transform: scale(1.03);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: bold;
  }

.account-dropdown {
  position: relative;
  display: inline-block;
}

.account-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  color: #f4db23;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
}

.dropdown-icon {
  pointer-events: none;
}

.account-menu {
  position: absolute;
  right: 0;
  top: 100%;
  background: white;
  border: 1px solid #ddd;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  padding: 10px 0;
  display: none;
  min-width: 160px;
  z-index: 999;
}

.account-menu a {
  display: block;
  padding: 8px 16px;
  color: #333;
  text-decoration: none;
  font-size: 14px;
}

.account-menu a:hover {
  background-color: #525252;
}
