/* ============================================================
   SunuCV - Cover Letter
   ============================================================ */

.cl-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--light);
}

/* ----- Sidebar (Form) ----- */
.cl-sidebar {
  width: 340px;
  min-width: 340px;
  background: var(--white);
  border-right: 1px solid #E8E8E8;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

.cl-sidebar-header {
  padding: 12px 20px;
  border-bottom: 1px solid #E8E8E8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  flex-shrink: 0;
}

.cl-sidebar-logo {
  font-size: 1.25rem;
  font-weight: 800;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cl-sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.cl-sidebar-scroll::-webkit-scrollbar { width: 4px; }
.cl-sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.cl-sidebar-scroll::-webkit-scrollbar-thumb { background: #D0D0D0; border-radius: 2px; }

.cl-form-section {
  margin-bottom: 24px;
}

.cl-form-section h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--dark-light);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ----- Template Selector (Cover Letter) ----- */
.cl-template-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.cl-template-option {
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  background: var(--light);
  text-align: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}

.cl-template-option:hover {
  border-color: #E0E0E0;
}

.cl-template-option.active {
  border-color: var(--primary);
  background: rgba(108,92,231,0.05);
}

.cl-template-option .tpl-icon {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.cl-template-option .tpl-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--dark);
}

/* ----- Content Editor ----- */
.cl-content-editor {
  width: 100%;
  min-height: 280px;
  padding: 14px;
  border: 2px solid #E8E8E8;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--dark);
  background: var(--white);
  resize: vertical;
  font-family: inherit;
  transition: var(--transition);
}

.cl-content-editor:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,92,231,0.1);
}

.cl-content-editor::placeholder {
  color: #B0B0B0;
}

.cl-placeholder-hint {
  font-size: 0.78rem;
  color: var(--dark-light);
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--light);
  border-radius: var(--radius-sm);
  line-height: 1.6;
}

.cl-placeholder-hint code {
  background: rgba(108,92,231,0.1);
  color: var(--primary);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.75rem;
}

/* ----- Content Suggestions ----- */
.cl-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.cl-suggestion-btn {
  padding: 6px 14px;
  background: var(--light);
  border-radius: 50px;
  font-size: 0.78rem;
  color: var(--dark-light);
  border: 1px solid #E8E8E8;
  cursor: pointer;
  transition: var(--transition);
}

.cl-suggestion-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(108,92,231,0.05);
}

/* ----- Main Content Area ----- */
.cl-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cl-topbar {
  padding: 8px 20px;
  background: var(--white);
  border-bottom: 1px solid #E8E8E8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  flex-shrink: 0;
}

.cl-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cl-topbar-left h2 {
  font-size: 0.95rem;
  font-weight: 600;
}

.cl-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ----- Preview ----- */
.cl-preview-container {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  background: #E8E8E8;
}

.cl-preview-container::-webkit-scrollbar { width: 4px; }
.cl-preview-container::-webkit-scrollbar-track { background: transparent; }
.cl-preview-container::-webkit-scrollbar-thumb { background: #D0D0D0; border-radius: 2px; }

.cl-preview-canvas {
  width: 210mm;
  min-height: 297mm;
  background: var(--white);
  box-shadow: var(--shadow-lg);
  position: relative;
  transform-origin: top center;
}

/* ----- Cover Letter Page Styles ----- */
.cl-letter-page {
  width: 210mm;
  min-height: 297mm;
  padding: 25mm 25mm;
  font-size: 11pt;
  line-height: 1.6;
  color: #333;
  position: relative;
}

.cl-letter-page * {
  box-sizing: border-box;
}

/* Sender info */
.cl-sender-info {
  margin-bottom: 20px;
  font-size: 10pt;
  line-height: 1.5;
  color: #555;
}

/* Recipient info */
.cl-recipient-info {
  margin-bottom: 24px;
  font-size: 10pt;
  line-height: 1.5;
  color: #555;
}

/* Date */
.cl-letter-date {
  margin-bottom: 24px;
  font-size: 10pt;
  color: #777;
}

/* Subject */
.cl-letter-subject {
  font-weight: 700;
  font-size: 11pt;
  margin-bottom: 20px;
  color: var(--cv-primary, #6C5CE7);
}

/* Body */
.cl-letter-body {
  margin-bottom: 24px;
  white-space: pre-wrap;
  font-size: 10.5pt;
  line-height: 1.8;
  color: #444;
}

/* Closing */
.cl-letter-closing {
  margin-top: 32px;
  font-size: 10.5pt;
  line-height: 1.8;
  color: #444;
}

/* Signature */
.cl-letter-signature {
  margin-top: 20px;
  font-size: 11pt;
  font-weight: 600;
  color: #222;
}

/* ----- Templates (Cover Letter) ----- */

/* Formal */
.cl-template-formal .cl-letter-page {
  font-family: 'Georgia', 'Times New Roman', serif;
}

.cl-template-formal .cl-letter-subject {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 10pt;
  color: #333;
}

.cl-template-formal .cl-letter-body {
  text-align: justify;
}

/* Modern */
.cl-template-modern .cl-letter-page {
  font-family: 'Segoe UI', -apple-system, sans-serif;
}

.cl-template-modern .cl-letter-subject {
  font-size: 12pt;
  border-left: 3px solid var(--cv-primary, #6C5CE7);
  padding-left: 12px;
}

.cl-template-modern .cl-sender-info {
  background: var(--light);
  padding: 12px 16px;
  border-radius: 4px;
}

/* Concise */
.cl-template-concise .cl-letter-page {
  font-family: 'Helvetica', 'Arial', sans-serif;
  font-size: 10pt;
  padding: 20mm 20mm;
}

.cl-template-concise .cl-letter-subject {
  font-size: 10pt;
  font-weight: 600;
  color: #555;
  border-bottom: 1px solid #E8E8E8;
  padding-bottom: 8px;
}

.cl-template-concise .cl-sender-info,
.cl-template-concise .cl-recipient-info {
  display: inline-block;
  width: 48%;
  vertical-align: top;
  font-size: 9pt;
}

/* ----- Print ----- */
@media print {
  .cl-sidebar,
  .cl-topbar { display: none !important; }
  .cl-main { margin: 0; }
  .cl-preview-container { padding: 0; background: white; overflow: visible; }
  .cl-preview-canvas { box-shadow: none; width: 100%; }
  .cl-letter-page { padding: 20mm; }
}

/* ----- Responsive ----- */
@media (max-width: 992px) {
  .cl-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 300;
    transform: translateX(-100%);
    width: 320px;
    min-width: 320px;
  }
  .cl-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }
  .cl-sidebar-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 299;
    display: none;
  }
  .cl-sidebar-overlay.active { display: block; }
  .cl-preview-canvas { width: 100%; }
  .cl-letter-page { padding: 15mm 12mm; }
}

@media (max-width: 768px) {
  .cl-topbar { padding: 8px 12px; }
  .cl-topbar-left h2 { font-size: 0.85rem; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cl-topbar-right .topbar-btn span { display: none; }
  .cl-preview-container { padding: 16px 8px; }
  .cl-template-selector { grid-template-columns: repeat(3, 1fr); }
  .cl-sidebar { width: 100%; min-width: 100%; }
}
