/* ==========================================================================
   Modular 2-Column PDF Workspace Layout (Seashell Garnet Afternoon Palette)
   ========================================================================== */

:root {
  --sidebar-width: 340px;
  
  /* Palette Colors */
  --color-seashell: #F6C992;
  --color-garnet: #30525C;
  --color-iceblue: #ACC0D3;
  --color-rose: #D396A6;
  --color-teal: #09A1A1;
  --color-steel: #5484A4;

  /* Theme Mapping */
  --bg-main: #f4f7f9;
  --bg-sidebar: #ffffff;
  --border-color: #acc0d3;
  --primary-color: #30525C;
  --primary-hover: #223c44;
  --accent-teal: #09A1A1;
  --accent-peach: #F6C992;
  --accent-rose: #D396A6;
  --text-dark: #30525C;
  --text-muted: #5484A4;
  --radius-lg: 16px;
  --radius-md: 10px;
}

/* Reset & Box Sizing */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-dark);
  background-color: var(--bg-main);
  height: 100vh;
  overflow: hidden;
}

/* 2-Column Workspace Wrapper */
.workspace-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Left Sidebar (~340px fixed width) */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 10;
  box-shadow: 4px 0 16px rgba(48, 82, 92, 0.06);
}

.sidebar-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background-color: #fafbfc;
}

.sidebar-header h2 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-dark);
}

.sidebar-header p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
  background-color: #ffffff;
}

/* Main Workspace Area (Right, remaining flexible width) */
.main-workspace {
  flex: 1;
  background-color: var(--bg-main);
  position: relative;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

/* Main Workspace States */

/* 1. Dropzone State */
.dropzone-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #ffffff;
  border: 2px dashed var(--color-iceblue);
  border-radius: 24px;
  padding: 48px 36px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 10px 25px -5px rgba(48, 82, 92, 0.08);
  transition: all 0.25s ease;
}

.dropzone-state.dragover {
  border-color: var(--color-teal);
  background-color: #f0fdfd;
  transform: scale(1.02);
}

.dropzone-icon {
  width: 72px;
  height: 72px;
  background-color: #f0fdfd;
  color: var(--color-teal);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 16px;
}

.dropzone-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.dropzone-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.btn-select-file {
  background-color: var(--color-teal);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  box-shadow: 0 4px 12px rgba(9, 161, 161, 0.25);
}

.btn-select-file:hover {
  background-color: #078282;
}

.btn-select-file:active {
  transform: scale(0.98);
}

/* 2. Preview State */
.preview-state {
  display: none;
  width: 100%;
  max-width: 1100px;
  flex-direction: column;
  gap: 20px;
}

.preview-state.active {
  display: flex;
}

.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(48, 82, 92, 0.05);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 24px;
  padding-bottom: 40px;
}

.thumbnail-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
  box-shadow: 0 4px 12px rgba(48, 82, 92, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.thumbnail-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(48, 82, 92, 0.12);
}

.thumbnail-canvas-container {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: #ffffff;
}

.thumbnail-canvas-container canvas {
  display: block;
  width: 100%;
  height: auto;
}

.thumbnail-footer {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

/* Form Controls & Styling */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px rgba(9, 161, 161, 0.15);
  background-color: #ffffff;
}

/* 3x3 Position Grid Component */
.position-grid-container {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px;
  aspect-ratio: 3/4;
  max-width: 180px;
  margin: 0 auto;
  width: 100%;
}

.position-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  height: 100%;
}

.grid-cell {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.grid-cell:hover {
  background: #f0fdfd;
  border-color: var(--color-teal);
}

.grid-cell.active {
  background-color: #f0fdfd !important;
  border-color: var(--color-teal) !important;
  color: var(--color-teal) !important;
  box-shadow: 0 0 0 2px rgba(9, 161, 161, 0.25);
}

/* Primary Action Button */
.btn-primary-action {
  width: 100%;
  background-color: var(--color-garnet);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  box-shadow: 0 4px 12px rgba(48, 82, 92, 0.25);
}

.btn-primary-action:hover {
  background-color: #223c44;
}

.btn-primary-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
