/* Base variables, resets, header/nav, icon styles are in /css/shared.css */

/* Decks-specific variables */
:root { --green: #2d6b2d; --red: #8b2222; }

#auth-indicator { font-size: 0.85rem; }
#auth-indicator a { color: var(--accent); }

/* ─── AUTH PAGE ─── */
.auth-page {
  display: flex; justify-content: center; align-items: center;
  min-height: calc(100vh - 50px); padding: 20px;
}
.auth-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 12px; padding: 32px; width: 100%; max-width: 400px;
}
.auth-tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 2px solid var(--border); }
.auth-tab {
  padding: 8px 20px; background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 0.9rem; border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.auth-tab-content { display: none; }
.auth-tab-content.active { display: block; }
.auth-card label {
  display: block; font-size: 0.78rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 4px; margin-top: 14px;
}
.auth-card label:first-child { margin-top: 0; }
.auth-card input {
  width: 100%; padding: 10px 12px; background: var(--bg-tertiary); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; outline: none;
}
.auth-card input:focus { border-color: var(--accent); }
.auth-submit {
  width: 100%; padding: 10px; margin-top: 20px;
  background: var(--accent); color: #000; border: none; border-radius: 6px;
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
.auth-submit:hover { background: #d4b45c; }
.auth-link { display: block; text-align: center; margin-top: 12px; font-size: 0.82rem; }
.auth-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; }
.auth-divider {
  text-align: center; margin: 20px 0; position: relative;
  border-top: 1px solid var(--border);
}
.auth-divider span {
  background: var(--bg-secondary); padding: 0 12px;
  position: relative; top: -10px; color: var(--text-dim); font-size: 0.82rem;
}
.auth-discord {
  width: 100%; padding: 10px; background: #5865F2; color: #fff;
  border: none; border-radius: 6px; font-size: 0.9rem; cursor: pointer; font-weight: 600;
}
.auth-discord:hover { background: #4752C4; }
.auth-error {
  margin-top: 16px; padding: 10px; background: rgba(139,34,34,0.15);
  border: 1px solid var(--red); border-radius: 6px;
  color: #f0c4c4; font-size: 0.85rem;
}
html[data-theme="light"] .auth-error { color: #8b2222; background: rgba(139,34,34,0.08); }
.auth-success {
  margin-top: 16px; padding: 10px; background: rgba(45,107,45,0.15);
  border: 1px solid var(--green); border-radius: 6px;
  color: #c4f0c4; font-size: 0.85rem;
}
html[data-theme="light"] .auth-success { color: #2d6b2d; background: rgba(45,107,45,0.08); }

/* ─── MY DECKS PAGE ─── */
.page-container { max-width: 1000px; margin: 0 auto; padding: 24px; }
.page-title { font-size: 1.5rem; margin-bottom: 4px; }
.page-actions { display: flex; gap: 10px; margin: 16px 0; align-items: center; }
.btn {
  padding: 8px 16px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg-tertiary); color: var(--text); cursor: pointer; font-size: 0.85rem;
}
.btn:hover { border-color: var(--text-muted); }
.btn-primary { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: #d4b45c; }
.btn-danger { color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }

.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.deck-card {
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; cursor: pointer; transition: all 0.12s; display: flex; gap: 12px;
}
.deck-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.deck-thumb {
  width: 60px; height: 84px; border-radius: 6px; object-fit: cover; flex-shrink: 0;
  background: var(--bg-tertiary);
}
.deck-card-info { flex: 1; min-width: 0; }
.deck-card-name { font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; }
.deck-card-meta { font-size: 0.78rem; color: var(--text-muted); }
.deck-card-meta span { margin-right: 8px; }
.format-badge {
  display: inline-block; padding: 2px 8px; border-radius: 3px;
  font-size: 0.68rem; font-weight: 600; background: var(--bg-tertiary); color: var(--text-muted);
  border: 1px solid var(--border);
}
.deck-card-actions { display: flex; gap: 6px; margin-top: 8px; }
.deck-card-actions .btn { padding: 4px 10px; font-size: 0.75rem; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--text-muted); }

/* ─── DECK BUILDER ─── */
.builder-header {
  display: flex; align-items: center; gap: 16px; padding: 12px 24px;
  background: var(--bg-secondary); border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.builder-name {
  font-size: 1.2rem; font-weight: 700; background: none; border: none;
  color: var(--text); outline: none; border-bottom: 1px dashed var(--border);
  padding: 2px 4px; min-width: 200px;
}
.builder-name:focus { border-bottom-color: var(--accent); }
.builder-format { padding: 4px 8px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 4px; font-size: 0.82rem; }
/* View toggle */
.view-toggle { display: flex; gap: 2px; margin-left: 12px; }
.view-btn {
  padding: 4px 8px; background: var(--bg-tertiary); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; font-size: 0.85rem; line-height: 1;
}
.view-btn:first-child { border-radius: 4px 0 0 4px; }
.view-btn:last-child { border-radius: 0 4px 4px 0; }
.view-btn.active { background: var(--accent); color: #000; border-color: var(--accent); }
.view-btn:hover:not(.active) { border-color: var(--text-muted); }

.builder-stats { font-size: 0.82rem; color: var(--text-muted); margin-left: auto; }
.builder-stats span { margin-left: 12px; }
.deck-meta {
  font-size: 0.78rem; color: var(--text-dim); margin-left: auto; white-space: nowrap;
}
.deck-meta-user { color: var(--accent); font-weight: 600; text-decoration: none; }
.deck-meta-user:hover { text-decoration: underline; }
.deck-meta-date { font-size: 0.7rem; color: var(--text-dim); }
.builder-stats .valid { color: var(--green); }
.builder-stats .invalid { color: var(--red); }

/* Card search autocomplete */
.card-search-wrap { position: relative; padding: 8px 24px; background: var(--bg-secondary); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.card-search-input {
  width: 100%; max-width: 500px; padding: 10px 14px;
  background: var(--bg-tertiary); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; outline: none;
}
.card-search-input:focus { border-color: var(--accent); }
.autocomplete-dropdown {
  position: absolute; top: 100%; left: 24px; right: 24px; max-width: 500px;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); z-index: 50; display: none; max-height: 400px; overflow-y: auto;
}
.autocomplete-dropdown.visible { display: block; }
.ac-item {
  display: flex; gap: 10px; padding: 8px 12px; cursor: pointer; align-items: center;
  border-bottom: 1px solid var(--border); transition: background 0.08s;
}
.ac-item:hover, .ac-item.selected { background: var(--bg-tertiary); }
.ac-item:last-child { border-bottom: none; }
.ac-thumb { width: 36px; height: 50px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.ac-info { flex: 1; min-width: 0; }
.ac-name { font-size: 0.85rem; font-weight: 600; }
.ac-type { font-size: 0.72rem; color: var(--text-dim); }
.ac-cost { font-size: 0.75rem; }
.ac-cost img { height: 14px; vertical-align: middle; }

/* Builder layout: preview + deck area */
.builder-layout { display: flex; gap: 20px; }
.card-preview-col {
  width: 250px; flex-shrink: 0; position: sticky; top: 60px; align-self: flex-start;
}
.card-preview-col img { width: 100%; border-radius: 8px; display: block; }
.preview-placeholder {
  width: 100%; aspect-ratio: 5/7; border-radius: 8px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 0.78rem;
}
.deck-main-col { flex: 1; min-width: 0; }


/* Deck sections */
.builder-body { padding: 16px 24px 48px; }
.deck-section {
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; transition: border-color 0.15s;
}
.deck-section.drop-target { border-color: var(--accent); border-style: dashed; background: rgba(196,169,80,0.05); }

/* Sideboard drop banner (shown during drag) */
.sideboard-drop {
  display: none; justify-content: center; align-items: center;
  margin-top: 16px; padding: 14px; border: 2px dashed var(--border);
  border-radius: 8px; color: var(--text-dim); font-size: 0.82rem;
  text-transform: uppercase; letter-spacing: 0.5px; transition: all 0.12s;
}
.sideboard-drop.drop-target { border-color: var(--accent); color: var(--accent); background: rgba(196,169,80,0.08); }
.section-header {
  display: flex; justify-content: space-between; font-size: 0.75rem;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.3px;
  padding-bottom: 6px; margin-bottom: 8px; border-bottom: 1px solid var(--border);
}
.section-count { color: var(--accent); font-weight: 600; }

/* Card rows in text view */
.deck-card-row {
  display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 4px;
  cursor: pointer; transition: background 0.08s; font-size: 0.85rem;
}
.deck-card-row:hover { background: var(--bg-tertiary); }
.deck-card-row[draggable="true"] { cursor: grab; }
.deck-card-row .qty { color: var(--accent); min-width: 20px; font-weight: 600; cursor: pointer; }
.deck-card-row .qty:hover { text-decoration: underline; }
.deck-card-row .card-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-card-row .remove-btn {
  opacity: 0; color: var(--red); cursor: pointer; font-size: 0.9rem; padding: 0 4px;
}
.deck-card-row:hover .remove-btn { opacity: 1; }

.deck-img-badge {
  position: absolute; top: 3px; right: 3px; background: rgba(0,0,0,0.8);
  color: var(--accent); font-weight: 700; font-size: 0.7rem; padding: 2px 5px; border-radius: 3px;
  z-index: 1;
}
.deck-img-placeholder {
  display: none; flex-direction: column; justify-content: center; align-items: center;
  width: 100%; aspect-ratio: 5/7; border-radius: 6px;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  padding: 6px; text-align: center; overflow: hidden;
}
.deck-img-placeholder-name { font-size: 0.62rem; font-weight: 600; color: var(--text-muted); word-break: break-word; }
.deck-img-placeholder-code { font-size: 0.55rem; color: var(--text-dim); margin-top: 2px; }

/* Context menu */
.context-menu {
  position: fixed; z-index: 200; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  padding: 4px 0; min-width: 180px; display: none;
}
.context-menu.visible { display: block; }
.ctx-item {
  padding: 8px 14px; font-size: 0.82rem; cursor: pointer;
  color: var(--text-muted); transition: background 0.08s;
}
.ctx-item:hover { background: var(--bg-tertiary); color: var(--text); }
.ctx-separator { height: 1px; background: var(--border); margin: 4px 0; }
.ctx-submenu { position: relative; }
.ctx-submenu-items {
  display: none; position: fixed;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5); padding: 4px 0; min-width: 200px;
  max-height: 50vh; overflow-y: auto;
}
.ctx-submenu:hover .ctx-submenu-items { display: block; }

/* Printing items in context menu */
.ctx-printing { display: flex; align-items: center; gap: 8px; }
.ctx-printing-current { color: var(--accent); font-weight: 600; }
.ctx-printing-thumb { width: 28px; height: 40px; border-radius: 3px; object-fit: cover; flex-shrink: 0; }
.ctx-printing-info { min-width: 0; }
.ctx-printing-set { font-size: 0.7rem; color: var(--text-dim); }

/* Printing hover preview */
.printing-preview {
  position: fixed; z-index: 300; display: none;
  width: 200px; pointer-events: none;
}
.printing-preview img { width: 100%; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.5); }

/* Validation panel */
.validation-panel {
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px; margin-bottom: 16px;
}
.validation-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 0.82rem; }
.validation-row .label { color: var(--text-muted); }
.validation-row .value { font-weight: 600; }
.validation-row .ok { color: #4caf50; }
.validation-row .warn { color: #ff9800; }
.validation-row .err { color: #f44336; }


/* Builder overrides for dl- classes */
.builder-body .dl-card-row[draggable="true"] { cursor: grab; }
.builder-body .dl-card-row .remove-btn {
  opacity: 0; color: var(--red); cursor: pointer; font-size: 0.9rem; padding: 0 4px; margin-left: auto;
}
.builder-body .dl-card-row:hover .remove-btn { opacity: 1; }
.builder-body .dl-card-qty { cursor: pointer; }
.builder-body .dl-card-qty:hover { text-decoration: underline; }
.builder-body .dl-img-card { width: 140px; }
.builder-body .dl-img-card[draggable="true"] { cursor: grab; }

/* Card warnings */
.card-warning { background: rgba(244,67,54,0.08); border-left: 2px solid #f44336; }
.card-warning .card-name { color: #f44336; }

/* Bottom summary bar */
.builder-bottom-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; gap: 20px;
  padding: 8px 24px; background: var(--bg-secondary);
  border-top: 1px solid var(--border); font-size: 0.82rem;
}
.builder-bottom-bar .ok { color: #4caf50; }
.builder-bottom-bar .warn { color: #ff9800; }
.builder-bottom-bar .err { color: #f44336; }

/* Export/Import Modals */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 500;
  background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center;
}
.modal-overlay.hidden { display: none; }
.modal-card {
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px;
  padding: 24px; width: 100%; max-width: 550px; max-height: 80vh; overflow-y: auto;
}
.modal-card h3 { margin-bottom: 16px; }
.modal-card label {
  display: block; font-size: 0.78rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 4px; margin-top: 12px;
}
.modal-card label:first-of-type { margin-top: 0; }
.modal-card input, .modal-card textarea {
  width: 100%; padding: 8px 10px; background: var(--bg-tertiary); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; font-size: 0.85rem;
  font-family: monospace; outline: none; resize: vertical;
}
.modal-card input:focus, .modal-card textarea:focus { border-color: var(--accent); }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.btn-sm { padding: 4px 12px; font-size: 0.78rem; }

/* J-ruler arrow in builder */
.dl-ruler-row { padding-left: 12px; }
.dl-ruler-arrow { color: var(--text-dim); font-size: 0.8rem; }

/* Card highlight flash */
@keyframes card-flash {
  0% { background: var(--accent); }
  100% { background: transparent; }
}
.card-flash { animation: card-flash 1s ease-out; }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .deck-grid { grid-template-columns: 1fr; }
  .deck-sections { grid-template-columns: 1fr; }
  .builder-header { padding: 8px 12px; }
  .card-search-wrap { padding: 8px 12px; }
  .builder-body { padding: 12px 12px 48px; }
  .builder-layout { flex-direction: column; }
  .card-preview-col { width: 100%; position: static; display: none; }
  .deck-type-columns { grid-template-columns: 1fr; }
  .ruler-area-row { flex-direction: column; }
  .site-header { padding: 8px 12px; gap: 8px; }
}
