/* ==========================================================================
   Graphic Resort - AI Image Enhancer
   Brand: light grey page background, white cards, deep blue + orange accents
   ========================================================================== */

.grie-app{
  --grie-ink:#0F1720;
  --grie-slate:#5B6472;
  --grie-blue:#1B4C8C;
  --grie-blue-deep:#0B2545;
  --grie-blue-light:#EAF1FB;
  --grie-orange:#FF7A33;
  --grie-orange-deep:#E85D04;
  --grie-ice:#F6F9FD;
  --grie-page-bg:#F6F6F6;
  --grie-white:#FFFFFF;
  --grie-line:#E6ECF3;
  --grie-radius-lg:22px;
  --grie-radius-md:16px;
  --grie-radius-sm:12px;
  --grie-shadow-sm:0 8px 22px -14px rgba(11,37,69,.28);
  --grie-shadow-md:0 22px 44px -20px rgba(11,37,69,.3);
  --grie-shadow-lg:0 32px 64px -24px rgba(11,37,69,.38);

  background:var(--grie-page-bg);
  color:var(--grie-ink);
  font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  font-size:17px;
  max-width:1300px;
  margin:0 auto;
  padding:22px 20px 26px;
  border-radius:26px;
  line-height:1.6;
}
.grie-app *{ box-sizing:border-box; }
.grie-app h1, .grie-app h2, .grie-app h3{
  font-family:'Space Grotesk','Inter',sans-serif;
  font-weight:700;
  letter-spacing:-0.01em;
  color:var(--grie-blue-deep);
  margin:0;
}
.grie-app button{ font-family:inherit; }
.grie-app svg{ display:block; }

/* ---------- header ---------- */
.grie-head{ text-align:center; margin-bottom:38px; }
.grie-badge{
  display:inline-flex; align-items:center; gap:9px;
  font-size:14px; font-weight:600; color:var(--grie-orange-deep);
  background:rgba(255,122,51,.1);
  border-radius:999px; padding:8px 18px 8px 14px; margin-bottom:18px;
  letter-spacing:.02em;
}
.grie-badge .grie-dot{ width:8px; height:8px; border-radius:50%; background:var(--grie-orange); flex-shrink:0; }
.grie-head h1{ font-size:clamp(27px,3.8vw,38px); margin-bottom:12px; }
.grie-head p{ color:var(--grie-slate); font-size:16.5px; max-width:580px; margin:0 auto; }

/* ---------- grid ---------- */
.grie-grid{ display:grid; grid-template-columns:1.5fr 1fr; gap:28px; align-items:start; }
@media (max-width:960px){ .grie-grid{ grid-template-columns:1fr; } }

/* ---------- cards ---------- */
.grie-card{
  background:var(--grie-white);
  border:1px solid var(--grie-line);
  border-radius:var(--grie-radius-lg);
  padding:28px;
  box-shadow:var(--grie-shadow-sm);
  margin-bottom:24px;
}
.grie-card-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:22px; gap:12px; }
.grie-card-head-tight{ margin-bottom:14px; }
.grie-card h2{ font-size:19px; margin:0; }

.grie-quick-actions{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.grie-text-btn{
  display:inline-flex; align-items:center; gap:7px;
  background:var(--grie-blue-light); color:var(--grie-blue-deep);
  border:none; border-radius:999px; padding:9px 16px;
  font-size:13.5px; font-weight:600; cursor:pointer; transition:background .15s ease, transform .15s ease, opacity .15s ease;
}
.grie-text-btn svg{ width:16px; height:16px; }
.grie-text-btn:hover{ background:#dfeaf9; transform:translateY(-1px); }
.grie-text-btn-muted{ background:var(--grie-ice); color:var(--grie-slate); }
.grie-text-btn-muted:hover{ background:#eceff3; color:var(--grie-blue-deep); }
.grie-text-btn:disabled{ opacity:.4; cursor:not-allowed; transform:none !important; }

/* ---------- Advanced panel - clearly independent card ---------- */
.grie-card-advanced{ margin-top:4px; }
.grie-accordion-toggle{
  width:100%; display:flex; align-items:center; justify-content:space-between;
  background:none; border:none; cursor:pointer; padding:0; text-align:left;
}
.grie-accordion-title{ display:flex; align-items:center; gap:14px; }
.grie-accordion-icon{
  width:42px; height:42px; border-radius:12px; flex-shrink:0;
  background:linear-gradient(135deg,var(--grie-blue),var(--grie-blue-deep));
  display:flex; align-items:center; justify-content:center; color:#fff;
}
.grie-accordion-icon svg{ width:20px; height:20px; }
.grie-accordion-subtitle{ display:block; font-size:13px; color:var(--grie-slate); font-weight:500; margin-top:3px; }
.grie-accordion-chevron{ width:18px; height:18px; color:var(--grie-slate); transition:transform .25s ease; flex-shrink:0; }
.grie-card.grie-open .grie-accordion-chevron{ transform:rotate(180deg); }
.grie-accordion-body{ max-height:0; overflow:hidden; transition:max-height .3s ease; }
.grie-card.grie-open .grie-accordion-body{ margin-top:24px; }

/* ---------- preview box ---------- */
.grie-preview-box{
  position:relative;
  background:var(--grie-white);
  border:1px solid var(--grie-line);
  border-radius:var(--grie-radius-lg);
  min-height:560px;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
  box-shadow:var(--grie-shadow-md);
}
.grie-preview-box.grie-checkerboard .grie-canvas-stage{
  background-image:
    linear-gradient(45deg,#e9edf3 25%,transparent 25%),
    linear-gradient(-45deg,#e9edf3 25%,transparent 25%),
    linear-gradient(45deg,transparent 75%,#e9edf3 75%),
    linear-gradient(-45deg,transparent 75%,#e9edf3 75%);
  background-size:20px 20px;
  background-position:0 0,0 10px,10px -10px,-10px 0;
}

/* dropzone */
.grie-dropzone{
  width:100%; min-height:500px; margin:20px;
  border:2px dashed #C9D6E6; border-radius:var(--grie-radius-md);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  text-align:center; cursor:pointer; padding:32px;
  transition:border-color .18s ease, background .18s ease;
}
.grie-dropzone:hover, .grie-dropzone.grie-drag{
  border-color:var(--grie-orange); background:rgba(255,122,51,.05);
}
.grie-drop-icon{
  width:68px; height:68px; border-radius:18px;
  background:linear-gradient(135deg,var(--grie-blue),var(--grie-blue-deep));
  color:#fff; display:flex; align-items:center; justify-content:center;
  margin-bottom:22px; box-shadow:0 14px 26px -12px rgba(11,37,69,.45);
}
.grie-drop-icon svg{ width:30px; height:30px; }
.grie-dropzone h3{ font-size:21px; margin-bottom:8px; }
.grie-dropzone p{ color:var(--grie-slate); font-size:15px; margin:0; }

/* canvas stage */
.grie-canvas-wrap{ width:100%; height:100%; min-height:560px; display:none; align-items:center; justify-content:center; overflow:auto; padding:24px; }
.grie-preview-box.grie-has-image .grie-dropzone{ display:none; }
.grie-preview-box.grie-has-image .grie-canvas-wrap{ display:flex; }

.grie-canvas-stage{ position:relative; margin:auto; transition:transform .12s ease; }
.grie-canvas-stage canvas{ display:block; max-width:100%; border-radius:10px; }
.grie-canvas-before{ position:absolute; top:0; left:0; clip-path:inset(0 50% 0 0); display:none; }
.grie-preview-box.grie-comparing .grie-canvas-before{ display:block; }
.grie-compare-divider{
  position:absolute; top:0; bottom:0; left:50%; width:3px; background:#fff;
  box-shadow:0 0 0 1px rgba(0,0,0,.12); display:none; pointer-events:none; z-index:3;
}
.grie-compare-handle{
  position:absolute; top:50%; left:50%; width:40px; height:40px; border-radius:50%;
  background:var(--grie-blue-deep); transform:translate(-50%,-50%);
  display:none; align-items:center; justify-content:center; cursor:ew-resize;
  box-shadow:0 10px 22px rgba(0,0,0,.28); pointer-events:auto; z-index:4; touch-action:none;
}
.grie-preview-box.grie-comparing .grie-compare-divider,
.grie-preview-box.grie-comparing .grie-compare-handle{ display:flex; }
.grie-preview-box.grie-comparing .grie-canvas-stage{ cursor:ew-resize; }

/* crop overlay - photoshop-style resizable handles */
.grie-crop-overlay{ position:absolute; inset:0; background:rgba(11,37,69,.4); z-index:6; }
.grie-crop-rect{
  position:absolute; border:2px dashed #fff; box-shadow:0 0 0 2000px rgba(11,37,69,.4);
  top:15%; left:15%; width:70%; height:70%; cursor:move;
}
.grie-crop-handle{
  position:absolute; width:16px; height:16px; background:#fff; border:2px solid var(--grie-orange-deep);
  border-radius:4px; z-index:2;
}
.grie-crop-handle.nw{ top:-9px; left:-9px; cursor:nwse-resize; }
.grie-crop-handle.n { top:-9px; left:calc(50% - 8px); cursor:ns-resize; }
.grie-crop-handle.ne{ top:-9px; right:-9px; cursor:nesw-resize; }
.grie-crop-handle.e { top:calc(50% - 8px); right:-9px; cursor:ew-resize; }
.grie-crop-handle.se{ bottom:-9px; right:-9px; cursor:nwse-resize; }
.grie-crop-handle.s { bottom:-9px; left:calc(50% - 8px); cursor:ns-resize; }
.grie-crop-handle.sw{ bottom:-9px; left:-9px; cursor:nesw-resize; }
.grie-crop-handle.w { top:calc(50% - 8px); left:-9px; cursor:ew-resize; }
.grie-crop-apply-bar button{ font-size:14px; }

/* floating actions */
.grie-float-actions{ position:absolute; top:20px; right:20px; display:flex; gap:9px; z-index:5; }
.grie-chip{
  display:inline-flex; align-items:center; gap:7px;
  background:rgba(255,255,255,.95); backdrop-filter:blur(6px);
  border:1px solid var(--grie-line); color:var(--grie-blue-deep);
  border-radius:999px; padding:10px 16px; font-size:13.5px; font-weight:600;
  cursor:pointer; box-shadow:var(--grie-shadow-sm); transition:transform .15s ease, border-color .15s ease;
}
.grie-chip svg{ width:16px; height:16px; }
.grie-chip:hover{ transform:translateY(-2px); border-color:var(--grie-orange); color:var(--grie-orange-deep); }

/* toolbar */
.grie-toolbar{
  display:flex; flex-wrap:wrap; gap:12px; align-items:center;
  background:var(--grie-white); border:1px solid var(--grie-line); border-radius:var(--grie-radius-md);
  padding:12px 14px; margin-top:16px; box-shadow:var(--grie-shadow-sm);
}
.grie-toolbar-group{ display:flex; align-items:center; gap:5px; padding-right:12px; border-right:1px solid var(--grie-line); }
.grie-toolbar-group:last-child{ border-right:none; }
.grie-toolbar button{
  border:none; background:transparent; color:var(--grie-slate);
  width:42px; height:42px; border-radius:11px; display:flex; align-items:center; justify-content:center;
  cursor:pointer; transition:background .15s ease, color .15s ease;
  font-size:13.5px; font-weight:600; padding:0 12px;
}
.grie-toolbar button svg{ width:19px; height:19px; }
.grie-toolbar button[data-grie-action="zoom-fit"],
.grie-toolbar button[data-grie-action="zoom-100"],
.grie-toolbar button[data-grie-action="compare-toggle"]{ width:auto; }
.grie-toolbar button:hover:not(:disabled){ background:var(--grie-blue-light); color:var(--grie-blue-deep); }
.grie-toolbar button:disabled{ opacity:.35; cursor:not-allowed; }
.grie-toolbar button.grie-active{ background:var(--grie-orange); color:#fff; }
.grie-zoom-val{ font-size:13.5px; color:var(--grie-slate); font-weight:600; width:50px; text-align:center; }
.grie-toolbar-tip-wrap{ display:flex; align-items:center; gap:2px; }

/* info tooltip (?) */
.grie-info-tip{
  position:relative; display:inline-flex; align-items:center; justify-content:center;
  width:26px; height:26px; border-radius:50%; color:var(--grie-slate); cursor:help;
  background:var(--grie-ice); flex-shrink:0;
}
.grie-info-tip svg{ width:16px; height:16px; }
.grie-info-tip .grie-tip-bubble{
  position:absolute; bottom:calc(100% + 10px); left:50%; transform:translateX(-50%) translateY(6px);
  background:var(--grie-blue-deep); color:#fff; font-size:13px; font-weight:500; line-height:1.5;
  padding:12px 14px; border-radius:12px; width:260px; text-align:left;
  box-shadow:0 16px 32px -10px rgba(11,37,69,.5);
  opacity:0; visibility:hidden; transition:opacity .18s ease, transform .18s ease; z-index:20;
}
.grie-info-tip .grie-tip-bubble::after{
  content:""; position:absolute; top:100%; left:50%; transform:translateX(-50%);
  border:6px solid transparent; border-top-color:var(--grie-blue-deep);
}
.grie-info-tip:hover .grie-tip-bubble,
.grie-info-tip:focus .grie-tip-bubble,
.grie-info-tip.grie-tip-open .grie-tip-bubble{
  opacity:1; visibility:visible; transform:translateX(-50%) translateY(0);
}

/* info row */
.grie-info-row{ display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-top:16px; }
.grie-info-chip{
  background:var(--grie-ice); border:1px solid var(--grie-line); border-radius:var(--grie-radius-sm);
  padding:12px 14px; text-align:center;
}
.grie-info-chip span{ display:block; font-size:12px; color:var(--grie-slate); margin-bottom:4px; }
.grie-info-chip b{ font-size:14.5px; color:var(--grie-blue-deep); }
@media (max-width:560px){ .grie-info-row{ grid-template-columns:repeat(2,1fr); } }

/* histogram */
.grie-histogram-card canvas{ width:100%; height:120px; border-radius:var(--grie-radius-sm); background:var(--grie-ice); }

/* ---------- controls panel ---------- */
.grie-control{ margin-bottom:20px; }
.grie-control:last-of-type{ margin-bottom:18px; }
.grie-control label{
  display:flex; justify-content:space-between; font-size:14.5px; color:var(--grie-slate);
  margin-bottom:10px; font-weight:500;
}
.grie-val{ color:var(--grie-orange-deep); font-weight:700; font-variant-numeric:tabular-nums; }
.grie-label-block{ display:block; font-size:14.5px; color:var(--grie-slate); font-weight:500; margin-bottom:12px; }

input[type="range"]{
  -webkit-appearance:none; appearance:none; width:100%; height:7px; border-radius:999px;
  background:linear-gradient(90deg,var(--grie-blue) var(--grie-fill,50%),var(--grie-line) var(--grie-fill,50%));
  outline:none; cursor:pointer;
}
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none; width:24px; height:24px; border-radius:50%;
  background:#fff; border:4px solid var(--grie-blue-deep); cursor:pointer;
  box-shadow:0 2px 10px rgba(11,37,69,.4); transition:transform .12s ease;
}
input[type="range"]::-webkit-slider-thumb:hover{ transform:scale(1.14); }
input[type="range"]::-moz-range-thumb{
  width:24px; height:24px; border-radius:50%; background:#fff; border:4px solid var(--grie-blue-deep); cursor:pointer;
}
input[type="range"]::-moz-range-track{ height:7px; border-radius:999px; background:var(--grie-line); }

/* segmented control */
.grie-segmented{ display:flex; gap:8px; margin-bottom:26px; }
.grie-segmented button{
  flex:1; text-align:center; padding:13px 10px; border:1px solid var(--grie-line);
  background:var(--grie-white); border-radius:var(--grie-radius-sm); font-size:14.5px; font-weight:600;
  color:var(--grie-slate); cursor:pointer; transition:all .15s ease;
}
.grie-segmented button:hover{ border-color:var(--grie-blue); }
.grie-segmented button.grie-active{
  border-color:transparent; color:#fff;
  background:linear-gradient(135deg,var(--grie-blue),var(--grie-blue-deep));
  box-shadow:0 10px 22px -8px rgba(27,76,140,.5);
}

/* buttons */
.grie-btn{
  font-weight:700; font-size:16px; padding:16px 26px; border-radius:999px;
  border:none; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; gap:9px;
  transition:transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.grie-btn:disabled{ opacity:.4; cursor:not-allowed; transform:none !important; }
.grie-w-100{ width:100%; }
.grie-btn-primary{
  background:linear-gradient(135deg,var(--grie-orange),var(--grie-orange-deep)); color:#fff;
  box-shadow:0 18px 34px -10px rgba(232,93,4,.55);
}
.grie-btn-primary:hover:not(:disabled){ transform:translateY(-3px); box-shadow:0 22px 40px -10px rgba(232,93,4,.6); }
.grie-btn-ghost{ background:var(--grie-white); border:1.5px solid var(--grie-line); color:var(--grie-blue-deep); }
.grie-btn-ghost:hover:not(:disabled){ border-color:var(--grie-orange); color:var(--grie-orange-deep); }

.grie-note{ font-size:13px; color:var(--grie-slate); text-align:center; margin-top:18px; line-height:1.7; }

/* spinner */
.grie-spinner{
  width:18px; height:18px; border-radius:50%; border:2.5px solid rgba(255,255,255,.4);
  border-top-color:#fff; animation:grie-spin .7s linear infinite;
}
@keyframes grie-spin{ to{ transform:rotate(360deg); } }

/* progress bar */
.grie-progress{ height:5px; background:var(--grie-line); border-radius:999px; margin-top:16px; overflow:hidden; }
.grie-progress-bar{ height:100%; width:0%; background:linear-gradient(90deg,var(--grie-blue),var(--grie-orange)); transition:width .2s ease; }

/* download bar */
.grie-download-bar{ margin-top:10px; padding:32px 0 8px; text-align:center; }
.grie-download-inner{
  display:flex; align-items:flex-end; justify-content:center; gap:18px; flex-wrap:wrap;
}
.grie-download-option{ text-align:left; min-width:160px; }
.grie-download-option label{ display:flex; justify-content:space-between; font-size:13.5px; color:var(--grie-slate); font-weight:500; margin-bottom:9px; }
.grie-download-option select{
  width:100%; padding:14px 16px; border-radius:var(--grie-radius-sm); border:1px solid var(--grie-line);
  background:var(--grie-white); font-size:15px; font-weight:600; color:var(--grie-blue-deep); cursor:pointer;
}
.grie-quality-option{ width:200px; }
.grie-download-btn{ padding:18px 38px; font-size:17px; }
.grie-download-btn svg{ width:20px; height:20px; }

/* fullscreen mode */
.grie-preview-box:fullscreen{ background:#0B0D12; border-radius:0; }
.grie-preview-box:fullscreen .grie-canvas-wrap{ min-height:100vh; }

/* responsive */
@media (max-width:640px){
  .grie-app{ padding:14px 10px; font-size:16px; }
  .grie-card{ padding:20px; }
  .grie-preview-box{ min-height:380px; }
  .grie-dropzone{ min-height:320px; margin:14px; padding:22px; }
  .grie-canvas-wrap{ min-height:380px; padding:14px; }
  .grie-download-inner{ flex-direction:column; align-items:stretch; }
  .grie-quality-option{ width:100%; }
  .grie-toolbar-group{ padding-right:8px; }
  .grie-info-tip .grie-tip-bubble{ width:220px; }
}
