/* ============================================================
   BASE GLOBAL
============================================================ */
* {
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f4f5f7;
  color: #333;
  transition: background-color 0.3s, color 0.3s;
}

/* ============================================================
   TABLES
============================================================ */
table {
  width: 100%;
  border-collapse: collapse;
  background-color: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

thead th {
  background-color: #34495e;
  color: #fff;
  font-weight: bold;
  text-align: left;
  padding: 12px 15px;
  position: sticky;
  top: 0;
}

th, td {
  padding: 12px 15px;
  border: 1px solid #ddd;
  text-align: left;
}

tr:hover td {
  background-color: #e8f0fe;
}

/* analytics small tables */
.analytics-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}
.analytics-table th, .analytics-table td {
  border: 1px solid #ddd;
  padding: 6px 8px;
  text-align: center;
}
.analytics-table th {
  background-color: #f4f4f4;
  font-weight: bold;
}

/* status coloring */
.status-downloaded { color: #3498db; font-weight: bold; }
.status-printing   { color: #f39c12; font-weight: bold; }
.status-printed    { color: #27ae60; font-weight: bold; }

/* no orders message */
td[colspan="6"] {
  text-align: center;
  font-style: italic;
  color: #666;
}

/* ============================================================
   GROUP HEADERS
============================================================ */
.group-header {
  background-color: #f0f0f0;
  font-weight: bold;
  cursor: pointer;
}
.group-header:hover { background-color: #e6f0ff; }

body.dark-mode .group-header {
  background-color: #1f1f1f;
  color: #ddd;
}

.group-row td {
  padding-left: 20px;
  font-size: 0.9em;
}

/* ============================================================
   PAGINATION
============================================================ */
.pagination-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}

.pagination-controls button {
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid #ccc;
  cursor: pointer;
}

/* ============================================================
   PO LINK
============================================================ */
.po-link {
  color: #007bff;
  cursor: pointer;
  text-decoration: underline;
  font-weight: 500;
  transition: all 0.15s ease-in-out;
  display: inline-block;
}

.po-link:hover {
  color: #0056b3;
  text-decoration: none;
  transform: scale(1.05);
}

/* ============================================================
   FILE PATH BOXES
============================================================ */
.file-path {
  background: #f7f7f7;
  border-left: 3px solid #ccc;
  padding: 4px 8px;
  margin-top: 3px;
  border-radius: 4px;
  font-size: 0.85em;
  color: #444;
}

a.toggle-path {
  font-size: 0.85em;
  color: #0077cc;
  text-decoration: none;
}
a.toggle-path:hover { text-decoration: underline; }

/* ============================================================
   BUTTON STANDARDS
============================================================ */
button.small {
  background-color: #007bff;
  border: none;
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
}
button.small:hover { background-color: #0056b3; }

/* ============================================================
   WIDE TABLE WRAPPERS
============================================================ */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
}
.wide-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

/* ============================================================
   DARK MODE THEME
============================================================ */
body.dark-mode {
  background-color: #1e1e2f;
  color: #e0e0e0;
}

body.dark-mode table {
  background-color: #2c2c3e;
  color: #e0e0e0;
}

body.dark-mode th { background-color: #44445e; }

body.dark-mode td { border-color: #555; }

/* button */
body.dark-mode button.small {
  background-color: #3498db;
  color: #fff;
}
body.dark-mode button.small:hover {
  background-color: #2980b9;
}

/* ============================================================
   MODAL (NEW DARK/LIGHT MODE READY)
============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  justify-content: center;
  align-items: flex-start;
  padding-top: 5vh;
  z-index: 9999;
  animation: fadeIn 0.25s ease;
}

.modal-box {
  background: var(--modal-bg);
  color: var(--modal-text);
  width: 600px;
  max-width: 95%;
  max-height: 85vh;
  border-radius: 12px;
  padding: 22px;
  overflow-y: auto;
  box-shadow: 0 12px 28px rgba(0,0,0,0.4);
  position: relative;
  animation: scaleIn 0.25s ease;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--modal-text);
  font-size: 20px;
  cursor: pointer;
  opacity: 0.7;
}
.modal-close:hover { opacity: 1; }

.modal-title {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 1.4rem;
  font-weight: 600;
}

.modal-content {
  font-size: 0.95rem;
  line-height: 1.45rem;
}

/* animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* theme vars */
:root {
  --modal-bg: #ffffff;
  --modal-text: #222222;
}

body.dark-mode {
  --modal-bg: #1f1f1f;
  --modal-text: #e8e8e8;
}
/* ===================================================================
   FIX: TABLE COLOR CORRECTIONS FOR LIGHT & DARK MODE
=================================================================== */

/* ---------- LIGHT MODE (DEFAULT) ---------- */
body:not(.dark-mode) table {
  background-color: #ffffff !important;
  color: #222222 !important;
}

/* Light mode table header */
body:not(.dark-mode) table thead th {
  background-color: #e8e8e8 !important;
  color: #222 !important;
  border-bottom: 2px solid #ccc !important;
}

/* Light mode table cells */
body:not(.dark-mode) table td {
  background-color: #ffffff !important;
  color: #222 !important;
}

/* Row hover in light mode */
body:not(.dark-mode) tr:hover td {
  background-color: #f3f7ff !important;
}



/* ---------- DARK MODE ---------- */
body.dark-mode table {
  background-color: #2a2b3d !important;
  color: #e0e0e0 !important;
  border-color: #555 !important;
}

/* Dark mode table header */
body.dark-mode table thead th {
  background-color: #3a3b4f !important;
  color: #ffffff !important;
  border-bottom: 2px solid #666 !important;
}

/* Dark mode table cells */
body.dark-mode table td {
  background-color: #2c2d40 !important;
  color: #e0e0e0 !important;
  border-color: #555 !important;
}

/* Row hover in dark mode */
body.dark-mode tr:hover td {
  background-color: #3b3c52 !important;
}

/* Group header in dark mode */
body.dark-mode .group-header {
  background-color: #33344a !important;
  color: #e0e0e0 !important;
}

.analytics-container {
  padding: 20px;
}

.analytics-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.analytics-card {
  background: var(--modal-bg);
  color: var(--modal-text);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: transform 0.2s ease;
}

.analytics-card:hover {
  transform: translateY(-4px);
}

.card-title {
  font-size: 0.9rem;
  opacity: 0.7;
  margin-bottom: 6px;
}

.card-value {
  font-size: 1.8rem;
  font-weight: 700;
}

.card-subtext {
  margin-top: 5px;
  font-size: 0.8rem;
  opacity: 0.7;
}

.analytics-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  margin-bottom: 25px;
}

.chart-box {
  background: var(--modal-bg);
  color: var(--modal-text);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.chart-box h3 {
  margin-top: 0;
  margin-bottom: 12px;
}

.analytics-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  margin-bottom: 25px;
}

.chart-box.smaller {
  height: 350px;
}

/* Header layout */
header {
    position: relative;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px; /* spacing between dropdown, toggle, quit */
    position: absolute;
    top: 15px;
    right: 20px;
}

#shop-filter {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 14px;
    border: 1px solid #ccc;
    background: white;
}

.dark-mode #shop-filter {
    background: #1f2937;
    color: white;
    border-color: #444;
}

/* Quit button */
.quit-button {
    background: #d9534f;
    color: white;
    border: none;
    padding: 8px 14px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s ease;
}

.quit-button:hover {
    background: #c9302c;
}

/* Theme toggle (existing styling preserved, just remove fixed positioning) */
.theme-toggle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    background: var(--theme-toggle-bg);
    box-shadow: var(--button-shadow);
    transition: 0.2s ease;
}

.app-footer {
    text-align: center;
    padding: 18px 10px;
    margin-top: 40px;
    font-size: 14px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    background: var(--footer-bg);
}

.app-footer a {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 600;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* Modern Analytics Dropdown */
.analytics-range-select {
    appearance: none;
    background-color: var(--card-bg, #fff);
    color: var(--text-color, #333);
    padding: 8px 36px 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #d0d0d0);
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.25s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    background-image: url("data:image/svg+xml;utf8,<svg fill='%23777' height='12' viewBox='0 0 24 24' width='12' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.analytics-range-select:hover {
    border-color: #999;
    box-shadow: 0 4px 6px rgba(0,0,0,0.12);
}

.analytics-range-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.35);
}

/* Dark mode override */
body.dark-mode .analytics-range-select {
    background-color: #2a2a2a;
    color: #eee;
    border-color: #444;
    background-image: url("data:image/svg+xml;utf8,<svg fill='%23ccc' height='12' viewBox='0 0 24 24' width='12' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
}

body.dark-mode .analytics-range-select:hover {
    border-color: #666;
}

/* Make entire row a 3-column layout */
.three-wide-row {
  display: flex;
  flex-direction: row;
  gap: 20px;
  width: 100%;
  align-items: stretch;      /* ensures same height for all */
}

/* Donut chart card */
.chart-donut {
  flex: 0 0 300px;           /* fixed width, enough for donut */
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Larger donut */
.chart-donut canvas {
  max-width: 220px;
  margin: auto;
}

/* Status table card */
.chart-status {
  display: flex;
  flex-direction: column;
  justify-content: flex-start !important;   /* keep title at top */
  align-items: stretch;
}

.chart-status h3 {
  margin-bottom: 10px;   /* space between title and table */
  text-align: left;      /* ensure left alignment */
}

/* Future inches chart */
.chart-future {
  flex: 1;                    /* takes remaining width but does not stretch too far */
  min-width: 500px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Optional: reduce Future Inches height */
.chart-future canvas {
  height: 300px !important;
}

/* Ask AI */
.chip {
  background:#f1f3f5;
  border:1px solid #e1e5e9;
  border-radius:16px;
  padding:6px 12px;
  font-size:12px;
  cursor:pointer;
}
.chip:hover {
  background:#e9ecef;
}

/* ========= Premium / Locked Tab overrides ========= */
.tab.locked{
  opacity: 0.45;
  cursor: not-allowed;          /* was pointer */
}

/* If a locked tab ever gets "active", keep it looking locked */
.tab.locked.active{
  opacity: 0.45 !important;
  background: #6b7280 !important;   /* neutral gray */
}

/* Don’t brighten on hover */
.tab.locked:hover{
  opacity: 0.45;
}

/* Show the lock icon only when locked */
.tab.locked .lock-icon{
  display: inline-block !important;
}


#files-per-day-table td, #files-per-day-table th {
  text-align: center;
}
