/* FOXTANA v0.3 - Modern Dark UI */
:root {
  --bg: #0f1115;
  --panel: #161b22;
  --border: #252b36;
  --accent: #ff7a3c;
  --accent-hover: #ff9a6a;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --overlay: rgba(0, 0, 0, 0.65);
  --crop-border: 1px solid rgba(255, 255, 255, 0.8);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; outline: none; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); height: 100vh; overflow: hidden; }

/* Layout */
.app-container { display: flex; flex-direction: column; height: 100%; }

/* Header */
.fx-header {
  height: 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.fx-brand { display: flex; gap: 12px; align-items: center; }
.fx-logo { font-size: 24px; }
.fx-text h1 { margin: 0; font-size: 18px; letter-spacing: -0.5px; }
.fx-text p { margin: 0; font-size: 11px; color: var(--text-dim); }

/* Workspace */
.fx-workspace { flex: 1; display: flex; overflow: hidden; }

/* Sidebar */
.fx-toolbar {
  width: 260px; background: var(--panel); border-right: 1px solid var(--border);
  padding: 20px; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; z-index: 10;
}
.fx-divider { height: 1px; background: var(--border); width: 100%; }

.fx-tool-group label { display: block; font-size: 11px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; letter-spacing: 0.5px; }

/* Buttons & Inputs */
.fx-btn { padding: 8px 16px; border-radius: 6px; border: 1px solid var(--border); background: #21262d; color: var(--text); cursor: pointer; font-size: 13px; }
.fx-btn-accent { background: var(--accent); color: #000; border: none; font-weight: 600; }
.fx-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.fx-tool-btn {
  display: flex; align-items: center; justify-content: center; width: 100%; padding: 10px;
  background: #21262d; border: 1px solid var(--border); color: var(--text); border-radius: 6px;
  cursor: pointer; margin-bottom: 8px; font-size: 13px; transition: all 0.2s;
}
.fx-tool-btn:hover:not(:disabled) { background: #30363d; border-color: var(--text-dim); }
.fx-tool-btn.primary { background: rgba(255, 122, 60, 0.1); border-color: var(--accent); color: var(--accent); }

.fx-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.fx-chip {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  padding: 6px; border-radius: 4px; font-size: 11px; cursor: pointer;
}
.fx-chip.active { background: var(--accent); color: #000; border-color: var(--accent); }

.fx-info-panel { background: #0d1117; padding: 12px; border-radius: 6px; border: 1px solid var(--border); display: grid; gap: 10px; }
.fx-stat { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.fx-stat small { color: var(--text-dim); }
.fx-mini-input { width: 50px; background: transparent; border: 1px solid var(--border); color: var(--text); padding: 4px; border-radius: 4px; text-align: right; }

input[type="file"] { display: none; }

/* Canvas Area */
.fx-canvas-area {
  flex: 1; position: relative; background-image: radial-gradient(#1c2026 1px, transparent 1px);
  background-size: 20px 20px; background-color: #050608;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}

.fx-empty-state { text-align: center; color: var(--text-dim); }
.fx-empty-state .sub { font-size: 12px; opacity: 0.6; margin-top: 4px; }

.fx-stack { position: relative; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
.fx-stack.hidden { display: none; }

#imgCanvas { display: block; max-width: 100%; max-height: 100%; }

/* The Overlay Engine */
#overlayLayer {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  cursor: crosshair; touch-action: none; /* Prevents scroll on mobile */
}

/* Modal */
.fx-modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.fx-modal.hidden { display: none; }
.fx-modal-content {
  background: var(--panel); border: 1px solid var(--border); padding: 24px;
  border-radius: 12px; width: 300px;
}
.fx-modal h3 { margin: 0 0 16px 0; font-size: 16px; }
.fx-field { margin-bottom: 12px; }
.fx-field input { width: 100%; padding: 8px; background: #0d1117; border: 1px solid var(--border); color: var(--text); border-radius: 4px; }
.fx-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* Mobile Responsive */
@media (max-width: 768px) {
  .app-container { flex-direction: column; }
  .fx-header { padding: 0 16px; }
  .fx-workspace { flex-direction: column-reverse; }
  .fx-toolbar { width: 100%; height: auto; flex-shrink: 0; border-right: none; border-top: 1px solid var(--border); padding: 12px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; }
  .fx-tool-group { display: flex; gap: 8px; align-items: center; }
  .fx-tool-group label { display: none; }
  .desktop-only { display: none; }
  .fx-grid-2 { display: flex; }
  .fx-info-panel { display: none; } /* Hide stats on mobile to save space */
  .fx-divider { display: none; }
}
