@import url(main.css);
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: "Outfit"; background: #f0f0f0; color: #222; min-height: 100vh; }
  .app-layout { display: flex; gap: 0; min-height: 100vh; }
  .sidebar { width: 300px; min-width: 300px; background: #fff; border-right: 1px solid #ddd; padding: 20px 16px; display: flex; flex-direction: column; gap: 20px; overflow-y: auto;  }
  .sidebar h1 { font-size: 16px; font-weight: 700; color: #111; border-bottom: 2px solid #111; padding-bottom: 10px; }
  .section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #888; margin-bottom: 8px; }
  .control-group { display: flex; flex-direction: column; gap: 6px; }
  label { font-size: 13px; color: #444; }
  select { width: 100%; padding: 7px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 13px; background: #fafafa; font-family: "Outfit";}
  .upload-zone { border: 1.5px dashed #bbb; border-radius: 8px; padding: 16px; text-align: center; cursor: pointer; background: #fafafa; }
  .upload-zone small {font-size: 14px;}
  .upload-zone small {font-size: 13px;color:gray;}
  .upload-zone:hover { border-color: #4F46E5; background: #f3f2ff; }
  #fileInput { display: none; }
  .stats { background: #f7f7f7; border-radius: 8px; padding: 10px 12px; font-size: 12px; color: #555; display: flex; justify-content: space-between; }
  .stats span { font-weight: 700; color: #222; }
  .btn { display: block; width: 100%; padding: 10px; border-radius: 7px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; font-family: "Outfit";}
  .btn-primary { background: #4F46E5; color: #fff; }
  .btn-danger { background: #fff; color: #c00; border: 1px solid #c00; }
  .thumb-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; max-height: 200px; overflow-y: auto; padding: 4px 0; }
  .thumb-wrap { position: relative; aspect-ratio: 413/531; border: 1px solid #ccc; border-radius: 3px; overflow: hidden; background: #eee; }
  .thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
  
  /* Buttons for thumbnails */
  .thumb-btn { position: absolute; top: 1px; background: rgba(0,0,0,0.7); color: #fff; border: none; border-radius: 50%; width: 18px; height: 18px; font-size: 11px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10; }
  .del-btn { right: 1px; }
  .dup-btn { right: 22px; background: rgba(79,70,229,0.85); }

  .main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 30px 20px; overflow: auto; }
  .canvas-wrapper { background: white; box-shadow: 0 4px 24px rgba(0,0,0,0.15); }
  #gridCanvas { display: block; }
  .canvas-label { font-size: 12px; color: #888; margin-top: 10px; }
  .modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.75); display: none; align-items: center; justify-content: center; z-index: 1000; }
  .modal-overlay.active { display: flex; }
  .modal-box { background: #fff; border-radius: 12px; padding: 20px; width: min(560px, 95vw); display: flex; flex-direction: column; gap: 14px; }
  .crop-container { width: 100%; height: 360px; background: #222; border-radius: 6px; overflow: hidden; }
  .modal-actions { display: flex; gap: 10px; }
  .progress-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 2000; color: white; gap: 12px; }
  .progress-overlay.active { display: flex; }
  
@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .main {
    order: 2; 
    width: 100% !important;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .sidebar {
    order: 1;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 20px;
    box-sizing: border-box;
  }
  #gridCanvas {
    max-width: 100% !important;
    height: auto !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  }
  .canvas-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
  }
  .upload-zone {
    padding: 20px !important;
  }
} 