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

body {
   background: #111;
   min-height: 100vh;
   display: flex;
   justify-content: center;
   align-items: center;
   flex-direction: column;
   gap: 25px;
   font-family: Poppins, Arial, sans-serif;
   padding: 20px;
}

.card-viewport {
   width: min(100%, 1080px);
   display: flex;
   justify-content: center;
   align-items: flex-start;
}

.card-scale-frame {
   width: 1080px;
   height: 1440px;
   transform-origin: top center;
}
.actions-row {
    position: fixed;
    bottom: 30px;

   width: min(100%, 1080px);
   display: flex;
   justify-content: center;
   flex-wrap: wrap;
   gap: 12px;
}

.action-btn {
   flex: 0 1 auto;
}

.mobile-filter-actions,
.mobile-panel-backdrop {
   display: none;
}

.mobile-filter-actions {
   position: fixed;
   left: 12px;
   right: 12px;
   bottom: 12px;
   z-index: 10030;
   gap: 10px;
}

.mobile-filter-toggle {
   flex: 1 1 0;
   display: inline-flex;
   align-items: center;
   justify-content: center;
   gap: 8px;
   padding: 12px 14px;
   border-radius: 14px;
   background: rgba(8, 18, 28, 0.92);
   color: #fff;
   border: 1px solid rgba(255, 255, 255, 0.08);
   box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
   font-size: 14px;
   font-weight: 800;
}

.mobile-filter-toggle.active {
   background: linear-gradient(135deg, #0cc8b1, #0d7dcf);
   color: #fff;
}

.mobile-filter-icon {
   width: 18px;
   height: 18px;
   display: inline-flex;
}

.mobile-filter-icon svg {
   width: 100%;
   height: 100%;
   stroke: currentColor;
   fill: none;
   stroke-width: 1.8;
   stroke-linecap: round;
   stroke-linejoin: round;
}

.mobile-panel-backdrop {
   position: fixed;
   inset: 0;
   z-index: 10010;
   background: rgba(0, 0, 0, 0.52);
   border: 0;
   padding: 0;
   margin: 0;
   appearance: none;
}

.cat-btn {
   padding: 8px 12px;
   border-radius: 10px;
   background: rgba(255, 255, 255, 0.06);
   color: #fff;
   font-weight: 700;
   opacity: 0.8;
}

.banner {
   width: 100%;
   display: flex;
   justify-content: center;
   margin-top: 10px;
}

.banner-inner {
   width: 70%;
   background: linear-gradient(90deg, #064393, #4a98ff);
   padding: 8px 18px;
   border-radius: 8px;
   display: flex;
   align-items: center;
   gap: 12px;
   justify-content: center;
   box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.banner .brand {
   font-weight: 900;
   color: #04263a;
   background: rgba(255, 255, 255, 0.2);
   padding: 6px 10px;
   border-radius: 6px;
}

.banner .banner-text {
   font-weight: 800;
   color: #04263a;
}

.big-brand {
   font-size: 20px;
   font-weight: 900;
   color: #fff;
   opacity: 0.9;
}

button {
   border: none;
   background: #03C3A9;
   color: #111;
   font-size: 24px;
   font-weight: 800;
   padding: 18px 40px;
   border-radius: 18px;
   cursor: pointer;
   transition: 0.25s;
}

/* Search input and dropdown */
.search {
   width: 210px;
   max-width: 100%;
}

.search-input {
   width: 320px;
   max-width: 100%;
   padding: 10px 12px;
   border-radius: 10px;
   border: 1px solid rgba(255, 255, 255, 0.06);
   background: rgba(255, 255, 255, 0.03);
   color: #fff;
   font-weight: 600;
}

.search-input::placeholder {
   color: rgba(255, 255, 255, 0.5);
}

.search-dropdown {
   position: absolute;
   right: 0;
   top: calc(100% + 8px);
   background: rgba(6, 30, 46, 0.98);
   border-radius: 10px;
   box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
   overflow: hidden;
   max-height: 300px;
   overflow-y: auto;
   z-index: 9999;
   min-width: 260px;
}

.search-item {
   padding: 10px 12px;
   border-bottom: 1px solid rgba(255, 255, 255, 0.03);
   color: #fff;
   cursor: pointer;
   display: flex;
   align-items: center;
   gap: 10px;
}

.search-item:hover {
   background: rgba(255, 255, 255, 0.02);
}

.search-item .meta {
   opacity: 0.85;
   font-size: 13px;
}

.search-empty {
   padding: 12px;
   color: rgba(255, 255, 255, 0.6);
}

/* Left sticky bar */
.left-bar {
   position: fixed;
   left: 18px;
   top: 50%;
   transform: translateY(-50%);
   width: 240px;
   background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
   border-radius: 14px;
   padding: 14px;
   z-index: 10000;
   color: #fff;
   box-shadow: 0 18px 40px rgba(2, 8, 20, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.02);
   backdrop-filter: blur(8px) saturate(120%);
   border: 1px solid rgba(255, 255, 255, 0.04);
}

.right-bar {
   position: fixed;
   right: 18px;
   top: 50%;
   transform: translateY(-50%);
   width: 240px;
   background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
   border-radius: 14px;
   padding: 14px;
   z-index: 10000;
   color: #fff;
   box-shadow: 0 18px 40px rgba(2, 8, 20, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.02);
   backdrop-filter: blur(8px) saturate(120%);
   border: 1px solid rgba(255, 255, 255, 0.04);
}

.right-bar h4 {
   margin: 6px 0 10px 0;
   font-size: 18px;
   letter-spacing: 0.6px;
}

.right-bar .control {
   margin-bottom: 12px;
   display: flex;
   flex-direction: column;
   gap: 8px;
}

.right-bar .control-row {
   gap: 8px;
}

.right-bar .control-label {
   font-size: 13px;
   font-weight: 700;
   opacity: 0.9;
}

.left-bar h4 {
   margin: 6px 0 10px 0;
   font-size: 18px;
   letter-spacing: 0.6px;
}

.left-bar .control {
   margin-bottom: 12px;
   display: flex;
   flex-direction: column;
   gap: 8px;
}

.left-bar .control-row {
   gap: 8px;
}

.left-bar .control-label {
   font-size: 13px;
   font-weight: 700;
   opacity: 0.9;
}

.left-bar input[type="file"] {
   display: none;
}

.left-bar input[type="date"] {
   width: 100%;
   padding: 8px 10px;
   border-radius: 10px;
   border: 1px solid rgba(255, 255, 255, 0.12);
   background: rgba(255, 255, 255, 0.06);
   color: #fff;
   font-weight: 600;
   font-size: 13px;
}

.left-bar .file-btn {
   display: inline-flex;
   align-items: center;
   gap: 8px;
   padding: 8px 10px;
   background: linear-gradient(90deg, #e6f7ff, #d6eeff);
   color: #04263a;
   font-weight: 700;
   border-radius: 10px;
   cursor: pointer;
   box-shadow: 0 6px 18px rgba(3, 60, 90, 0.12);
   border: 1px solid rgba(3, 60, 90, 0.06);
   font-size: 13px;
}

.left-bar .file-btn:hover {
   transform: translateY(-3px);
}

.left-bar .small-btn {
   padding: 6px 8px;
   font-size: 13px;
   border-radius: 8px;
   background: transparent;
   color: #fff;
   border: 1px solid rgba(255, 255, 255, 0.06);
}

.left-bar .small-btn:hover {
   background: rgba(255, 255, 255, 0.03);
}

.left-bar .preview {
   width: 100%;
   height: 84px;
   background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0.02));
   border-radius: 10px;
   background-size: cover;
   background-position: center;
   border: 1px solid rgba(255, 255, 255, 0.04);
   display: flex;
   align-items: center;
   justify-content: center;
   color: rgba(255, 255, 255, 0.6);
   font-size: 13px;
}

/* ensure previews don't affect other images */
.left-bar .preview img {
   width: 100%;
   height: 100%;
   object-fit: cover;
   border-radius: 8px;
}

button:hover {
   transform: translateY(-4px);
}

.copy-btn {
   background: linear-gradient(90deg, #2b9cff, #0066ff);
   color: #fff;
   font-size: 16px;
   font-weight: 800;
   padding: 12px 20px;
   border-radius: 12px;
}

.toast {
   position: fixed;
   left: 50%;
   transform: translateX(-50%);
   bottom: 36px;
   background: rgba(0, 0, 0, 0.85);
   color: #fff;
   padding: 10px 14px;
   border-radius: 10px;
   box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
   opacity: 0;
   transition: opacity 220ms ease;
   z-index: 9999;
   pointer-events: none;
}

.toast.show {
   opacity: 1;
   pointer-events: auto;
}

/* Loader overlay */
.loader {
   position: fixed;
   inset: 0;
   display: flex;
   align-items: center;
   justify-content: center;
   background: rgba(0, 0, 0, 0.5);
   z-index: 10000;
   opacity: 0;
   transition: opacity 200ms ease;
   pointer-events: none;
}

.loader.show {
   opacity: 1;
   pointer-events: auto;
}

.spinner {
   width: 56px;
   height: 56px;
   border-radius: 50%;
   border: 6px solid rgba(255, 255, 255, 0.12);
   border-top-color: #ffffff;
   animation: spin 900ms linear infinite;
   box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}


.thumb-picker {
   display: flex;
   flex-wrap: wrap;
   gap: 10px;
}

.thumb-picker button {
   width: 84px;
   height: 84px;
   padding: 0;
   border-radius: 12px;
   overflow: hidden;
   border: 2px solid transparent;
   background: rgba(255, 255, 255, 0.04);
   display: flex;
   align-items: stretch;
   justify-content: stretch;
   cursor: pointer;
}

.thumb-picker button img {
   width: 100%;
   height: 100%;
   object-fit: cover;
   display: block;
}

.thumb-picker button.active {
   border-color: #03c3a9;
   box-shadow: 0 0 0 3px rgba(3, 195, 169, 0.18);
}

@media (max-width: 1200px) {
   body {
      padding-left: 260px;
      padding-right: 260px;
   }

   #controls {
      width: 100% !important;
      max-width: 1080px;
   }

   .controls-row {
      width: 100%;
      gap: 16px;
   }

   .search {
      width: 100%;
      max-width: 320px;
   }

   .search-input {
      width: 100%;
   }
}

@media (max-width: 980px) {
   body {
      padding: 14px;
      gap: 18px;
      padding-top: 260px;
      padding-bottom: 220px;
   }

   #controls {
      order: 0;
   }

   .controls-row {
      flex-direction: column;
      align-items: stretch !important;
   }

   #categories {
      width: 100%;
      margin-bottom: 12px !important;
   }

   #search {
      width: 100%;
   }

   .search-dropdown {
      left: 0;
      right: auto;
      width: 100% !important;
      min-width: 0;
   }

   .left-bar,
   .right-bar {
      top: 12px;
      transform: none;
      width: calc(50vw - 20px);
      max-width: none;
      padding: 12px;
   }

   .left-bar {
      left: 12px;
   }

   .right-bar {
      right: 12px;
   }

   .left-bar h4,
   .right-bar h4 {
      font-size: 16px;
      margin-bottom: 8px;
   }

   .thumb-picker {
      gap: 8px;
   }

   .thumb-picker button {
      width: calc(50% - 4px);
      height: 66px;
   }

   .card-viewport {
      width: 100%;
   }

   button {
      font-size: 18px;
      padding: 12px 18px;
      border-radius: 14px;
   }
}

@media (max-width: 640px) {
   body {
      padding: 12px;
      padding-bottom: 86px;
   }

   .mobile-filter-actions {
      display: flex;
   }

   .mobile-panel-backdrop.is-visible {
      display: block;
   }

   .left-bar,
   .right-bar {
      position: fixed;
      left: 12px;
      right: 12px;
      bottom: 74px;
      top: auto;
      transform: translateY(calc(100% + 24px));
      width: auto;
      max-width: none;
      max-height: min(68vh, 560px);
      overflow-y: auto;
      padding: 14px;
      border-radius: 18px;
      opacity: 0;
      pointer-events: none;
      transition: transform 220ms ease, opacity 220ms ease;
      z-index: 10020;
   }

   .left-bar.is-open,
   .right-bar.is-open {
      transform: translateY(0);
      opacity: 1;
      pointer-events: auto;
   }

   #controls,
   .card-viewport,
   .actions-row {
      width: 100% !important;
      max-width: 100%;
   }

   .left-bar input[type="file"] {
      width: 0;
      height: 0;
      position: absolute;
      opacity: 0;
      pointer-events: none;
   }

   .left-bar .control-row,
   .right-bar .control-row {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

   .left-bar .control > div > div {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
   }

   .left-bar .file-btn,
   .left-bar .small-btn {
      width: fit-content;
      font-size: 12px;
      padding: 7px 9px;
      border-radius: 8px;
   }

   .thumb-picker button {
      width: calc(50% - 4px);
      height: 58px;
   }

   .right-bar .thumb-picker button {
      width: calc(50% - 5px);
   }

   .copy-btn,
   .action-btn {
      font-size: 16px;
      padding: 10px 14px;
   }

   .actions-row {
      gap: 10px;
   }
}


@keyframes spin {
   to {
      transform: rotate(360deg);
   }
}