/* 
   UPPCL Official Letter Generator Design System
   Aesthetic: Premium Corporate, Modern Utility, Sleek Interactions
*/

:root {
  --primary-color: #2563eb;       /* Modern Indigo/Blue */
  --primary-light: #eff6ff;      /* Very Light Blue */
  --primary-dark: #1e40af;       /* Dark Indigo */
  --accent-color: #f59e0b;       /* Amber */
  --secondary-color: #10b981;    /* Emerald */
  --bg-color: #f8fafc;           /* Slate 50 */
  --card-bg: #ffffff;
  --text-dark: #0f172a;          /* Slate 900 */
  --text-light: #64748b;         /* Slate 500 */
  --border-color: #e2e8f0;       /* Slate 200 */
  
  --success-color: #10b981;      /* Emerald for Success */
  --danger-color: #ef4444;       /* Red for Danger */
  --highlight-bg: rgba(245, 158, 11, 0.15); /* Soft Amber Glow */
  
  --border-radius-lg: 16px;
  --border-radius-md: 12px;
  --border-radius-sm: 8px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
  --paper-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
}

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

body {
  font-family: 'Outfit', 'Noto Sans Devanagari', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(11, 37, 69, 0.03);
}
::-webkit-scrollbar-thumb {
  background: rgba(11, 37, 69, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

/* APP HEADER styling */
.app-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
  color: white;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  border-bottom: 3px solid var(--accent-color);
  position: relative;
  z-index: 10;
}

.header-logo-title {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.uppcl-badge {
  background: linear-gradient(135deg, var(--accent-color) 0%, #FFB067 100%);
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #FFFFFF;
  background-color: var(--accent-color);
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
  animation: pulse-glow 3s infinite alternate;
}

.header-text h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #FFFFFF, #E2E8F0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-text p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 300;
  margin-top: 2px;
}

.header-stats {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.5rem 1.25rem;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0.75rem;
}

.stat-num {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-color);
}

.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.7);
}

.stat-divider {
  width: 1px;
  height: 24px;
  background-color: rgba(255, 255, 255, 0.15);
}

/* MAIN CONTAINER GRID */
.app-container {
  display: grid;
  grid-template-columns: 460px 1fr;
  flex: 1;
  height: calc(100vh - 84px);
  position: relative;
}

/* LEFT PANEL (CONTROLS) */
.control-panel {
  background-color: #F8FAFC;
  border-right: 1px solid rgba(11, 37, 69, 0.08);
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.panel-section {
  background-color: var(--card-bg);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: box-shadow var(--transition-fast);
}

.panel-section:hover {
  box-shadow: var(--shadow-md);
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.collapsible-header {
  cursor: pointer;
  user-select: none;
  transition: opacity var(--transition-fast);
}

.collapsible-header:hover {
  opacity: 0.8;
}

.toggle-icon {
  font-size: 0.9rem;
  color: var(--text-light);
  transition: transform var(--transition-fast);
}

.step-badge {
  background-color: var(--primary-color);
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

/* PROFILE GRID */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.full-width {
  grid-column: span 2;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dark);
}

.input-group input,
.input-group select,
.input-group textarea {
  font-family: inherit;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  color: var(--text-dark);
  background-color: var(--bg-color);
  transition: all var(--transition-fast);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  background-color: #FFFFFF;
}

.input-group textarea {
  resize: vertical;
  min-height: 80px;
}

#input-explanation {
  min-height: 250px;
}

/* ROLE TABS */
.role-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  background-color: var(--bg-color);
  padding: 0.35rem;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
}

.role-tab {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.5rem 0.25rem;
  border: none;
  border-radius: var(--border-radius-sm);
  background-color: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-light);
  transition: all var(--transition-fast);
}

.role-tab i {
  font-size: 1.1rem;
}

.role-tab:hover {
  color: var(--primary-color);
  background-color: rgba(37, 99, 235, 0.05);
}

.role-tab.active {
  background-color: #FFFFFF;
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.05);
}

/* FILTER DROPDOWNS */
.category-select-wrapper,
.template-select-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.category-select-wrapper label,
.template-select-wrapper label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dark);
}

.category-select-wrapper select,
.template-select-wrapper select {
  font-family: inherit;
  padding: 0.65rem;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  background-color: #F8FAFC;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.category-select-wrapper select:focus,
.template-select-wrapper select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.template-desc {
  font-size: 0.75rem;
  color: var(--text-light);
  line-height: 1.35;
  background-color: #F1F5F9;
  padding: 0.5rem 0.75rem;
  border-radius: var(--border-radius-sm);
  border-left: 3px solid var(--accent-color);
  margin-top: 0.25rem;
}

/* LANGUAGE SWITCH TOGGLE */
.form-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.form-header-row .section-title {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.lang-toggle-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: #F1F5F9;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
}

.lang-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
}

.lang-label.active {
  color: var(--primary-color);
}

/* Switch styling */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--secondary-color);
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
}

input:checked + .slider {
  background-color: var(--accent-color);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--accent-color);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

.slider.round {
  border-radius: 20px;
}

.slider.round:before {
  border-radius: 50%;
}

/* DYNAMIC FORM FIELDS GRID */
.dynamic-fields-grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.dynamic-fields-grid .input-group input,
.dynamic-fields-grid .input-group textarea {
  background-color: #FFFFFF;
}

/* DRAFTS SECTION */
.drafts-section {
  margin-top: auto;
  border: 1px dashed rgba(11, 37, 69, 0.2);
  background-color: rgba(248, 250, 252, 0.5);
}

.drafts-container {
  max-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.no-drafts {
  font-size: 0.75rem;
  color: var(--text-light);
  text-align: center;
  padding: 1rem 0;
}

.draft-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--card-bg);
  padding: 0.5rem 0.75rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(11, 37, 69, 0.08);
  font-size: 0.75rem;
}

.draft-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  cursor: pointer;
  flex: 1;
}

.draft-title {
  font-weight: 600;
  color: var(--primary-color);
}

.draft-meta {
  color: var(--text-light);
  font-size: 0.65rem;
}

.btn-delete-draft {
  background: none;
  border: none;
  color: var(--danger-color);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--border-radius-sm);
  transition: background-color var(--transition-fast);
}

.btn-delete-draft:hover {
  background-color: rgba(217, 4, 41, 0.08);
}


/* RIGHT PANEL (PREVIEW & PAPER WORKSPACE) */
.preview-panel {
  background-color: #f1f5f9;
  background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
  background-size: 20px 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* TOOLBAR */
.document-toolbar {
  background-color: var(--card-bg);
  border-bottom: 1px solid rgba(11, 37, 69, 0.08);
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 5;
  box-shadow: var(--shadow-sm);
}

.toolbar-left,
.toolbar-right {
  display: flex;
  gap: 0.5rem;
}

.toolbar-btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dark);
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.toolbar-btn:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.primary-btn {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.primary-btn:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 6px 12px rgba(37, 99, 235, 0.3);
}

.success-btn {
  background-color: var(--success-color);
  color: white;
  border-color: var(--success-color);
}

.success-btn:hover {
  background-color: #1F4C36;
  border-color: #1F4C36;
}

.danger-btn {
  background-color: var(--danger-color);
  color: white;
  border-color: var(--danger-color);
}

.danger-btn:hover {
  background-color: #B3001E;
  border-color: #B3001E;
}


/* VIRTUAL A4 SHEET CONTAINER */
.a4-container {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  perspective: 1000px;
}

/* REALISTIC PAPER EMULATION */
.a4-page {
  background-color: #FFFFFF;
  width: 210mm;
  min-height: 297mm;
  background-image: repeating-linear-gradient(to bottom, transparent, transparent 296mm, #cbd5e1 296mm, #cbd5e1 297mm);
  background-size: 100% 297mm;
  padding: 25mm 20mm 20mm 25mm; /* Standard Indian Official Margins (Left 25mm, Top 25mm) */
  box-shadow: var(--paper-shadow);
  border-radius: 4px;
  position: relative;
  display: flex;
  flex-direction: column;
  transform: rotateX(1deg);
  transform-style: preserve-3d;
  transform: rotateX(1deg);
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
  font-family: 'Times New Roman', 'Mangal', 'Aparajita', serif;
}

.a4-page:hover {
  transform: rotateX(0deg) scale(1.01);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.12);
}

/* Highlight Animation when dynamic form is edited */
.highlight-flash {
  background-color: rgba(238, 150, 75, 0.35) !important;
  border-radius: 3px;
  transition: background-color 0.1s ease;
}

.highlightable {
  transition: background-color 0.3s ease;
  border-bottom: 1px dashed rgba(11, 37, 69, 0.2);
  padding: 0 2px;
}

.highlightable.active-editing {
  background-color: var(--highlight-bg);
  border-bottom-color: var(--accent-color);
}

/* OFFICIAL LETTERHEAD FORMAT */
.letter-header {
  position: relative;
  min-height: 130px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.5rem;
}

.letter-discom-logo {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 125px;
  height: 125px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--primary-color);
}

.letter-header-details {
  flex: 1;
}

.centered-header {
  text-align: center;
  width: 100%;
  font-family: 'Times New Roman', 'Mangal', 'Aparajita', serif;
  color: #000;
}

.header-office-label {
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 1px;
}

.header-desg {
  font-size: 1.35rem;
  font-weight: 800;
  color: #000;
  margin: 3px 0;
}

.header-office {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
}

.header-city {
  font-size: 0.95rem;
  font-weight: 500;
}

.header-parent-division {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-light);
  margin-top: 2px;
}

.letter-header-details h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: 0.5px;
}

.letter-header-details .sub-head {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-top: 1px;
}

.letter-header-details .office-tag {
  font-size: 0.75rem;
  color: var(--text-light);
  font-style: italic;
  margin-top: 3px;
}

.letter-divider {
  border-top: 2px solid #000;
  margin: 0.75rem 0 1.25rem 0;
  position: relative;
  width: 100%;
}

.letter-divider::after {
  content: none;
}

/* REFERENCE & DATE ROW */
.letter-ref-date {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-dark);
  margin-bottom: 1.25rem;
}

/* SENDER & RECIPIENT BLOCK */
.letter-addresses {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text-dark);
  margin-bottom: 1.5rem;
}

.address-line {
  display: grid;
  grid-template-columns: 80px 1fr;
}

.address-line.recipient {
  margin-top: 0.25rem;
}

.address-content {
  font-family: 'Times New Roman', 'Mangal', 'Aparajita', serif;
}

/* SUBJECT BLOCK */
.letter-subject {
  font-size: 0.98rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
  padding-left: 20px;
  text-indent: -20px;
}

.letter-subject strong {
  text-decoration: underline;
}

.letter-subject span {
  font-weight: 700;
  text-decoration: underline;
}

.letter-salutation {
  font-size: 0.95rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

/* CORE BODY TEXT styling */
.letter-body {
  font-size: 0.95rem;
  line-height: 1.7;
  text-align: justify;
  text-indent: 1.5cm; /* Standard paragraph indent in Rajbhasha */
  color: #1A202C;
  flex: 1;
  min-height: 150px;
  outline: none;
  transition: all var(--transition-fast);
}

.letter-body[contenteditable="true"] {
  background-color: rgba(74, 144, 226, 0.03);
  box-shadow: inset 0 0 0 1px rgba(74, 144, 226, 0.2);
  border-radius: var(--border-radius-sm);
  padding: 5px;
  text-indent: 1.5cm;
}

.letter-body p {
  margin-bottom: 1rem;
  text-indent: 1.5cm;
}

/* SIGNATURE BLOCK */
.letter-sign-off {
  display: flex;
  justify-content: flex-end;
  margin-top: 3.5rem;
  font-size: 0.95rem;
  line-height: 1.4;
  page-break-inside: avoid;
}

.sign-off-wrapper {
  width: 250px;
  text-align: center;
}

.valediction {
  margin-bottom: 2rem;
}

.sign-space {
  height: 40px;
}

.sign-name {
  font-weight: 600;
}

.sign-desg {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* CC BLOCK */
.letter-cc {
  margin-top: 1.5rem;
  font-size: 0.82rem;
  border-top: 1px dashed #A0AEC0;
  padding-top: 1rem;
  color: var(--text-dark);
  line-height: 1.45;
  page-break-inside: avoid;
}

.cc-ref-date {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-dark);
  margin-bottom: 0.75rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #E2E8F0;
}

.cc-header {
  margin-bottom: 0.4rem;
  color: var(--text-dark);
}

.cc-body-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-top: 0.5rem;
}

.cc-list {
  padding-left: 1.25rem;
  flex: 1;
}

.cc-list li {
  margin-bottom: 0.2rem;
}

.cc-signature-block {
  width: 220px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dark);
  line-height: 1.35;
  margin-top: -10px;
}

.cc-sign-space {
  height: 25px;
}

.cc-sign-name {
  font-weight: 600;
}

.cc-sign-desg {
  font-weight: 500;
}

.cc-sign-office {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* TOAST ALERT BANNER */
.toast {
  visibility: hidden;
  min-width: 280px;
  background-color: var(--primary-color);
  color: #fff;
  text-align: center;
  border-radius: var(--border-radius-md);
  padding: 1rem;
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.3s, visibility 0.3s;
}

.toast.show {
  visibility: visible;
  opacity: 1;
}

.toast.success {
  background-color: var(--success-color);
}

.toast.error {
  background-color: var(--danger-color);
}

/* PULSE GLOW ANIMATION */
@keyframes pulse-glow {
  0% {
    box-shadow: 0 4px 10px rgba(238, 150, 75, 0.3);
  }
  100% {
    box-shadow: 0 4px 20px rgba(238, 150, 75, 0.6);
  }
}

/* AI API KEY AND UI STYLES */
.api-key-group label {
  display: flex;
  justify-content: space-between;
  width: 100%;
  align-items: center;
}
.api-help-link {
  color: var(--secondary-color);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 600;
  transition: color var(--transition-fast);
}
.api-help-link:hover {
  color: var(--primary-light);
  text-decoration: underline;
}
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.password-wrapper input {
  width: 100%;
  padding-right: 40px !important;
}
.toggle-visibility-btn {
  position: absolute;
  right: 5px;
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}
.toggle-visibility-btn:hover {
  color: var(--primary-color);
}
.ai-action-btn {
  width: 100%;
  margin-top: 0.75rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-light) 100%);
  border: none;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.25);
  transition: all var(--transition-fast);
}
.ai-action-btn:hover {
  background: linear-gradient(135deg, #3A7FCE 0%, var(--primary-color) 100%);
  box-shadow: 0 4px 16px rgba(74, 144, 226, 0.4);
  transform: translateY(-1px);
}
.ai-action-btn:active {
  transform: translateY(0);
}
.ai-action-btn:disabled {
  background: #A0AEC0;
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* PRINT MEDIA STYLING */
@media print {
  @page {
    size: A4;
    margin: 0;
  }

  body {
    background-color: #FFFFFF;
    color: #000000;
    min-height: auto;
  }
  
  .app-header,
  .control-panel,
  .document-toolbar,
  .drafts-section,
  .toast {
    display: none !important;
  }
  
  .app-container {
    display: block;
    height: auto;
  }
  
  .preview-panel {
    background-color: #FFFFFF;
    overflow: visible;
  }
  
  .a4-container {
    padding: 0;
    overflow: visible;
    display: block;
  }
  
  .a4-page {
    width: 100%;
    height: auto;
    min-height: auto;
  box-shadow: none;
  border-radius: 0;
  background-image: none !important;
    padding: 25mm 20mm 20mm 25mm !important; /* Keep identical to screen to ensure page breaks match */
    transform: none;
    transform-style: flat;
  }
  
  .letter-body[contenteditable="true"] {
    background-color: transparent;
    box-shadow: none;
    padding: 0;
  }
}
