/* assets/css/editor.css */

/* Editor Layout */
.editor-wrapper {
  display: flex;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
  background-color: var(--bg);
}

/* Sidebar */
.editor-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: var(--panel-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  padding: 1rem 0;
  font-family: 'Bebas Neue', cursive;
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
  opacity: 0.6;
}

.sidebar-tab.active {
  opacity: 1;
  color: var(--gold);
  border-bottom: 2px solid var(--gold);
}

.sidebar-tab:hover:not(.active) {
  opacity: 0.9;
  background-color: var(--hover-bg);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Tab Panels */
.tab-panel {
  display: none;
}

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

/* Sub-sections within panels */
.panel-section {
  margin-bottom: 2rem;
}

.panel-section h4 {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #888;
  margin-bottom: 1rem;
}

/* Photo Upload Area */
.photo-upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 1.5rem;
}

.photo-upload-zone:hover, .photo-upload-zone.dragover {
  border-color: var(--gold);
  background-color: rgba(240, 165, 0, 0.05);
}

.photo-upload-zone i {
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: 0.5rem;
}

#photo-input {
  display: none;
}

/* Photo Grid (Uploaded Photos) */
.uploaded-photos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.photo-thumbnail {
  aspect-ratio: 1;
  background-color: var(--bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  cursor: grab;
  border: 2px solid transparent;
}

.photo-thumbnail:hover {
  border-color: var(--gold);
}

.photo-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.photo-thumbnail .remove-photo {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.photo-thumbnail:hover .remove-photo {
  opacity: 1;
}

.photo-thumbnail .remove-photo:hover {
  background: var(--danger);
}

/* Layout Grid Items */
.layouts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.layout-item {
  aspect-ratio: 1;
  background-color: var(--bg);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  padding: 4px;
  display: flex;
}

.layout-item:hover, .layout-item.active {
  border-color: var(--gold);
}

.layout-preview {
  width: 100%;
  height: 100%;
  background-color: #333; /* Cells color */
  border-radius: 2px;
}

/* Setting Controls */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.setting-label {
  font-size: 0.9rem;
}

.range-slider {
  width: 100%;
  margin-bottom: 1rem;
}

input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
  padding: 0;
  border: none;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  margin-top: -6px;
}

input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  cursor: pointer;
  background: var(--border-color);
  border-radius: 2px;
}

/* Workspace / Canvas Area */
.editor-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: radial-gradient(circle at center, #1a1a1a 0%, var(--bg) 100%);
}

.toolbar {
  height: 60px;
  background-color: rgba(22, 22, 22, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.toolbar-group {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover:not(:disabled) {
  background-color: var(--hover-bg);
  color: var(--gold);
}

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

.canvas-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  overflow: auto;
}

/* Collage Canvas styling */
.collage-canvas {
  background-color: #ffffff; /* Default frame color */
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  transition: width 0.3s, height 0.3s, transform 0.3s;
  position: relative;
  overflow: hidden;
  /* Will be sized by JS based on aspect ratio */
}

/* Padding area for frames */
.collage-frame-padding {
  width: 100%;
  height: 100%;
  padding: 10px; /* Default gap/padding */
  background-color: inherit;
  display: flex; /* Or grid depending on layout */
}

/* Collage Grid */
.collage-grid {
  width: 100%;
  height: 100%;
  display: grid;
  gap: 10px;
  /* Grid template will be set inline by JS */
}

/* Collage Cells */
.collage-cell {
  background-color: #222;
  position: relative;
  overflow: hidden;
  /* Support drag over */
  transition: outline 0.2s;
}

.collage-cell.drag-over {
  outline: 2px dashed var(--gold);
  outline-offset: -2px;
}

.collage-cell.empty::after {
  content: '+';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255,255,255,0.2);
  font-size: 2rem;
  pointer-events: none;
}

/* The Image inside the cell */
.collage-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none; /* Let the cell handle drag events if needed */
  /* Filter styles applied via class or inline */
}

/* Cell Controls (overlay) */
.cell-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 5px;
  opacity: 0;
  transition: opacity 0.2s;
  background: rgba(0,0,0,0.6);
  padding: 4px;
  border-radius: var(--radius-sm);
  z-index: 10;
}

.collage-cell:hover .cell-controls {
  opacity: 1;
}

.cell-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 14px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.cell-btn:hover {
  background: var(--gold);
  color: black;
}

/* Export Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

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

.modal {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 500px;
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.close-modal {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
}

.close-modal:hover {
  color: var(--danger);
}

.export-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.export-stats {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: #888;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10000;
}

.toast {
  background: var(--panel-bg);
  border-left: 4px solid var(--gold);
  color: var(--text);
  padding: 1rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  transform: translateX(0);
}

/* Media Queries */
@media (max-width: 768px) {
  .editor-wrapper {
    flex-direction: column;
  }
  .editor-sidebar {
    width: 100%;
    min-width: 100%;
    height: 300px;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .sidebar-content {
    padding: 1rem;
  }
  .toolbar {
    padding: 0 1rem;
  }
  .canvas-container {
    padding: 1rem;
  }
}
