:root {
  --bg-dark-app: #0f172a; 
  --panel-bg: #1e293b;
  --card-border: #334155;
  --portal-primary: #3b82f6; 
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;

  --tool-dim-pink-bg: #2d1c24; 
  --tool-pink-accent: #d9738b;
  --tool-pink-border: #f28ca3;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  background-color: var(--bg-dark-app);
  color: var(--text-primary);
}

.govt-header {
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  color: #ffffff;
  padding: 14px 24px;
}
.header-container { display: flex; align-items: center; justify-content: space-between; max-width: 1400px; margin: 0 auto; }
.brand-logo { display: flex; align-items: center; gap: 14px; }
.brand-logo i { font-size: 30px; color: #ffffff; }
.brand-logo h1 { font-size: 21px; font-weight: 700; }
.brand-logo p { font-size: 11px; color: #e2e8f0; }
.ad-space-header { background: rgba(255, 255, 255, 0.1); padding: 8px 18px; border-radius: 20px; border: 1px dashed #93c5fd; font-size: 11px; }

.portal-layout { display: flex; min-height: calc(100vh - 70px); }

.app-sidebar {
  width: 100px;
  background: #0b1120;
  display: flex; flex-direction: column; padding: 16px 8px; gap: 12px;
  border-right: 1px solid var(--card-border);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 12px 6px; color: var(--text-muted); text-decoration: none;
  border-radius: 12px; font-size: 11px; gap: 6px; transition: all 0.2s ease;
}
.nav-item i { font-size: 18px; }
.nav-item:hover, .nav-item.active { background: var(--panel-bg); color: var(--portal-primary); font-weight: bold; }

.app-main { flex: 1; padding: 24px; }
.studio-container { max-width: 1250px; margin: 0 auto; }

.studio-container * {
  font-family: 'Playfair Display', Georgia, serif;
}

.tool-banner {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--tool-dim-pink-bg); border: 1px solid var(--tool-pink-border);
  padding: 18px 24px; border-radius: 16px; margin-bottom: 20px;
}
.tool-banner h2 { font-size: 20px; color: #fff; display: flex; align-items: center; gap: 10px; }
.tool-banner h2 i { color: var(--tool-pink-accent); }
.tool-banner p { font-size: 12px; color: #d4a5b4; margin-top: 2px; }

.pro-dropzone {
  background: var(--tool-dim-pink-bg); 
  border: 2px dashed var(--tool-pink-border);
  border-radius: 20px; padding: 60px 20px; text-align: center;
  max-width: 600px; margin: 40px auto; transition: background 0.2s;
}
.pro-dropzone.dragover { background: #3c2431; }
.dropzone-label { cursor: pointer; display: block; }
.upload-icon { font-size: 52px; color: var(--tool-pink-border); margin-bottom: 12px; }
.pro-dropzone h3 { font-size: 24px; color: #fff; margin-bottom: 6px; }
.pro-dropzone p { color: #d4a5b4; font-size: 14px; margin-bottom: 20px; }
.upload-btn-styled {
  background: linear-gradient(135deg, var(--tool-pink-border), var(--tool-pink-accent));
  color: #170d14; padding: 12px 28px; border-radius: 24px; font-weight: 700; font-size: 14px; display: inline-block;
}
#fileInput { display: none; }

.studio-grid { display: grid; grid-template-columns: 1fr 380px; gap: 20px; }
.canvas-viewport-card, .studio-controls-card {
  background: var(--tool-dim-pink-bg); border: 1px solid #4a2f3d;
  border-radius: 18px; padding: 18px;
}
.viewport-header { display: flex; justify-content: space-between; font-size: 12px; color: #d4a5b4; margin-bottom: 12px; align-items: center; }
.badge-live { background: rgba(242, 140, 163, 0.15); color: var(--tool-pink-border); padding: 4px 12px; border-radius: 20px; font-size: 11px; }

.canvas-stage {
  position: relative; width: 100%; height: 480px;
  background: #170e12; border-radius: 12px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid #4a2f3d;
}
#mainCanvas { max-width: 100%; max-height: 100%; object-fit: contain; cursor: crosshair; }

.crop-overlay-box { position: absolute; background: rgba(0,0,0,0.4); }

.crop-box { 
  position: absolute; 
  border: 2px dashed var(--tool-pink-border); 
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.6); 
  inset: 0; 
  cursor: move;
}

.crop-move-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.8);
  font-size: 32px;
  pointer-events: none;
}

.crop-handle { position: absolute; z-index: 10; }

.handle-top { top: -6px; left: 0; right: 0; height: 12px; cursor: ns-resize; }
.handle-bottom { bottom: -6px; left: 0; right: 0; height: 12px; cursor: ns-resize; }
.handle-left { top: 0; bottom: 0; left: -6px; width: 12px; cursor: ew-resize; }
.handle-right { top: 0; bottom: 0; right: -6px; width: 12px; cursor: ew-resize; }

.crop-dot {
  width: 14px; height: 14px; 
  background: var(--tool-pink-border); 
  border: 2px solid #fff; 
  border-radius: 50%; 
  z-index: 11;
}
.handle-tl { top: -7px; left: -7px; cursor: nwse-resize; }
.handle-tr { top: -7px; right: -7px; cursor: nesw-resize; }
.handle-bl { bottom: -7px; left: -7px; cursor: nesw-resize; }
.handle-br { bottom: -7px; right: -7px; cursor: nwse-resize; }

.viewport-footer { display: flex; gap: 10px; margin-top: 14px; }

.control-tabs-nav { display: flex; background: #170e12; padding: 4px; border-radius: 12px; gap: 4px; margin-bottom: 16px; }
.tab-btn { flex: 1; background: transparent; border: none; color: #d4a5b4; padding: 8px 4px; font-size: 11px; font-weight: 700; border-radius: 8px; cursor: pointer; }
.tab-btn.active { background: var(--tool-dim-pink-bg); color: var(--tool-pink-border); }
.tab-panel { display: none; flex-direction: column; gap: 12px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.tab-panel.active { display: flex; }

.eyedropper-btn { background: rgba(242, 140, 163, 0.12); color: var(--tool-pink-border); border: 1px solid var(--tool-pink-border); padding: 10px; border-radius: 20px; font-size: 12px; font-weight: 700; cursor: pointer; transition: 0.2s; }
.eyedropper-btn.active { background: var(--tool-pink-border); color: #170e12; }

.section-title { font-size: 11px; font-weight: 700; color: #d4a5b4; text-transform: uppercase; }
.circle-swatch-grid { display: flex; flex-wrap: wrap; justify-content: space-between; background: #170e12; padding: 10px; border-radius: 30px; border: 1px solid #4a2f3d; }
.circle-swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: 0.2s; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.circle-swatch.active { border-color: var(--tool-pink-border); transform: scale(1.15); box-shadow: 0 0 12px var(--tool-pink-border); }
.circle-swatch.transparent-swatch { background: repeating-conic-gradient(#333 0% 25%, #666 0% 50%) 50% / 12px 12px; }
.circle-swatch.wheel { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); display: flex; align-items: center; justify-content: center; color: #fff; position: relative; }
.circle-swatch.wheel input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

.brush-mode-group { display: flex; gap: 8px; }
.mode-btn { flex: 1; padding: 8px; background: #170e12; border: 1px solid #4a2f3d; color: #d4a5b4; border-radius: 12px; font-size: 12px; font-weight: 700; cursor: pointer; }
.mode-btn.active { background: var(--tool-pink-border); color: #170d14; border-color: var(--tool-pink-border); }

.crop-card-option { display: flex; align-items: center; gap: 12px; background: #170e12; border: 1px solid #4a2f3d; padding: 10px; border-radius: 14px; color: #fff; text-align: left; cursor: pointer; }
.crop-card-option:hover { border-color: var(--tool-pink-border); }
.crop-card-option .icon-box { font-size: 20px; color: var(--tool-pink-border); }
.crop-card-option strong { font-size: 13px; display: block; }
.crop-card-option p { font-size: 11px; color: #d4a5b4; }

.slider-control { display: flex; flex-direction: column; gap: 2px; }
.slider-row-header { display: flex; justify-content: space-between; font-size: 12px; color: #d4a5b4; }
.pro-slider { width: 100%; accent-color: var(--tool-pink-border); cursor: pointer; height: 5px; }

.pro-select {
  width: 100%; background: #170e12; border: 1px solid #4a2f3d; color: #fff;
  padding: 10px; border-radius: 12px; font-size: 12px; cursor: pointer; outline: none;
}
.pro-select option { background: #1e293b; color: #fff; }

.action-btn { padding: 8px 18px; border-radius: 20px; border: none; font-weight: 700; cursor: pointer; font-size: 12px; }
.action-btn.success { background: #16a34a; color: #fff; }
.action-btn.danger { background: #dc2626; color: #fff; }
.action-btn.secondary { background: #4a2f3d; color: #fff; }
.action-btn.full-w { width: 100%; }

.pro-download-btn {
  width: 100%; background: linear-gradient(135deg, var(--tool-pink-border), var(--tool-pink-accent));
  color: #170e12; border: none; padding: 12px; border-radius: 24px;
  font-size: 14px; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px;
}
.link-btn { background: none; border: none; color: var(--tool-pink-border); font-size: 12px; cursor: pointer; margin-top: 4px; }
.border-toggle { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #d4a5b4; cursor: pointer; }
.border-toggle input { accent-color: var(--tool-pink-border); width: 16px; height: 16px; cursor: pointer; }