/* Unified Viewport & Overlay Styles */
.thoughts-container.unified-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  position: relative;
  background: var(--surface2);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.thoughts-viewport {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 20px 50px;
  min-height: 520px;
}

.thoughts-canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  transition: aspect-ratio 0.3s ease, max-width 0.3s ease;
}

.thoughts-canvas-wrapper.ratio-1-1 {
  aspect-ratio: 1 / 1;
  max-width: 320px;
}

.thoughts-canvas-wrapper.ratio-9-16 {
  aspect-ratio: 9 / 16;
  max-width: 240px;
}

#thoughts-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Aspect Ratio Selector */
.ratio-selector {
  display: flex;
  gap: 8px;
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 80;
}

.ratio-btn {
  padding: 6px 12px;
  border-radius: 15px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(18, 18, 18, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ratio-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.3);
}

/* Floating Glassmorphic Toolbar */
.thoughts-floating-toolbar {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(18, 18, 18, 0.5);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  z-index: 100;
}

.toolbar-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  color: #fff;
  position: relative;
  transition: all 0.2s ease;
}

.toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.toolbar-btn.active {
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.toolbar-btn.action {
  font-size: 15px;
}

.toolbar-btn.action:hover {
  background: rgba(255,255,255,0.2);
  transform: scale(1.05);
}

.toolbar-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 4px 6px;
}

/* Floating Glassmorphic Drawers */
.thoughts-floating-drawer {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 280px;
  background: rgba(18, 18, 18, 0.65);
  backdrop-filter: blur(30px) saturate(160%);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  z-index: 90;
  display: none; /* hidden by default */
  flex-direction: column;
  overflow: hidden;
  color: #fff;
  animation: drawerFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes drawerFadeIn {
  from { opacity: 0; transform: translateY(-48%) scale(0.95); }
  to { opacity: 1; transform: translateY(-50%) scale(1); }
}

.drawer-header {
  padding: 12px 16px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.5);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-close {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.drawer-close:hover {
  color: #fff;
}

.drawer-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.thoughts-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.thoughts-group label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Glassmorphism Input Styling */
.transparent-input {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #fff !important;
  border-radius: 6px !important;
  padding: 8px !important;
  font-size: 13px !important;
  transition: all 0.2s;
}

.transparent-input:focus {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255,255,255,0.2) !important;
  outline: none !important;
}

.transparent-input::placeholder {
  color: rgba(255,255,255,0.3) !important;
}

.transparent-picker {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Media Grid Picker */
.transparent-tabs {
  border-bottom-color: rgba(255, 255, 255, 0.06) !important;
  margin-bottom: 10px;
}

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

.media-tab {
  flex: 1;
  padding: 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.media-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
  padding-right: 4px;
}

.media-item {
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background: rgba(255,255,255,0.05);
  position: relative;
  transition: all 0.2s;
}

.media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-item.active {
  border-color: var(--accent);
}

.media-item::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s;
}

.media-item.active::after {
  opacity: 1;
}

/* Typography styles */
.thoughts-row {
  display: flex;
  gap: 8px;
}

.thoughts-row > * {
  flex: 1;
}

.alignment-picker {
  display: flex;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 2px;
}

.align-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 4px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  color: rgba(255,255,255,0.6);
  transition: all 0.2s;
}

.align-btn.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* Custom color circles */
.color-picker-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.color-option {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.2);
  cursor: pointer;
  position: relative;
  transition: transform 0.2s;
}

.color-option.active {
  border-color: var(--accent);
  transform: scale(1.1);
}

.color-option.active::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 8px;
  color: #000;
  font-weight: bold;
}

.color-option[data-color="#000000"].active::after {
  color: #fff;
}

/* Recording Overlay progress */
.recording-progress-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  z-index: 10;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  gap: 12px;
  padding: 20px;
  text-align: center;
}

.progress-track {
  width: 80%;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.1s linear;
}

/* Responsive Overlays */
@media (max-width: 767px) {
  .thoughts-viewport {
    padding: 60px 20px 100px 20px;
    min-height: 460px;
  }

  .thoughts-floating-toolbar {
    right: 50%;
    top: auto;
    bottom: 20px;
    transform: translateX(50%);
    flex-direction: row;
    padding: 6px 10px;
    border-radius: 24px;
  }

  .toolbar-separator {
    width: 1px;
    height: 20px;
    margin: 6px 4px;
  }

  .thoughts-floating-drawer {
    left: 50%;
    top: auto;
    bottom: 80px;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 300px;
    animation: drawerMobileFadeIn 0.25s ease;
  }

  @keyframes drawerMobileFadeIn {
    from { opacity: 0; transform: translate(-50%, 15px) scale(0.98); }
    to { opacity: 1; transform: translate(-50%, 0) scale(1); }
  }
}

/* Thoughts Export Modal */
.thoughts-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: thoughtsModalFadeIn 0.3s ease;
}

@keyframes thoughtsModalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.thoughts-modal-content {
  background: rgba(18, 18, 18, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  width: 100%;
  max-width: 320px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  color: #fff;
  animation: thoughtsModalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes thoughtsModalSlideUp {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.thoughts-modal-header {
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.5);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.thoughts-modal-close {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.thoughts-modal-close:hover {
  color: #fff;
}

.thoughts-modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#export-modal-preview-container img,
#export-modal-preview-container video {
  max-width: 100%;
  max-height: 280px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  display: block;
}
