/* PlanckConvert Luxury Workspace Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --bg-color: #000000;
  --panel-bg: #080a10;
  --workspace-bg: #030508;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(59, 130, 246, 0.35);
  
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.65);
  --text-muted: rgba(255, 255, 255, 0.4);
  
  --primary: #3b82f6; /* Tech Blue */
  --primary-glow: rgba(59, 130, 246, 0.15);
  --secondary: #3b82f6; /* Blue */
  --success: #10b981; /* Emerald */
  --success-glow: rgba(16, 185, 129, 0.15);
  --danger: #ef4444;
  
  --border-radius-lg: 10px;
  --border-radius-md: 6px;
  --transition-smooth: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font-mono: 'Consolas', 'Monaco', 'Courier New', ui-monospace, monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background: radial-gradient(circle at 50% -20%, rgba(59, 130, 246, 0.08) 0%, transparent 60%), #000000;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow: hidden;
}

/* Main App Wrapper (3-Column Grid) */
.app-container {
  display: grid;
  grid-template-columns: 240px 1fr 340px;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-color);
  position: relative;
}

/* CRT Scanline & Grain Overlay */
.app-container::before {
  content: " ";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.12) 50%);
  background-size: 100% 4px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.3;
}

/* -------------------------------------------------- */
/* COLUMN 1: LEFT TOOLBAR (Sidebar)                   */
/* -------------------------------------------------- */
.sidebar {
  background-color: var(--bg-color);
  border-right: 1px solid var(--border-color);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  gap: 36px;
  height: 100%;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 6px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 16px;
  font-family: var(--font-mono);
}

.logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 0 4px rgba(59, 130, 246, 0.4));
  transition: var(--transition-smooth);
}

.logo-text {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(to right, #ffffff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  border-radius: var(--border-radius-md);
  transition: var(--transition-smooth);
  border: 1px solid transparent;
  cursor: pointer;
}

.nav-link i {
  width: 18px;
  height: 18px;
}

.nav-link:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active .nav-link {
  color: var(--text-primary);
  background-color: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.15);
}

.nav-item.active .nav-link i {
  color: #60a5fa;
}

/* -------------------------------------------------- */
/* COLUMN 2: CENTER WORKSPACE (Canvas)                */
/* -------------------------------------------------- */
.workspace {
  background-color: var(--workspace-bg);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}

/* Header inside Workspace */
.workspace-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(3, 5, 8, 0.7);
  backdrop-filter: blur(12px);
  z-index: 10;
}

.workspace-title-area h2 {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  text-transform: uppercase;
}

.workspace-title-area p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 2px;
}

.workspace-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 8px 14px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-smooth);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.btn-secondary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Workspace Canvas View Panel */
.panel-view {
  flex-grow: 1;
  overflow-y: auto;
  padding: 32px;
  display: none;
  height: 100%;
}

.panel-view.active {
  display: block;
}

/* Dropzone (When Canvas is empty) */
.dropzone {
  border: 1px dashed var(--border-color);
  border-radius: var(--border-radius-lg);
  height: 100%;
  min-height: 350px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.01);
  transition: var(--transition-smooth);
  padding: 40px;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.02);
}

.dropzone-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 20px;
  transition: var(--transition-smooth);
}

.dropzone:hover .dropzone-icon {
  transform: scale(1.05);
  color: #60a5fa;
  box-shadow: 0 0 15px var(--primary-glow);
}

.dropzone-text h3 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.dropzone-text p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.file-input {
  display: none;
}

/* File Grid Workspace (When Files Loaded) */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px;
  width: 100%;
}

/* Visual Card Component */
.card-item {
  background-color: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  transition: var(--transition-smooth);
  min-height: 180px;
  user-select: none;
}

.card-item:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

/* Dragging visual effect for PDF sorting */
.card-item.draggable {
  cursor: grab;
}

.card-item.dragging {
  opacity: 0.3;
  border: 1px dashed var(--primary);
}

/* Card Image Thumbnail wrapper */
.card-thumbnail-container {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--border-radius-md);
  background: #080b13;
  border: 1px solid rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.card-thumbnail-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-icon-badge {
  font-size: 32px;
  color: var(--text-muted);
}

/* Micro Spinner overlay on converting */
.card-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(7, 10, 19, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.card-loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.micro-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.card-status-icon {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: white;
  z-index: 5;
}

.card-status-icon.success {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success-glow);
}

.card-status-icon.danger {
  background-color: var(--danger);
}

/* Card detail info */
.card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}

.card-badge {
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Card Control triggers */
.card-btn-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 8;
  opacity: 0;
  transition: var(--transition-smooth);
}

.card-item:hover .card-btn-delete {
  opacity: 1;
}

.card-btn-delete:hover {
  background: var(--danger);
  color: white;
}

.card-btn-download {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--success);
  color: white;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 8;
  box-shadow: 0 2px 6px var(--success-glow);
  font-size: 11px;
  transition: var(--transition-smooth);
}

.card-item.completed .card-btn-download {
  display: flex;
}

.card-btn-download:hover {
  transform: scale(1.1);
}

.card-drag-indicator {
  position: absolute;
  top: 6px;
  left: 6px;
  color: var(--text-muted);
  cursor: grab;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* -------------------------------------------------- */
/* COLUMN 3: RIGHT PANEL (Settings Inspector)        */
/* -------------------------------------------------- */
.inspector {
  background-color: var(--panel-bg);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.inspector-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.inspector-content {
  flex-grow: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  overflow-y: auto;
}

.inspector-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inspector-section-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* UI Controls in Inspector */
.control-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 12px 16px;
}

.slider-range {
  -webkit-appearance: none;
  flex-grow: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  margin-right: 14px;
}

.slider-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 6px var(--primary-glow);
  transition: var(--transition-smooth);
}

.slider-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider-val-badge {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  min-width: 38px;
  text-align: right;
}

.info-tip {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.01);
  border-radius: var(--border-radius-md);
  padding: 12px;
  border: 1px solid var(--border-color);
  display: flex;
  gap: 8px;
}

.info-tip i {
  flex-shrink: 0;
  color: var(--primary);
}

/* Large Button style */
.btn-action-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  border-radius: var(--border-radius-md);
  padding: 14px 20px;
  color: white;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-action-primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-action-primary:disabled {
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Success Download Box */
.download-output-box {
  display: none;
  background: rgba(16, 185, 129, 0.04);
  border: 1px solid rgba(16, 185, 129, 0.15);
  border-radius: var(--border-radius-md);
  padding: 16px;
  flex-direction: column;
  gap: 12px;
  animation: panelSlide 0.3s ease-out;
}

@keyframes panelSlide {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.download-info-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.download-icon {
  width: 32px;
  height: 32px;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
  font-size: 16px;
}

.download-text h4 {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.download-text p {
  font-size: 11px;
  color: var(--text-secondary);
}

.btn-action-success {
  width: 100%;
  background: var(--success);
  border: none;
  border-radius: var(--border-radius-md);
  padding: 12px 20px;
  color: white;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px var(--success-glow);
}

.btn-action-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--success-glow);
}

/* Global Progress bar panel in inspector */
.progress-panel {
  display: none;
  flex-direction: column;
  gap: 8px;
}

.progress-info-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  border-radius: 3px;
  transition: width 0.1s ease-out;
}

/* Footer Section */
.inspector-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inspector-footer-links {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.inspector-footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.inspector-footer-links a:hover {
  color: var(--text-secondary);
}

/* Ad Slot Integration (Visual Box inside Inspector Content) */
.ad-slot-panel {
  display: none !important; /* Temporarily disabled until AdSense approval */
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  background: #000000;
  height: 270px;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
  gap: 6px;
  text-align: center;
  padding: 32px 12px 12px 12px;
  position: relative;
  overflow: hidden;
}

.ad-slot-panel::before {
  content: '■ SYSTEM SPONSOR';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #10b981; /* Green LED Color */
  display: flex;
  align-items: center;
  padding-left: 12px;
}

/* Workspace Bottom Ad Slot (Hidden on desktop, shown on mobile) */
.ad-slot-workspace {
  display: none !important; /* Temporarily disabled until AdSense approval */
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  background: #000000;
  height: 120px;
  margin: 16px 32px 32px 32px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
  gap: 4px;
  text-align: center;
  padding: 28px 8px 8px 8px;
  position: relative;
  overflow: hidden;
}

.ad-slot-workspace::before {
  content: '■ SPONSOR TELEMETRY';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 22px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #10b981;
  display: flex;
  align-items: center;
  padding-left: 12px;
}

/* -------------------------------------------------- */
/* GLOBAL UTILITIES & RESPONSIVE                      */
/* -------------------------------------------------- */

/* Scrollbar tweaks */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Tablet & Mobile layout adjustments (Fallback) */
/* Tablet & Mobile layout adjustments (Fallback) */
@media (max-width: 1100px) {
  .app-container {
    grid-template-columns: 200px 1fr;
    grid-template-rows: auto 1fr;
  }
  
  .inspector {
    grid-column: 1 / -1;
    grid-row: 3;
    height: auto;
    border-left: none;
    border-top: 1px solid var(--border-color);
  }
  
  .ad-slot-panel {
    display: none; /* Hide sidebar ad to prevent layout mess */
  }
  
  .ad-slot-workspace {
    display: flex; /* Show responsive ad in main view */
  }
}

@media (max-width: 768px) {
  body {
    overflow-y: auto;
  }

  .app-container {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
  }
  
  .nav-menu {
    flex-direction: row;
    gap: 8px;
  }
  
  .nav-link {
    padding: 8px 12px;
    font-size: 13px;
  }

  .logo-container {
    padding-left: 0;
  }
  
  .workspace {
    height: auto;
    overflow: visible;
  }

  .workspace-header {
    padding: 16px 20px;
  }

  .workspace-title-area h2 {
    font-size: 18px;
  }

  .panel-view {
    height: auto;
    overflow: visible;
    padding: 20px 16px;
  }

  .dropzone {
    min-height: 220px;
    padding: 24px;
  }

  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
  }

  .card-item {
    min-height: 150px;
    padding: 8px;
  }
  
  .inspector {
    width: 100%;
    height: auto;
    overflow: visible;
    border-left: none;
    border-top: 1px solid var(--border-color);
  }

  .inspector-header {
    padding: 16px 20px;
    font-size: 14px;
  }

  .inspector-content {
    padding: 16px 20px;
    gap: 20px;
    height: auto;
    overflow: visible;
  }

  .slider-container {
    padding: 10px 12px;
  }

  .slider-range {
    margin-right: 10px;
  }

  .slider-val-badge {
    font-size: 12px;
    min-width: 32px;
  }

  .info-tip {
    padding: 10px;
    font-size: 11px;
  }

  .btn-action-primary {
    padding: 12px 16px;
    font-size: 13px;
  }

  .download-output-box {
    padding: 12px;
    gap: 10px;
  }

  .ad-slot-panel {
    display: none;
  }
  
  .ad-slot-workspace {
    display: flex;
    margin: 8px 16px 20px 16px;
  }

  .inspector-footer {
    padding: 16px;
  }
}
