/* Anjum Tips Brand Identity & Spreadsheet Design System */
:root {
  --at-brand: #059669;
  --at-brand-dark: #047857;
  --at-brand-light: #ecfdf5;
  --at-accent: #0284c7;
  --at-dark: #1e293b;
  --at-light: #f8fafc;
  --at-border: #cbd5e1;
  --at-cell-border: #e2e8f0;
  --at-header-bg: #f1f5f9;
  --at-selection-bg: rgba(5, 150, 105, 0.12);
  --at-selection-border: #059669;
  --at-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.at-ep-container {
  font-family: var(--at-font);
  background: #ffffff;
  border: 1px solid var(--at-border);
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  margin: 25px 0;
  overflow: hidden;
  color: var(--at-dark);
}

.at-ep-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--at-cell-border);
  flex-wrap: wrap;
  gap: 10px;
}

.at-ep-title {
  margin: 0 0 6px 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--at-dark);
}

.at-ep-badge {
  display: inline-block;
  padding: 3px 9px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 9999px;
  letter-spacing: 0.05em;
  margin-right: 6px;
}

.at-ep-badge-beginner { background: #dcfce7; color: #15803d; }
.at-ep-badge-intermediate { background: #fef9c3; color: #a16207; }
.at-ep-badge-advanced { background: #fee2e2; color: #b91c1c; }

.at-ep-cat-pill {
  display: inline-block;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
  border-radius: 4px;
}

.at-ep-instructions {
  background: var(--at-brand-light);
  border-left: 4px solid var(--at-brand);
  padding: 14px 20px;
  display: flex;
  gap: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.at-ep-task-tag {
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  background: var(--at-brand);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  height: fit-content;
}

.at-ep-hint-box {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  padding: 12px 18px;
  font-size: 0.9rem;
  color: #92400e;
  animation: atFadeIn 0.25s ease-in-out;
}

/* Formula Bar */
.at-ep-formula-bar-container {
  display: flex;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--at-border);
  padding: 6px 12px;
  gap: 10px;
}

.at-ep-active-cell-box {
  min-width: 55px;
  text-align: center;
  font-weight: 600;
  color: #64748b;
  border-right: 1px solid var(--at-cell-border);
  font-size: 0.85rem;
}

.at-ep-fx-label {
  font-weight: bold;
  color: #94a3b8;
  font-family: serif;
}

.at-ep-formula-input {
  flex: 1;
  border: 1px solid transparent;
  padding: 6px 8px;
  font-size: 0.92rem;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}

.at-ep-formula-input:focus {
  border-color: var(--at-cell-border);
  background: #f8fafc;
  border-radius: 4px;
}

/* Matrix Table Grid */
.at-ep-grid-wrapper {
  overflow: auto;
  max-height: 440px;
  background: #ffffff;
  position: relative;
  outline: none;
}

.at-ep-grid {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
  font-size: 0.88rem;
  user-select: none;
}
.at-ep-grid th:first-child {
  width: 43px;
}
.at-ep-grid th, .at-ep-grid td {
  border: 1px solid var(--at-cell-border);
  padding: 6px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

.at-ep-corner-header, .at-ep-col-header {
  background: var(--at-header-bg);
  color: #64748b;
  font-weight: 600;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 2;
  height: 28px;
}

.at-ep-row-header {
  background: var(--at-header-bg);
  color: #64748b;
  font-weight: 600;
  text-align: center;
  width: 45px;
  position: sticky;
  left: 0;
  z-index: 1;
}

.at-ep-grid td {
  cursor: cell;
  background: #ffffff;
  height: 28px;
}

.at-ep-grid td.at-cell-selected {
  outline: 2px solid var(--at-selection-border);
  outline-offset: -2px;
  background-color: var(--at-selection-bg);
}

.at-ep-grid td.at-target-cell {
  background-color: #fefce8;
  position: relative;
}

.at-ep-grid td.at-target-cell::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  border-width: 0 6px 6px 0;
  border-style: solid;
  border-color: #eab308 transparent;
}

.at-ep-grid td.at-cell-editing {
  padding: 0;
}

.at-ep-grid td input.at-inline-editor {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  padding: 4px 6px;
  font-family: inherit;
  font-size: inherit;
  background: #ffffff;
  box-shadow: inset 0 0 0 2px var(--at-selection-border);
}

/* Footer / Controls */
.at-ep-footer {
  padding: 14px 20px;
  background: #f8fafc;
  border-top: 1px solid var(--at-cell-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.at-ep-target-highlight {
  background: #fef9c3;
  padding: 2px 6px;
  border-radius: 3px;
  color: #854d0e;
}

.at-ep-cta-buttons {
  display: flex;
  gap: 10px;
}

.at-ep-btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.at-ep-btn-primary { background: var(--at-brand); color: #fff; }
.at-ep-btn-primary:hover { background: var(--at-brand-dark); color: #fff; }
.at-ep-btn-secondary { background: #e2e8f0; color: #334155; }
.at-ep-btn-secondary:hover { background: #cbd5e1; }
.at-ep-btn-subtle { background: transparent; color: #64748b; border-color: #cbd5e1; }
.at-ep-btn-subtle:hover { background: #f1f5f9; color: var(--at-dark); }

.at-ep-feedback-panel {
  padding: 16px 20px;
  font-size: 0.92rem;
  border-top: 1px solid var(--at-cell-border);
  animation: atFadeIn 0.2s ease-in-out;
}

.at-ep-feedback-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.at-ep-feedback-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

@keyframes atFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Category & Multi-Practice Tabs UI */
.at-ep-category-wrapper {
  background: #f8fafc;
  border: 1px solid var(--at-border);
  border-radius: 10px;
  padding: 20px;
  margin: 30px 0;
}

.at-ep-category-title {
  margin: 0 0 15px 0;
  color: var(--at-dark);
  font-size: 1.25rem;
  font-weight: 700;
}

.at-ep-tabs-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 20px;
  padding-bottom: 2px;
}

.at-ep-tab-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 9px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.at-ep-tab-btn:hover {
  background: #f1f5f9;
  color: var(--at-dark);
}

.at-ep-tab-btn.at-active {
  background: var(--at-brand);
  color: #ffffff;
  border-color: var(--at-brand);
}

.at-ep-tab-num {
  background: rgba(0, 0, 0, 0.08);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.at-ep-tab-btn.at-active .at-ep-tab-num {
  background: #ffffff;
  color: var(--at-brand);
}

.at-ep-tab-pane {
  display: none;
}

.at-ep-tab-pane.at-active {
  display: block;
  animation: atFadeIn 0.25s ease-in-out;
}

.at-ep-stacked-item {
  margin-bottom: 30px;
}

/* Catalog Cards */
.at-ep-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.at-ep-card {
  border: 1px solid var(--at-border);
  border-radius: 8px;
  padding: 20px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
}

.at-ep-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.at-ep-card-title { margin: 12px 0 8px 0; font-size: 1.15rem; font-weight: 700; color: #1e293b; }
.at-ep-card-excerpt { flex: 1; color: #64748b; font-size: 0.9rem; line-height: 1.45; }
.at-ep-btn-block { width: 100%; justify-content: center; margin-top: 15px; box-sizing: border-box; }

/* Sequential category practice flow */
.at-ep-loop-progress{background:#fff;border:1px solid var(--at-border);border-radius:10px;padding:16px 18px;margin:18px 0}
.at-ep-loop-progress-top{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:10px;color:var(--at-dark);font-size:.92rem}
.at-ep-loop-percent{color:var(--at-brand-dark);font-weight:700}
.at-ep-progress-track{height:9px;background:#e2e8f0;border-radius:999px;overflow:hidden}
.at-ep-progress-fill{display:block;height:100%;background:linear-gradient(90deg,#059669,#34d399);border-radius:999px;transition:width .25s ease}
.at-ep-loop-panes .at-ep-tab-pane{display:none}
.at-ep-loop-panes .at-ep-tab-pane.at-active{display:block}
.at-ep-loop-controls{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px;background:#fff;border:1px solid var(--at-border);border-radius:10px;margin:16px 0 26px}
.at-ep-loop-status{font-size:.85rem;color:#64748b;text-align:center}
.at-ep-loop-controls button:disabled{opacity:.45;cursor:not-allowed}
@media(max-width:600px){.at-ep-loop-controls{flex-wrap:wrap}.at-ep-loop-status{order:3;flex-basis:100%}.at-ep-loop-progress-top{align-items:flex-start;flex-direction:column}}


/* End-of-track results screen */
.at-ep-loop-actions { display:flex; gap:10px; align-items:center; }
.at-ep-view-results { background:#059669; color:#fff; }
.at-ep-view-results:hover { background:#047857; color:#fff; }
.at-ep-results-panel { margin:18px 0 24px; }
.at-ep-results-card { border:1px solid #dbe4ee; border-radius:12px; padding:clamp(18px,3vw,30px); background:#fff; box-shadow:0 8px 24px rgba(15,23,42,.07); color:#1e293b; }
.at-ep-results-kicker { font-size:.75rem; font-weight:800; letter-spacing:.12em; color:#059669; }
.at-ep-results-card h3 { margin:6px 0 8px; font-size:1.7rem; color:#0f172a; }
.at-ep-results-message { margin:0 0 20px; color:#475569; }
.at-ep-results-stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin:20px 0 26px; }
.at-ep-results-stats > div { padding:16px; border-radius:9px; background:#f8fafc; border:1px solid #e2e8f0; display:flex; flex-direction:column; gap:5px; }
.at-ep-results-stats strong { font-size:1.55rem; color:#047857; }
.at-ep-results-stats span { color:#64748b; font-size:.84rem; }
.at-ep-results-card h4 { margin:0 0 10px; font-size:1rem; }
.at-ep-results-list { list-style:none; padding:0; margin:0; border-top:1px solid #e2e8f0; }
.at-ep-result-item { display:flex; align-items:center; gap:10px; padding:12px 4px; border-bottom:1px solid #e2e8f0; }
.at-ep-result-icon { width:24px; height:24px; flex:0 0 24px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; font-weight:800; }
.at-ep-result-item.is-complete .at-ep-result-icon { background:#dcfce7; color:#15803d; }
.at-ep-result-item.is-incomplete .at-ep-result-icon { background:#f1f5f9; color:#64748b; }
.at-ep-result-name { flex:1; min-width:0; }
.at-ep-result-item strong { font-size:.82rem; color:#64748b; }
.at-ep-result-item.is-complete strong { color:#15803d; }
.at-ep-results-actions { display:flex; gap:10px; margin-top:22px; flex-wrap:wrap; }
@media(max-width:640px) {
 .at-ep-results-stats {grid-template-columns:repeat(2,minmax(0,1fr));}
 .at-ep-loop-controls { align-items:stretch; }
 .at-ep-loop-actions { width:100%; }
 .at-ep-loop-actions .at-ep-btn { flex:1; justify-content:center; }
 .at-ep-result-item { align-items:flex-start; flex-wrap:wrap; }
 .at-ep-result-item strong { margin-left:34px; width:100%; }
}
@media(max-width:480px) {
 .at-ep-results-stats {grid-template-columns:repeat(1,minmax(0,1fr));}	
}
@media print {
  body * {visibility: hidden !important;}

  .at-ep-results-card,
  .at-ep-results-card * {
    visibility: visible !important;
  }

  .at-ep-results-card {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .at-ep-results-actions {
    display: none !important;
  }
}
/*
@media print {
 body.at-ep-print-results * { visibility:hidden !important; }
 body.at-ep-print-results .at-ep-results-card,
 body.at-ep-print-results .at-ep-results-card * { visibility:visible !important; }
 body.at-ep-print-results .at-ep-results-card { position:absolute !important; left:0 !important; top:0 !important; width:100% !important; margin:0 !important; box-shadow:none !important; border:0 !important; }
 body.at-ep-print-results .at-ep-results-actions { display:none !important; }
 .at-ep-loop-controls, .at-ep-loop-progress { display:none !important; }
}
*/
