/* ══════════════════════════════════════════
   FC Auto Banner — style.css
   3 màu: #0d1117 · #ffffff · #2ea043
══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, sans-serif;
  background: #0d1117;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  font-size: 13px;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: #21293a; border-radius: 4px; }

/* ── HEADER ── */
.header {
  position: fixed;
  inset: 0 0 auto 0;
  height: 48px;
  background: #0d1117;
  border-bottom: 1px solid #21293a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

.logo {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.2px;
}

.btn-export {
  padding: 7px 18px;
  border-radius: 5px;
  border: none;
  background: #2ea043;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-export:hover { background: #3fb950; }

/* ── WORKSPACE ── */
.workspace {
  position: fixed;
  inset: 48px 0 0 0;
  display: flex;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #0d1117;
  border-right: 1px solid #21293a;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 16px 0;
}

.section {
  padding: 12px 16px;
  border-bottom: 1px solid #161b22;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.section:last-child { border-bottom: none; }

.section-label {
  font-size: 10px;
  font-weight: 600;
  color: #484f58;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 2px;
}

.upload-card {
  position: relative;
  background: #0d1117;
  border: 1px dashed #30363d;
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}
.upload-card:hover {
  border-color: #8b949e;
  background: #161b22;
}
.upload-card:focus {
  border-color: #2ea043;
  border-style: solid;
  background: #161b22;
  box-shadow: 0 0 0 2px rgba(46, 160, 67, 0.2);
}
.upload-card.drag-over {
  border-color: #2ea043;
  background: #161b22;
}
.upload-card.filled {
  border-style: solid;
  padding: 8px;
}

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

.card-info {
  display: flex;
  flex-direction: column;
}

.card-name {
  font-size: 13px;
  font-weight: 600;
  color: #e6edf3;
  margin-bottom: 2px;
}

.card-sub {
  font-size: 11px;
  color: #8b949e;
}

.border-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c9d1d9;
  font-size: 13px;
  cursor: pointer;
}

.switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #30363d;
  transition: .4s;
  border-radius: 20px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: #8b949e;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: #2ea043;
}
input:checked + .slider:before {
  transform: translateX(14px);
  background-color: #fff;
}

.border-color {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid #30363d;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
}

.border-width {
  width: 44px;
  height: 24px;
  background: #0d1117;
  color: #c9d1d9;
  border: 1px solid #30363d;
  border-radius: 4px;
  text-align: center;
  font-size: 12px;
}
.border-width:focus {
  outline: none;
  border-color: #2ea043;
}

.card-actions {
  display: flex;
  gap: 4px;
}

.btn-icon {
  background: transparent;
  border: none;
  color: #8b949e;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-icon:hover {
  background: #21262d;
  color: #c9d1d9;
}
.btn-crop {
  color: #2ea043;
}
.btn-crop:hover {
  background: rgba(46, 160, 67, 0.15);
  color: #3fb950;
}
.hidden {
  display: none !important;
}

.card-plus {
  font-size: 18px;
  font-weight: 200;
  color: #30363d;
  line-height: 1;
  flex-shrink: 0;
  transition: color .18s;
}
.upload-card:hover .card-plus,
.upload-card.filled .card-plus { color: #2ea043; }

.card-name {
  font-size: 12.5px;
  font-weight: 500;
  color: #e6edf3;
  flex: 1;
}

.card-sub {
  font-size: 10px;
  color: #484f58;
  flex-shrink: 0;
}

/* Filled state — show thumbnail */
.upload-card.filled .card-label { padding: 0; }
.upload-card .card-thumb {
  width: 100%;
  height: 72px;
  object-fit: cover;
  display: block;
}

/* Fields */
.field-input {
  width: 100%;
  display: block;
  box-sizing: border-box;
  background: #0d1117;
  border: 1px solid #21293a;
  border-radius: 5px;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  padding: 8px 10px;
  outline: none;
  transition: border-color .15s;
}
.field-input::placeholder { color: #30363d; }
.field-input:focus { border-color: #2ea043; }

/* Theme buttons */
.theme-opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.theme-btn {
  padding: 7px 0;
  border-radius: 5px;
  border: 1px solid #21293a;
  background: transparent;
  color: #8b949e;
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}
.theme-btn:hover { border-color: #30363d; color: #e6edf3; }
.theme-btn.active {
  border-color: #2ea043;
  background: rgba(46,160,67,.1);
  color: #3fb950;
}

/* ── CANVAS AREA ── */
.canvas-area {
  flex: 1;
  background: #090d12;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;

  /* dot grid */
  background-image: radial-gradient(circle, #1c2333 1px, transparent 1px);
  background-size: 24px 24px;
  background-color: #090d12;
}

/* Canvas wrapper — sized to fill available space maintaining 1200:630 ratio */
.canvas-wrap {
  position: relative;
  /* JS will set width/height based on container */
  max-width: calc(100% - 48px);
  max-height: calc(100% - 48px);


  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  border: 1px solid #21293a;
  background: #0d1117;
}

#main-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Empty state overlay */
.canvas-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #0d1117;
  pointer-events: none;
}

.empty-icon {
  font-size: 32px;
  color: #21293a;
  display: block;
}


.empty-text {
  font-size: 13px;
  color: #30363d;
  font-weight: 400;
}

/* ── CROP MODAL ── */
#crop-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
#crop-modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(4px);
}

.modal-box {
  position: relative;
  background: #0d1117;
  border: 1px solid #21293a;
  border-radius: 10px;
  width: min(90vw, 960px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #21293a;
  flex-shrink: 0;
}

.modal-title {
  font-size: 13px;
  font-weight: 600;
  color: #e6edf3;
}

.modal-close {
  background: transparent;
  border: none;
  color: #8b949e;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color .15s;
}
.modal-close:hover { color: #fff; }

.modal-hint {
  padding: 8px 18px;
  font-size: 11.5px;
  color: #484f58;
  border-bottom: 1px solid #161b22;
  flex-shrink: 0;
}

.modal-canvas-wrap {
  position: relative;
  flex: 1;
  overflow: auto;
  background: #090d12;
  cursor: crosshair;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.modal-canvas-wrap img {
  display: block;
  max-width: 100%;
  max-height: 60vh;
  user-select: none;
  pointer-events: none;
}

#crop-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.modal-actions {
  display: flex;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid #21293a;
  flex-shrink: 0;
}

.modal-btn-confirm {
  padding: 8px 20px;
  border-radius: 5px;
  border: none;
  background: #2ea043;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.modal-btn-confirm:disabled { background: #161b22; color: #484f58; cursor: not-allowed; border: 1px solid #21293a; }
.modal-btn-confirm:not(:disabled):hover { background: #3fb950; }

.modal-btn-full, .modal-btn-cancel {
  padding: 8px 16px;
  border-radius: 5px;
  border: 1px solid #21293a;
  background: transparent;
  color: #8b949e;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.modal-btn-full:hover, .modal-btn-cancel:hover { border-color: #30363d; color: #e6edf3; }
