/* Modern styling variables for UI */
:root {
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-brand: 'Outfit', sans-serif;
  --font-resume: 'Times New Roman', Times, Georgia, serif;

  /* Light Theme (Google style) */
  --bg-app: #f8f9fa;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --border-color: #dadce0;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-muted: #80868b;
  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --primary-light: #e8f0fe;
  --secondary: #3c4043;
  --accent: #e28743;
  --success: #137333;
  --success-bg: #e6f4ea;
  --warning: #b06000;
  --warning-bg: #fef7e0;
  --error: #c5221f;
  --error-bg: #fce8e6;
  --shadow: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
  --shadow-sm: 0 1px 2px 0 rgba(60,64,67,0.3);
  --scrollbar-thumb: #dadce0;
  --scrollbar-track: #f1f3f4;

  /* Resume specific parameters (default: letter, standard margins) */
  --resume-width: 8.5in;
  --resume-height: 11in;
  --resume-padding: 0.75in;
  --resume-font-size: 10pt;
  --resume-line-height: 1.45;
  --resume-margin-bottom: 12px;
}

[data-theme="dark"] {
  /* Dark Theme */
  --bg-app: #121212;
  --bg-sidebar: #1e1e1e;
  --bg-card: #1e1e1e;
  --border-color: #3c4043;
  --text-primary: #e8eaed;
  --text-secondary: #9aa0a6;
  --text-muted: #70757a;
  --primary: #8ab4f8;
  --primary-hover: #aecbfa;
  --primary-light: rgba(138, 180, 248, 0.15);
  --secondary: #e8eaed;
  --scrollbar-thumb: #5f6368;
  --scrollbar-track: #202124;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: var(--font-ui);
  background-color: var(--bg-app);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background-color 0.3s, color 0.3s;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* App Header */
.app-header {
  height: 64px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 10;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand h1 {
  font-family: var(--font-brand);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.brand h1 span {
  color: var(--primary);
  font-weight: 700;
}

.logo-icon {
  color: var(--primary);
  font-size: 28px;
}

.badge {
  background-color: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  margin-left: 8px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* General Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  height: 38px;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary-outline {
  background-color: transparent;
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.btn-secondary-outline:hover {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.btn-icon:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.btn-small {
  width: 28px;
  height: 28px;
}

.btn-full-width {
  width: 100%;
}

/* Layout Panels */
.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left Sidebar (Editor) */
.editor-pane {
  width: 480px;
  border-right: 1px solid var(--border-color);
  background-color: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 5;
}

/* Editor Navigation Tabs - Wrap elements so they don't hide */
.editor-tabs {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-sidebar);
}

.tab-link {
  flex: 1 1 22%;
  min-width: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-link span {
  font-size: 20px;
}

.tab-link:hover {
  color: var(--primary);
  background-color: var(--primary-light);
}

.tab-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Tab Content Areas */
.tab-content-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 20px;
}

.tab-panel.active {
  display: flex;
}

.panel-header {
  margin-bottom: 12px;
}

.panel-header h2 {
  font-family: var(--font-brand);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.panel-header p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Forms Styling */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

select.form-control {
  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='%235f6368'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  padding-right: 32px;
}

.form-control {
  font-family: var(--font-ui);
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-sidebar);
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  width: 100%;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.code-font {
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  line-height: 1.5;
}

/* Item cards */
.item-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  background-color: var(--bg-app);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.card-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
}

.bullets-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.bullet-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  position: relative;
}

.bullet-status-indicator {
  position: absolute;
  right: 44px;
  top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: help;
}

.bullet-status-indicator.valid {
  color: var(--success);
}

.bullet-status-indicator.invalid {
  color: var(--error);
}

.action-card {
  background-color: var(--warning-bg);
  border: 1px solid #f0e0c0;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  gap: 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--warning);
}

.action-card span {
  font-size: 24px;
  flex-shrink: 0;
}

.suggestions-box {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.suggestion-chip {
  display: inline-block;
  background-color: var(--primary-light);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  margin: 2px;
  cursor: pointer;
  font-weight: 500;
}

.suggestion-chip:hover {
  background-color: var(--primary);
  color: white;
}

/* Switch styling for References */
.switch-container {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.switch-slider {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  background-color: var(--border-color);
  border-radius: 12px;
  margin-right: 12px;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.switch-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input[type="checkbox"] {
  display: none;
}

input[type="checkbox"]:checked + .switch-slider {
  background-color: var(--primary);
}

input[type="checkbox"]:checked + .switch-slider::before {
  transform: translateX(20px);
}

.switch-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  text-transform: none;
}

.section-divider {
  display: flex;
  align-items: center;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 16px 0 8px 0;
}

.section-divider::after, .section-divider::before {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.section-divider::before {
  margin-right: .5em;
}

.section-divider::after {
  margin-left: .5em;
}

.hidden {
  display: none !important;
}

.error-msg {
  color: var(--error);
  background-color: var(--error-bg);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-top: 8px;
}

/* Right Panel: CV Preview Layout */
.preview-pane {
  flex: 1;
  background-color: var(--bg-app);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  align-items: center;
}

.preview-controls {
  width: 100%;
  height: 48px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-sidebar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}

.preview-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.preview-badge .dot {
  width: 8px;
  height: 8px;
  background-color: var(--success);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--success);
}

.page-count-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 8px;
  padding: 2px 8px;
  background: var(--bg-app);
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.cv-page-wrapper {
  flex: 1;
  width: 100%;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
}

/* Harvard CV Styling Details (Strictly Executive) */
.harvard-cv-container {
  background-color: #ffffff;
  box-shadow: var(--shadow);
  font-family: var(--font-resume);
  color: #000000;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  text-align: justify;
  position: relative;
  transform-origin: top center;
  transition: all 0.2s;
  
  /* Apply reactive variables */
  width: var(--resume-width);
  min-height: var(--resume-height);
  padding: var(--resume-padding);
  font-size: var(--resume-font-size);
  line-height: var(--resume-line-height);
}

.harvard-cv-container a {
  color: #000000;
  text-decoration: none;
  border-bottom: 1px dotted #333333;
}

.harvard-cv-container a:hover {
  text-decoration: underline;
}

/* Page Sizes Classes */
.harvard-cv-container.size-letter {
  --resume-width: 8.5in;
  --resume-height: 11in;
}
.harvard-cv-container.size-a4 {
  --resume-width: 8.27in;
  --resume-height: 11.69in;
}
.harvard-cv-container.size-legal {
  --resume-width: 8.5in;
  --resume-height: 14in;
}

/* Margins Classes */
.harvard-cv-container.margin-standard {
  --resume-padding: 0.75in;
}
.harvard-cv-container.margin-narrow {
  --resume-padding: 0.50in;
}
.harvard-cv-container.margin-wide {
  --resume-padding: 1.00in;
}

/* Fit to page rules controlled via dynamic variables */
.harvard-cv-container.fit-densified {
  --resume-font-size: 9pt;
  --resume-line-height: 1.25;
  --resume-margin-bottom: 6px;
}
.harvard-cv-container.fit-expanded {
  --resume-font-size: 11pt;
  --resume-line-height: 1.5;
  --resume-margin-bottom: 18px;
}

/* Header Info */
.cv-header {
  text-align: center;
  margin-bottom: var(--resume-margin-bottom);
}

.cv-header h1 {
  font-size: 1.6em;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
  text-transform: uppercase;
  font-family: var(--font-resume);
}

.cv-header-title {
  font-size: 1.1em;
  font-weight: 500;
  font-style: italic;
  text-transform: uppercase;
  margin-top: 2px;
  margin-bottom: 6px;
  color: #333333;
  font-family: var(--font-resume);
}

.cv-contact-line {
  font-size: 0.9em;
  color: #333333;
  margin-top: 4px;
}

/* Section Separator */
.cv-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--resume-margin-bottom);
}

.cv-section-title {
  font-size: 1.05em;
  font-weight: 700;
  letter-spacing: 0.8px;
  border-bottom: 1.5px solid #000000;
  padding-bottom: 2px;
  text-transform: uppercase;
  margin-bottom: 6px;
  font-family: var(--font-resume);
}

.cv-bio-content {
  font-size: 1.0em;
  line-height: var(--resume-line-height);
  text-justify: inter-word;
}

/* Experience & Education Layout */
.cv-exp-item, .cv-edu-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.cv-item-header {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
}

.cv-item-subheader {
  display: flex;
  justify-content: space-between;
  font-style: italic;
  color: #222222;
}

.cv-bullets {
  margin-left: 18px;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cv-bullets li {
  line-height: var(--resume-line-height);
  list-style-type: disc;
  padding-left: 2px;
  text-align: justify;
  text-justify: inter-word;
}

/* References Styling */
.cv-references-statement {
  font-style: italic;
}

.cv-ref-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 4px;
}

.cv-ref-item {
  line-height: 1.35;
}

.cv-ref-item strong {
  font-weight: 700;
  display: block;
}

/* Scrollbar Tweaks */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* PDF Print styles */
@media print {
  body {
    background: none;
    color: #000;
  }
  .app-header, .editor-pane, .preview-controls {
    display: none !important;
  }
  .main-layout {
    display: block;
  }
  .preview-pane {
    background: none;
    padding: 0;
    margin: 0;
    width: 100%;
    height: auto;
    overflow: visible;
  }
  .cv-page-wrapper {
    padding: 0;
    margin: 0;
    display: block;
    overflow: visible;
  }
  .harvard-cv-container {
    box-shadow: none;
    margin: 0;
    padding: var(--resume-padding);
    width: 100%;
    transform: none !important;
  }
}
