:root {
  --bg: #f6f8fc;
  --card: #ffffff;
  --text: #172033;
  --muted: #718096;
  --line: #e5eaf1;

  --primary: #1684ff;
  --primary-dark: #0869d4;

  --success: #0e9f6e;
  --danger: #d33b3b;

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

/* =========================================================
   RESET
========================================================= */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(
      circle at 50% -10%,
      rgba(22, 132, 255, 0.07),
      transparent 35%
    ),
    var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

/* =========================================================
   TOP BAR
========================================================= */

.topbar {
  height: 68px;

  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  border-bottom: 1px solid rgba(229, 234, 241, 0.9);

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 30px;

  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;

  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 35px;
  height: 35px;

  display: grid;
  place-items: center;

  border-radius: 11px;

  background: linear-gradient(
    135deg,
    #1684ff,
    #55a8ff
  );

  color: white;

  font-size: 12px;
  font-weight: 900;

  box-shadow:
    0 8px 18px rgba(22, 132, 255, 0.22),
    inset 0 1px 1px rgba(255, 255, 255, 0.35);
}

.admin-link {
  color: #526071;

  text-decoration: none;

  font-size: 14px;
  font-weight: 700;

  padding: 8px 12px;

  border-radius: 9px;

  transition:
    color 0.2s ease,
    background 0.2s ease;
}

.admin-link:hover {
  color: var(--primary);
  background: #edf6ff;
}

/* =========================================================
   MAIN CONTAINER
========================================================= */

.container {
  width: min(1100px, calc(100% - 40px));

  margin: 0 auto;

  padding: 52px 0 70px;
}

.narrow {
  width: min(900px, calc(100% - 40px));
}

/* =========================================================
   HERO
========================================================= */

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;

  gap: 25px;

  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 9px;

  color: var(--primary);

  font-size: 11px;
  font-weight: 900;

  letter-spacing: 0.16em;
}

h1 {
  margin: 0 0 11px;

  font-size: 36px;
  line-height: 1.1;

  letter-spacing: -0.035em;
}

h2 {
  margin: 0 0 7px;

  font-size: 20px;

  letter-spacing: -0.02em;
}

.muted {
  color: var(--muted);

  line-height: 1.65;

  font-size: 14px;
}

.small {
  color: #97a2b2;

  font-size: 12px;
}

/* =========================================================
   STATUS PILL
========================================================= */

.status-pill {
  flex-shrink: 0;

  padding: 9px 13px;

  border: 1px solid #dbeaff;

  border-radius: 999px;

  background: #f2f8ff;

  color: #126bc4;

  font-size: 12px;
  font-weight: 800;

  white-space: nowrap;
}

/* =========================================================
   MODERN UPLOAD DROPZONE
========================================================= */

.dropzone {
  position: relative;

  min-height: 350px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding: 65px 30px;

  text-align: center;

  cursor: pointer;

  overflow: hidden;

  background:
    radial-gradient(
      circle at 50% 0%,
      rgba(22, 132, 255, 0.11),
      transparent 42%
    ),
    #ffffff;

  border: 1.5px dashed #c8d4e3;

  border-radius: 26px;

  box-shadow:
    0 8px 35px rgba(28, 43, 68, 0.045);

  transition:
    border-color 0.25s ease,
    background 0.25s ease,
    box-shadow 0.25s ease,
    transform 0.25s ease;
}

/*
  Subtle grid effect
*/

.dropzone::before {
  content: "";

  position: absolute;

  inset: 0;

  pointer-events: none;

  background-image:
    linear-gradient(
      rgba(148, 163, 184, 0.075) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(148, 163, 184, 0.075) 1px,
      transparent 1px
    );

  background-size: 34px 34px;

  mask-image:
    linear-gradient(
      to bottom,
      black,
      transparent 90%
    );

  -webkit-mask-image:
    linear-gradient(
      to bottom,
      black,
      transparent 90%
    );
}

/*
  Top glow
*/

.dropzone::after {
  content: "";

  position: absolute;

  width: 240px;
  height: 240px;

  top: -150px;

  border-radius: 50%;

  background: rgba(22, 132, 255, 0.08);

  filter: blur(35px);

  pointer-events: none;
}

/* =========================================================
   DROPZONE HOVER
========================================================= */

.dropzone:hover {
  border-color: #1684ff;

  background:
    radial-gradient(
      circle at 50% 0%,
      rgba(22, 132, 255, 0.15),
      transparent 48%
    ),
    #ffffff;

  box-shadow:
    0 20px 55px rgba(22, 132, 255, 0.10);

  transform: translateY(-2px);
}

/* =========================================================
   DRAG STATE
========================================================= */

.dropzone.drag {
  border-color: #1684ff;

  background:
    radial-gradient(
      circle at 50% 0%,
      rgba(22, 132, 255, 0.16),
      transparent 50%
    ),
    #f4f9ff;

  box-shadow:
    0 0 0 5px rgba(22, 132, 255, 0.07),
    0 25px 65px rgba(22, 132, 255, 0.13);

  transform: scale(1.01);
}

/* =========================================================
   UPLOAD ICON
========================================================= */

.upload-icon {
  position: relative;
  z-index: 2;

  width: 72px;
  height: 72px;

  display: grid;
  place-items: center;

  margin-bottom: 18px;

  border-radius: 21px;

  background:
    linear-gradient(
      135deg,
      #1684ff,
      #62afff
    );

  color: #ffffff;

  font-size: 32px;
  font-weight: 400;

  box-shadow:
    0 15px 30px rgba(22, 132, 255, 0.25),
    inset 0 1px 1px rgba(255, 255, 255, 0.4);

  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

.dropzone:hover .upload-icon {
  transform:
    translateY(-5px)
    scale(1.04);

  box-shadow:
    0 20px 35px rgba(22, 132, 255, 0.30),
    inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

/* =========================================================
   DROPZONE TEXT
========================================================= */

.dropzone h2 {
  position: relative;
  z-index: 2;

  margin: 0 0 8px;

  font-size: 23px;
  font-weight: 850;

  letter-spacing: -0.025em;
}

.dropzone p {
  position: relative;
  z-index: 2;

  margin: 7px 0;
}

/* =========================================================
   CHOOSE FILE BUTTON
========================================================= */

.text-button {
  border: 0;

  background: #edf6ff;

  color: #0877ed;

  padding: 8px 14px;

  border-radius: 9px;

  font-size: 13px;
  font-weight: 800;

  cursor: pointer;

  transition:
    background 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.text-button:hover {
  background: #dceeff;

  box-shadow:
    0 5px 14px rgba(22, 132, 255, 0.10);

  transform: translateY(-1px);
}

/* =========================================================
   WORKSPACE
========================================================= */

.workspace {
  display: grid;

  grid-template-columns:
    minmax(0, 1.5fr)
    minmax(320px, 0.8fr);

  gap: 22px;

  margin-top: 22px;

  align-items: start;
}

/* =========================================================
   CARD
========================================================= */

.card {
  background: rgba(255, 255, 255, 0.96);

  border: 1px solid var(--line);

  border-radius: 20px;

  padding: 25px;

  box-shadow:
    0 8px 30px rgba(28, 43, 68, 0.045);
}

.card-head {
  display: flex;

  align-items: flex-start;
  justify-content: space-between;

  gap: 20px;

  margin-bottom: 20px;
}

/* =========================================================
   PREVIEW
========================================================= */

.preview-wrap {
  min-height: 380px;

  display: grid;
  place-items: center;

  padding: 15px;

  background:
    linear-gradient(
      45deg,
      #edf0f4 25%,
      transparent 25%
    ),
    linear-gradient(
      -45deg,
      #edf0f4 25%,
      transparent 25%
    ),
    linear-gradient(
      45deg,
      transparent 75%,
      #edf0f4 75%
    ),
    linear-gradient(
      -45deg,
      transparent 75%,
      #edf0f4 75%
    );

  background-size: 22px 22px;

  background-position:
    0 0,
    0 11px,
    11px -11px,
    -11px 0;

  border-radius: 15px;
}

.preview-stage {
  max-width: 100%;
  max-height: 560px;

  display: flex;

  align-items: center;
  justify-content: center;

  overflow: hidden;
}

.preview-stage canvas {
  display: block;

  max-width: 100%;
  max-height: 540px;

  border-radius: 10px;

  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.15);
}

/* =========================================================
   CONTROL GRID
========================================================= */

.control-grid {
  display: grid;

  grid-template-columns: 1fr 1fr;

  gap: 17px;

  margin-top: 19px;
}

.control-grid label,
.settings-form label,
form label {
  display: grid;

  gap: 8px;

  color: #4d5768;

  font-size: 12px;
  font-weight: 800;
}

.control-grid label span,
.settings-form label span {
  color: var(--primary);

  float: right;

  font-weight: 900;
}

/* =========================================================
   INPUTS
========================================================= */

select,
input[type="password"],
input[type="text"],
input[type="url"] {
  width: 100%;

  padding: 11px 12px;

  background: #ffffff;

  border: 1px solid #dce3ec;

  border-radius: 10px;

  outline: none;

  color: var(--text);

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

select:focus,
input[type="password"]:focus,
input[type="text"]:focus,
input[type="url"]:focus {
  border-color: #76b7ff;

  box-shadow:
    0 0 0 4px rgba(22, 132, 255, 0.08);
}

input[type="range"] {
  width: 100%;

  accent-color: var(--primary);

  cursor: pointer;
}

/* =========================================================
   FILE META
========================================================= */

.file-meta {
  margin-top: 16px;

  padding: 10px 12px;

  background: #f7f9fc;

  border: 1px solid #edf0f4;

  border-radius: 9px;

  color: #7c8796;

  font-size: 12px;
}

/* =========================================================
   BUTTONS
========================================================= */

.primary,
.secondary,
.ghost,
.danger {
  border: 0;

  border-radius: 11px;

  padding: 12px 16px;

  font-size: 13px;

  font-weight: 800;

  cursor: pointer;

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.primary {
  color: #ffffff;

  background:
    linear-gradient(
      135deg,
      #1684ff,
      #0875e8
    );

  box-shadow:
    0 8px 18px rgba(22, 132, 255, 0.20);
}

.primary:hover {
  background:
    linear-gradient(
      135deg,
      #0878ed,
      #0668d1
    );

  box-shadow:
    0 12px 25px rgba(22, 132, 255, 0.27);

  transform: translateY(-1px);
}

.primary:disabled {
  opacity: 0.65;

  cursor: not-allowed;

  transform: none;

  box-shadow: none;
}

.secondary {
  background: #edf4fb;

  color: #1668ae;
}

.secondary:hover {
  background: #e3eef9;

  transform: translateY(-1px);
}

.ghost {
  background: #f3f6f9;

  color: #536071;
}

.ghost:hover {
  background: #e9eef4;

  transform: translateY(-1px);
}

.danger {
  color: var(--danger);

  background: #fff1f1;
}

.danger:hover {
  background: #ffe5e5;
}

/* =========================================================
   UPLOAD BUTTON
========================================================= */

.upload-btn {
  width: 100%;

  margin-top: 19px;

  min-height: 48px;
}

/* =========================================================
   PROGRESS
========================================================= */

.progress {
  width: 100%;

  height: 7px;

  margin-top: 15px;

  overflow: hidden;

  background: #e9eef4;

  border-radius: 999px;
}

.progress div {
  height: 100%;

  width: 0;

  border-radius: inherit;

  background:
    linear-gradient(
      90deg,
      #1684ff,
      #65b1ff
    );

  transition: width 0.25s ease;
}

/* =========================================================
   ERROR / SUCCESS
========================================================= */

.success {
  color: var(--success);

  font-weight: 850;

  font-size: 13px;
}

.error {
  color: var(--danger);

  font-size: 13px;

  line-height: 1.5;
}

/* =========================================================
   RESULT CARD
========================================================= */

.result-card {
  grid-column: 2;

  position: sticky;

  top: 90px;
}

.result-card h2 {
  margin-top: 8px;
}

.result-image {
  width: 100%;

  max-height: 350px;

  object-fit: contain;

  margin: 12px 0 19px;

  padding: 8px;

  background: #f3f5f8;

  border: 1px solid #e8edf2;

  border-radius: 13px;
}

/* =========================================================
   LINK ROW
========================================================= */

.link-row {
  margin: 15px 0;
}

.link-row label {
  display: block;

  margin-bottom: 7px;

  color: #7a8595;

  font-size: 11px;

  font-weight: 850;

  text-transform: uppercase;

  letter-spacing: 0.05em;
}

.copy-row {
  display: flex;

  gap: 7px;
}

.copy-row input {
  min-width: 0;

  flex: 1;

  background: #f7f9fb;

  border: 1px solid #e1e7ee;

  border-radius: 9px;

  color: #475569;

  font-size: 12px;
}

.copy-row button {
  flex-shrink: 0;

  border: 0;

  padding: 0 14px;

  background: #e9f3ff;

  color: #126bc4;

  border-radius: 9px;

  font-size: 12px;

  font-weight: 850;

  cursor: pointer;

  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.copy-row button:hover {
  background: #dceeff;

  transform: translateY(-1px);
}

.result-card .secondary {
  width: 100%;

  margin-top: 9px;
}

/* =========================================================
   ADMIN PANEL
========================================================= */

form {
  display: grid;

  gap: 16px;

  max-width: 460px;
}

.admin-grid {
  display: grid;

  grid-template-columns: 1fr 1fr;

  gap: 30px;
}

.watermark-upload {
  min-height: 300px;

  display: grid;
  place-items: center;

  padding: 20px;

  text-align: center;

  background:
    linear-gradient(
      135deg,
      #f9fbfd,
      #f4f7fa
    );

  border: 2px dashed #c7d2e2;

  border-radius: 16px;

  cursor: pointer;

  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}

.watermark-upload:hover {
  border-color: var(--primary);

  background: #f4f9ff;
}

.watermark-upload strong {
  display: block;

  font-size: 15px;
}

.watermark-upload span {
  display: block;

  margin: 7px 0 15px;

  color: var(--muted);

  font-size: 12px;
}

.wm-preview {
  max-width: 100%;

  max-height: 270px;

  object-fit: contain;
}

.settings-form {
  display: grid;

  gap: 18px;
}

.settings-form .primary {
  margin-top: 4px;
}

/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 850px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .result-card {
    grid-column: auto;

    position: static;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    display: block;
  }

  .status-pill {
    display: inline-block;

    margin-top: 14px;
  }
}

/* =========================================================
   TABLET
========================================================= */

@media (max-width: 650px) {
  .topbar {
    height: 62px;

    padding: 0 16px;
  }

  .container,
  .narrow {
    width: min(
      100% - 28px,
      1100px
    );

    padding-top: 32px;
  }

  h1 {
    font-size: 29px;
  }

  .dropzone {
    min-height: 310px;

    padding: 50px 18px;

    border-radius: 21px;
  }

  .upload-icon {
    width: 64px;
    height: 64px;

    border-radius: 19px;
  }

  .control-grid {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 19px;

    border-radius: 17px;
  }

  .card-head {
    display: block;
  }

  .card-head .ghost {
    margin-top: 12px;
  }

  .preview-wrap {
    min-height: 280px;
  }
}

/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 420px) {
  .brand {
    font-size: 13px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .admin-link {
    font-size: 13px;
  }

  h1 {
    font-size: 26px;
  }

  .dropzone h2 {
    font-size: 20px;
  }

  .dropzone {
    min-height: 290px;
  }

  .copy-row {
    flex-direction: column;
  }

  .copy-row button {
    min-height: 40px;
  }
}

/* ================================
   Upload Progress
================================ */

.upload-progress {
  width: 100%;
  margin: 18px 0;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-sizing: border-box;
}

.upload-progress.hidden {
  display: none !important;
}

.upload-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 14px;
}

.upload-progress-header strong {
  font-size: 14px;
}

.upload-progress-track {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(128, 128, 128, 0.2);
}

.upload-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    #0ea5e9,
    #6366f1
  );
  transition: width 0.25s ease;
}

.upload-progress-status {
  margin-top: 10px;
  font-size: 13px;
  opacity: 0.7;
  text-align: center;
}