/* css/postoffice.css — Love Letter Studio */

.ll-workspace {
  background-color: #fcf8f9;
  transition: background-color 0.3s;
}

/* ============================================================
   Dark Mode Overrides — warm chocolate
   ============================================================ */
.dark-mode .ll-workspace {
  background-color: #20150d;
}
.dark-mode .floating-panel {
  background: #2e2016;
  border-color: #5a3a24;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.dark-mode .panel-header {
  background: #3b281b;
  border-color: #5a3a24;
}
.dark-mode .panel-header h2,
.dark-mode .panel-header button {
  color: #e8c39a;
}
.dark-mode .ll-label {
  color: #f0dcc8;
}
.dark-mode .ll-field {
  background: #20150d;
  border-color: #5a3a24;
  color: #f0dcc8;
}
.dark-mode .ll-btn {
  background: #2e2016;
  border-color: #5a3a24;
  color: #f0dcc8;
}
.dark-mode .ll-btn:hover {
  background: #3b281b;
}
.dark-mode .ll-btn.active {
  background: #4a3220;
  border-color: #e8c39a;
  color: #e8c39a;
}
.dark-mode .toolbox-subpanel {
  border-color: #5a3a24;
}
.dark-mode .toolbox-subpanel summary {
  color: #e8c39a;
}
.dark-mode .toolbox-subpanel[open] summary {
  background: #3b281b;
  border-color: #5a3a24;
}
.dark-mode .font-dropdown-menu {
  background: #2e2016;
  border-color: #5a3a24;
}
.dark-mode .font-dropdown-item {
  color: #f0dcc8;
}
.dark-mode .font-dropdown-item:hover,
.dark-mode .font-dropdown-item.selected {
  background: #3b281b;
  color: #e8c39a;
}
.dark-mode .number-picker {
  background: #20150d;
  border-color: #5a3a24;
  color: #f0dcc8;
}
.dark-mode .number-picker button {
  color: #e8c39a;
}
.dark-mode .number-picker button:hover {
  background: #3b281b;
}
.dark-mode #floating-md-toolbar {
  background: #2e2016;
  border-color: #5a3a24;
}
.dark-mode #floating-md-toolbar button {
  color: #f0dcc8;
}
.dark-mode #floating-md-toolbar button:hover {
  background: #3b281b;
  color: #e8c39a;
}
.dark-mode .text-gray-400 {
  color: #b39a83;
}
.dark-mode .bg-white {
  background-color: #2e2016 !important;
  border-color: #5a3a24 !important;
  color: #f0dcc8;
}
.dark-mode .border-\[\#fce4ec\] {
  border-color: #5a3a24 !important;
}
.dark-mode .text-\[\#5b4750\] {
  color: #f0dcc8 !important;
}
.dark-mode .bg-\[\#fcf8f9\] {
  background-color: #20150d !important;
}
.dark-mode .bg-\[\#fff0f5\] {
  background-color: #3b281b !important;
}
.dark-mode #post-office-overlay {
  background-color: #20150d;
  color: #f0dcc8;
}
.dark-mode header {
  background-color: #2e2016 !important;
  border-color: #5a3a24 !important;
}
.dark-mode .text-\[\#ffb3c6\] {
  color: #e8c39a !important;
}
.dark-mode #closePostOffice {
  background: #2e2016;
  border-color: #5a3a24;
  color: #f0dcc8;
}
.dark-mode #closePostOffice:hover {
  background: #3b281b;
  border-color: #e8c39a;
  color: #e8c39a;
}
.dark-mode #draft-status {
  color: #b39a83;
}
.dark-mode .color-swatch {
  border-color: #2e2016;
  box-shadow: 0 0 0 1px #5a3a24;
}
.dark-mode .brush-btn {
  background: #2e2016;
  border-color: #5a3a24;
  color: #e8c39a;
}

/* ============================================================
   Base Paper Style & Typography
   ============================================================ */
.ll-paper {
  background-color: #ffeef3; /* Fixed: was accidentally #ffb3c6 */
  line-height: 32px;
  transition: background-color 0.3s;
}
#preview-text {
  outline: none;
  min-height: 180px;
  cursor: text;
  font-weight: 400 !important; /* No default bold */
}
#preview-text:empty::before {
  content: "Write something special here";
  opacity: 0.45;
  pointer-events: none;
}
#letter-preview.capturing #preview-text:empty::before {
  content: none;
}
#preview-text code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 6px;
  border-radius: 6px;
  font-family: "Courier Prime", monospace;
}
.ll-paper.pattern-textbook {
  border-left: 4px solid #ffb3c6 !important;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.ll-label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  display: block;
}

/* ============================================================
   Form Fields & Buttons
   ============================================================ */
.ll-field {
  width: 100%;
  padding: 10px 16px;
  font-size: 14px;
  border: 2px solid #fce4ec;
  border-radius: 999px;
  font-family: inherit;
  transition: all 0.2s;
}
#letter-message {
  font-weight: 400 !important;
}
.ll-field:focus {
  outline: none;
  border-color: #ffb3c6;
}

.ll-btn {
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  border: 2px solid #fce4ec;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Active States */
#size-love.active,
#size-a4.active {
  background-color: #ffb3c6 !important;
  border-color: #ffb3c6 !important;
  color: white !important;
}

select.ll-field {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffb3c6' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px;
  padding-right: 36px;
  cursor: pointer;
}

/* ============================================================
   Custom Font Picker
   ============================================================ */
.font-picker {
  position: relative;
  width: 100%;
}
.font-picker.compact {
  max-width: 220px;
}
.font-picker-trigger {
  width: 100%;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 700;
  border: 2px solid #fce4ec;
  border-radius: 999px;
  background: #ffffff;
  color: #5b4750;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background-color 0.2s;
}
.font-picker-trigger:hover,
.font-picker.open .font-picker-trigger {
  border-color: #ffb3c6;
}
.font-picker-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.font-picker-arrow {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffb3c6;
  transition: transform 0.2s;
}
.font-picker.open .font-picker-arrow {
  transform: rotate(180deg);
}
.font-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 210px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: #ffffff;
  border: 2px solid #ffd6e8;
  border-radius: 18px;
  padding: 6px;
  box-shadow: 0 10px 24px rgba(255, 179, 198, 0.22);
  z-index: 2500;
  display: none;
  flex-direction: column;
  gap: 2px;
}
.font-dropdown-menu::-webkit-scrollbar {
  display: none;
}
.font-picker.open .font-dropdown-menu {
  display: flex;
}
.font-dropdown-item {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  color: #5b4750;
  text-align: left;
  cursor: pointer;
  transition:
    background-color 0.15s,
    color 0.15s;
}
.font-dropdown-item:hover,
.font-dropdown-item.selected {
  background: #fff0f5;
  color: #ff7aa2;
}

/* ============================================================
   Number Picker
   ============================================================ */
.number-picker {
  display: inline-flex;
  align-items: center;
  border: 2px solid #fce4ec;
  border-radius: 999px;
  background: #ffffff;
  overflow: hidden;
  height: 38px;
}
.number-picker button {
  width: 34px;
  height: 100%;
  border: none;
  background: transparent;
  color: #ffb3c6;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s;
}
.number-picker button:hover {
  background: #fff0f5;
}
.number-picker input {
  width: 48px;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: inherit;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}
.number-picker input::-webkit-outer-spin-button,
.number-picker input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ============================================================
   Markdown Toolbar
   ============================================================ */
.md-btn {
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 800;
  border-radius: 10px;
  border: 2px solid #fce4ec;
  background: #ffffff;
  color: #5b4750;
  cursor: pointer;
  transition: all 0.15s;
}
.md-btn:hover {
  border-color: #ffb3c6;
  background: #fff0f5;
  color: #ff7aa2;
}
#toolbox-md-buttons .md-btn.active {
  background-color: #ffb3c6 !important;
  border-color: #ffb3c6 !important;
  color: white !important;
}

#floating-md-toolbar {
  position: fixed;
  z-index: 2600;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  background: #ffffff;
  border: 2px solid #ffd6e8;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
}
#floating-md-toolbar.show {
  display: flex;
}
#floating-md-toolbar button {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
  border-radius: 999px;
  color: #5b4750;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}
#floating-md-toolbar button:hover {
  background: #fff0f5;
  color: #ff7aa2;
}

/* ============================================================
   Stickers
   ============================================================ */
.sticker {
  position: absolute;
  pointer-events: auto;
  user-select: none;
  touch-action: none;
}
.sticker img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

/* ============================================================
   Floating Panels & Layout
   ============================================================ */
.floating-panel {
  position: fixed;
  z-index: 1500;
  border-radius: 24px;
  border: 4px solid #ffd6e8;
  display: none;
  flex-direction: column;
  overflow: hidden;
  transition:
    background-color 0.3s,
    border-color 0.3s;
}
.floating-panel.show {
  display: flex;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 2px solid;
  cursor: grab;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition:
    background-color 0.3s,
    border-color 0.3s;
}
.panel-header:active {
  cursor: grabbing;
}
.panel-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.panel-body::-webkit-scrollbar {
  display: none;
}

.preview-actions {
  width: 100%;
  max-width: 680px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

#message-panel {
  width: 380px;
  top: 150px;
  right: 90px;
  max-height: 85vh;
}
#toolbox-panel {
  width: 356px;
  top: 100px;
  left: 150px;
  right: 1400px;
  bottom: 400px;
  max-height: 90vh;
}
#draft-panel {
  width: 340px;
  top: 368px;
  left: 770px;
  right: 810px;
  bottom: 287px;
  max-height: 70vh;
}

/* ============================================================
   Floating Buttons
   ============================================================ */
.floating-round-btn {
  position: fixed;
  right: 550px;
  z-index: 1600;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ffb3c6;
  border: 4px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  transition:
    transform 0.2s,
    background 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  touch-action: none;
}
.floating-round-btn:hover {
  background: #ff8fb1;
  transform: scale(1.05);
}

#message-btn {
  right: 550px;
  bottom: 265px;
}
#dark-mode-btn {
  right: 550px;
  bottom: 425px;
}
#draft-btn {
  right: 550px;
  bottom: 345px;
}

#pencil-btn {
  position: fixed;
  right: 545px;
  bottom: 172px;
  top: 714px;
  z-index: 1600;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #ffb3c6;
  border: 4px solid white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  transition:
    transform 0.2s,
    background 0.2s;
  touch-action: none;
}
#pencil-btn:hover {
  background: #ff8fb1;
  transform: scale(1.05);
}
#pencil-btn:active {
  cursor: grabbing;
  transform: scale(0.95);
}

.round-tooltip {
  position: absolute;
  right: 68px;
  top: 50%;
  transform: translateY(-50%);
  background: #3b281b;
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 1700;
}
.floating-round-btn:hover .round-tooltip,
#pencil-btn:hover .round-tooltip {
  opacity: 1;
}

/* Stop text selection while dragging */
.floating-round-btn,
#pencil-btn {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
body.ll-dragging,
body.ll-dragging * {
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* ============================================================
   Collapsible Toolbox Elements
   ============================================================ */
.toolbox-subpanel {
  border: 2px solid #fce4ec;
  border-radius: 16px;
  overflow: visible;
  flex-shrink: 0;
}
.toolbox-subpanel summary {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  color: #ffb3c6;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 14px;
}
.toolbox-subpanel summary::-webkit-details-marker {
  display: none;
}
.toolbox-subpanel[open] summary {
  border-bottom: 2px solid #fce4ec;
  background: #fff0f5;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.toolbox-subpanel-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sticker-actions-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.sticker-actions-row .ll-btn {
  height: 40px;
  padding: 0 12px;
  white-space: nowrap;
}

.toolbox-body.transform-mode .toolbox-settings {
  display: none !important;
}
.toolbox-body:not(.transform-mode) #transform-controls {
  display: none !important;
}

/* ============================================================
   Color Picker
   ============================================================ */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}
.color-swatches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 1px #fce4ec;
  cursor: pointer;
  transition: transform 0.15s;
}
.color-swatch:hover {
  transform: scale(1.15);
}
.brush-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 2px solid #fce4ec;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  color: #ffb3c6;
  transition: border-color 0.2s;
}
.brush-btn:hover {
  border-color: #ffb3c6;
}
.brush-btn input[type="color"] {
  position: absolute;
  inset: -10px;
  width: 200%;
  height: 200%;
  cursor: pointer;
  opacity: 0;
}
.hex-input {
  width: 80px;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  border-radius: 10px;
  border: 2px solid #fce4ec;
  color: #5b4750;
  outline: none;
}
.hex-input:focus {
  border-color: #ffb3c6;
}

/* ============================================================
   Draft Panel & Delivery Card
   ============================================================ */
#draft-preview {
  border-radius: 16px;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.6;
}
#draft-preview:empty::before {
  content: "(empty)";
  opacity: 0.4;
}

#draft-status {
  font-size: 11px;
  font-weight: 700;
  color: #c9a9b4;
  margin-right: 6px;
  opacity: 0;
  transition: opacity 0.4s;
  white-space: nowrap;
  pointer-events: none;
}
#draft-status.show {
  opacity: 1;
}

#delivery-overlay {
  background: rgba(252, 248, 249, 0.8);
  backdrop-filter: blur(4px);
}
.delivery-card {
  transform: scale(0.9) translateY(20px);
  opacity: 0;
  transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.delivery-card.show {
  transform: scale(1) translateY(0);
  opacity: 1;
}

#signature-prefix:empty::before {
  content: "from.";
  opacity: 0.5;
}

/* ============================================================
   Debug HUD
   ============================================================ */
.ll-debug-hud {
  position: fixed;
  left: 10px;
  bottom: 10px;
  z-index: 99999;
  background: rgba(18, 18, 18, 0.9);
  color: #8ef0a8;
  font:
    11px/1.55 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  padding: 10px 14px;
  border-radius: 12px;
  pointer-events: none;
  white-space: pre;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.ll-debug-cursor {
  position: fixed;
  z-index: 100000;
  display: none;
  background: #111;
  color: #8ef0a8;
  font:
    11px ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  padding: 3px 8px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

#prop-flip-x.active,
#prop-flip-y.active {
  background-color: #ffb3c6 !important;
  border-color: #ffb3c6 !important;
  color: white !important;
}
