@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+Devanagari:wght@400;700&family=Noto+Sans+Devanagari:wght@400;600&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, "Segoe UI", "Noto Sans Devanagari", sans-serif;
  background: radial-gradient(1200px 800px at 12% -10%, #2E3B39 0%, #DDE0DD 55%);
  min-height: 100vh;
  color: #E7EBE9;
}

.lh-app {
  display: flex;
  min-height: 100vh;
  width: 100%;
  margin: 0 auto;
}

/* Sidebar Styles - Sticky and Full Height */
.lh-sidebar {
  width: 440px;
  min-width: 380px;
  max-width: 460px;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  padding: 24px 22px 60px;
  background: #23292B;
  color: #E7EBE9;
  flex-shrink: 0;
  box-sizing: border-box;
  z-index: 10;
}

.lh-sidebar::-webkit-scrollbar {
  width: 6px;
}

.lh-sidebar::-webkit-scrollbar-thumb {
  background: #3A4240;
  border-radius: 3px;
}

.lh-sidebar-header {
  margin-bottom: 18px;
  text-align: left;
}

.lh-sidebar-tagline {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: #9AA6A3;
  text-transform: uppercase;
}

.lh-sidebar-title {
  font-size: 22px;
  font-weight: 700;
  color: #6FD6BC;
  margin-top: 4px;
}

.lh-sidebar-desc {
  font-size: 12px;
  color: #7C8886;
  margin-top: 4px;
}

/* History Bar & Panel */
.lh-history-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.lh-history-toggle-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: #6FD6BC;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.lh-history-clear-btn {
  background: none;
  border: none;
  color: #F0A2A2;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
}

.lh-history-panel {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #1E2426;
  border-radius: 8px;
  padding: 8px;
  border: 1px solid #3A4240;
  max-height: 280px;
  overflow-y: auto;
}

.lh-history-panel::-webkit-scrollbar {
  width: 5px;
}

.lh-history-panel::-webkit-scrollbar-thumb {
  background: #3A4240;
  border-radius: 3px;
}

.lh-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 6px;
  cursor: pointer;
  background: #2C3436;
  transition: background 0.15s ease;
}

.lh-history-item:hover {
  background: #303939;
}

.lh-history-item-info {
  overflow: hidden;
  text-align: left;
}

.lh-history-item-title {
  font-size: 12px;
  color: #ECEFED;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lh-history-item-date {
  font-size: 10.5px;
  color: #7C8886;
}

.lh-history-delete-btn {
  background: none;
  border: none;
  color: #9AA6A3;
  cursor: pointer;
  flex-shrink: 0;
  padding: 4px;
  display: inline-flex;
  align-items: center;
}

.lh-history-delete-btn:hover {
  color: #F0A2A2;
}

/* Text Letterhead Toggle */
.lh-toggle-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  margin-bottom: 12px;
  background: none;
  border: none;
  width: 100%;
  color: #9AA6A3;
  font-size: 12px;
  text-align: left;
  gap: 10px;
  cursor: pointer;
}

.lh-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid #3A4240;
  background: #2C3436;
  flex: 0 0 auto;
  padding: 0;
  cursor: pointer;
}

.lh-switch.on {
  background: #2E4744;
  border-color: #3FAE93;
}

.lh-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #9AA6A3;
  transition: left 0.15s ease, background 0.15s ease;
}

.lh-switch.on .lh-switch-knob {
  left: 20px;
  background: #6FD6BC;
}

.lh-hr {
  height: 1px;
  background: #3A4240;
  margin: 16px 0;
  border: none;
}

/* Form Sections and Inputs */
.lh-section {
  text-align: left;
  margin-bottom: 14px;
}

.lh-label {
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: #9AA6A3;
  margin-bottom: 6px;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lh-input,
.lh-textarea {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 7px;
  border: 1px solid #3A4240;
  background: #2C3436;
  color: #ECEFED;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
}

.lh-input:focus,
.lh-textarea:focus {
  border-color: #3FAE93;
}

.lh-input::placeholder,
.lh-textarea::placeholder {
  color: #7C8886;
}

.lh-small-action-btn {
  background: none;
  border: 1px solid #3A4240;
  border-radius: 4px;
  color: #9AA6A3;
  padding: 2px 7px;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.lh-small-action-btn:hover {
  color: #6FD6BC;
  border-color: #3FAE93;
}

/* Upload Signature */
.lh-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 7px;
  border: 1px solid #3A4240;
  background: #2C3436;
  color: #DCE1EA;
  font-size: 12.5px;
  cursor: pointer;
}

.lh-upload-label:hover {
  background: #303939;
}

/* Buttons */
.lh-btn-primary {
  width: 100%;
  padding: 13px;
  border-radius: 8px;
  border: none;
  background: #3FAE93;
  color: #14201D;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, transform 0.05s ease;
}

.lh-btn-primary:hover {
  background: #4ec2a5;
}

.lh-btn-primary:active {
  transform: scale(0.99);
}

.lh-btn-secondary {
  width: 100%;
  padding: 11px;
  border-radius: 8px;
  border: 1px solid #3A4240;
  background: transparent;
  color: #E7EBE9;
  font-size: 13.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease;
}

.lh-btn-secondary:hover {
  background: #2C3436;
}

.lh-btn-secondary.active {
  background: #2E4744;
  border-color: #3FAE93;
  color: #6FD6BC;
}

.lh-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-bottom: 20px;
}

/* Main Letterhead Paper Preview */
.lh-main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 36px 24px 60px;
  min-height: 100vh;
}

.lh-paper-outer {
  background: #FFFEFA;
  width: 100%;
  max-width: 760px;
  min-height: 980px;
  box-shadow: 0 1px 2px rgba(20, 20, 15, 0.12), 0 12px 32px rgba(20, 20, 15, 0.10);
  font-family: Georgia, "Noto Serif Devanagari", serif;
  color: #22201B;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.lh-paper-band {
  display: block;
  width: 100%;
  height: auto;
  flex: 0 0 auto;
}

.lh-paper-inner {
  padding: 24px 52px 30px;
  flex: 1 1 auto;
  text-align: left;
}

.lh-company-header {
  border-bottom: 2px solid #22201B;
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.lh-company-name {
  font-size: 23px;
  font-weight: 700;
  color: #22201B;
}

.lh-company-sub {
  font-size: 12.5px;
  color: #68625A;
  margin-top: 4px;
}

.lh-paper-date {
  font-size: 13px;
  color: #68625A;
  margin-bottom: 18px;
}

.lh-paper-recipient {
  font-size: 14px;
  margin-bottom: 18px;
  white-space: pre-line;
}

.lh-paper-subject {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 18px;
}

.lh-paper-body {
  font-size: 14.5px;
  line-height: 1.82;
  white-space: pre-line;
  min-height: 260px;
  color: #22201B;
}

.lh-paper-body strong {
  font-weight: 700;
  color: #141310;
}

.lh-paper-body em {
  font-style: italic;
}

.lh-paper-body.empty {
  color: #B4AC98;
}

.lh-paper-textarea {
  width: 100%;
  min-height: 350px;
  font-size: 14.5px;
  line-height: 1.82;
  font-family: Georgia, "Noto Serif Devanagari", serif;
  border: 1px dashed #C7BFA9;
  border-radius: 4px;
  padding: 12px;
  color: #22201B;
  resize: vertical;
  outline: none;
  background: transparent;
}

.lh-signatory-wrap {
  margin-top: 36px;
  font-size: 14px;
}

.lh-sign-img {
  height: 56px;
  display: block;
  margin-bottom: 6px;
}

.lh-sign-text {
  font-weight: 600;
}

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

.lh-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  min-width: 240px;
  max-width: 360px;
  font-size: 13px;
  color: #ECEFED;
  animation: lh-toast-in 0.18s ease;
}

@keyframes lh-toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lh-toast.error {
  background: #3B2020;
  border: 1px solid #C24444;
}

.lh-toast.success {
  background: #1F3B34;
  border: 1px solid #3FAE93;
}

.lh-toast-close {
  background: none;
  border: none;
  color: #9AA6A3;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  display: inline-flex;
}

/* Responsive */
@media (max-width: 900px) {
  .lh-app {
    flex-direction: column;
  }
  .lh-sidebar {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: auto;
    position: static;
    padding: 22px 18px 28px;
  }
  .lh-main {
    padding: 20px 12px;
  }
  .lh-paper-inner {
    padding: 20px 20px 30px;
  }
}

@media (max-width: 480px) {
  .lh-paper-inner {
    padding: 16px 16px 24px;
  }
}
