:root {
  /* Light Theme Variables */
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --btn-bg: #0f172a;
  --btn-text: #ffffff;
}

[data-theme="dark"] {
  /* Dark Theme Variables */
  --bg-main: #09090b;
  --bg-surface: #121214;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-light: #1e293b;
  --border: #27272a;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
  --btn-bg: #ffffff;
  --btn-text: #09090b;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4 {
  color: var(--text-primary);
  line-height: 1.2;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-hover);
}

/* Layout Container */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 4rem 2rem;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 3rem;
  align-items: start;
}

@media (max-width: 860px) {
  .container {
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    gap: 2rem;
  }

  .sidebar, .main-content {
    display: contents;
  }

  .skills, .education, .languages {
    order: 10;
  }
}

/* Action Buttons Container */
.action-buttons {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  gap: 0.75rem;
  z-index: 100;
}

.action-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

/* Print Container resets */
.print-container {
  border-collapse: collapse;
  width: 100%;
}

.print-margin-top, .print-margin-bottom {
  display: none;
}

/* Print Styles */
@media print {
  @page {
    size: portrait;
    margin: 0;
  }

  .action-buttons {
    display: none !important;
  }

  body {
    margin: 0.4in !important;
    background-color: #ffffff !important;
    color: #000000 !important;
    font-size: 10pt !important;
    line-height: 1.4 !important;
  }

  .edu-item, .skill-category, .project-card {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .print-container {
    display: table !important;
    width: 100% !important;
    border-collapse: collapse !important;
  }

  thead {
    display: table-header-group !important;
  }

  tfoot {
    display: table-footer-group !important;
  }

  .print-margin-top, .print-margin-bottom {
    display: block !important;
    height: 0.4in !important;
  }

  * {
    text-shadow: none !important;
    box-shadow: none !important;
    transition: none !important;
  }

  .container {
    display: flex !important;
    flex-direction: row !important;
    max-width: 100% !important;
    padding: 0 !important;
    gap: 1.5rem !important;
  }

  .sidebar {
    display: block !important;
    width: 210px !important;
    flex-shrink: 0 !important;
    border-right: none !important;
    border-bottom: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }

  .main-content {
    display: block !important;
    flex: 1 !important;
  }

  .header {
    margin-bottom: 1.25rem !important;
  }

  .name {
    font-size: 1.75rem !important;
  }

  .title {
    font-size: 0.95rem !important;
  }

  .section-block {
    margin-bottom: 1rem !important;
  }

  .section-title {
    border-bottom-color: #000 !important;
    margin-bottom: 0.5rem !important;
    font-size: 0.95rem !important;
    padding-bottom: 0.15rem !important;
    break-after: avoid !important;
    page-break-after: avoid !important;
  }

  h1, h2, h3, h4 {
    break-after: avoid !important;
    page-break-after: avoid !important;
  }

  .job-header {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    break-after: avoid !important;
  }

  .job {
    break-inside: auto !important;
    page-break-inside: auto !important;
    margin-bottom: 1rem !important;
  }

  .project-card {
    break-inside: avoid;
    page-break-inside: avoid;
    padding: 0.75rem 0 !important;
    box-shadow: none !important;
    border: none !important;
    border-top: 1px solid #eee !important;
    border-bottom: 1px solid #eee !important;
    margin-bottom: 1rem !important;
    border-radius: 0 !important;
  }

  .job-title, .project-header h3 {
    font-size: 1.05rem !important;
  }

  .tag {
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: inline !important;
    color: #000 !important;
    font-size: 9pt !important;
    font-weight: 400 !important;
  }

  .tag:not(:last-child)::after {
    content: " • ";
    color: #666;
    margin: 0 0.1rem;
  }

  .job-tasks li, .project-highlights li, p {
    display: block !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    margin-bottom: 0.2rem !important;
  }

  /* Force Light Mode colors for print */
  :root {
    --bg-main: #ffffff !important;
    --bg-surface: #ffffff !important;
    --text-primary: #000000 !important;
    --text-secondary: #222222 !important;
    --text-tertiary: #444444 !important;
    --accent: #000000 !important;
    --border: #cccccc !important;
  }

  a {
    color: #000 !important;
    text-decoration: none !important;
  }
}

/* Sections */
.section-block {
  margin-bottom: 2.5rem;
}

.section-title {
  font-size: 1.125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}

/* Sidebar Styling */
.header {
  margin-bottom: 2rem;
}

.name {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.title {
  font-size: 1.125rem;
  color: var(--accent);
  font-weight: 500;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.contact-link:hover {
  color: var(--accent);
}

/* Skills */
.skill-category {
  margin-bottom: 1.5rem;
}

.skill-category h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  background-color: var(--accent-light);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  transition: border-color 0.2s, transform 0.2s;
}

.tag:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* Education */
.edu-item {
  margin-bottom: 1.25rem;
}

.edu-item h3 {
  font-size: 1rem;
  font-weight: 600;
}

.edu-item .school {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 0.1rem;
}

.edu-item .details {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-top: 0.2rem;
}

/* Main Content */
.lead-text {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Projects */
.project-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.project-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.project-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.project-link {
  font-size: 0.9rem;
  font-weight: 600;
}

.project-desc {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.project-highlights h4 {
  font-size: 0.9rem;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.project-highlights ul {
  list-style-type: none;
}

.project-highlights li {
  position: relative;
  padding-left: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.project-highlights li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 6px;
  height: 6px;
  background-color: var(--accent);
  border-radius: 50%;
}

/* Experience */
.job {
  margin-bottom: 2rem;
  position: relative;
}

.job:last-child {
  margin-bottom: 0;
}

.job-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1rem;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.job-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.company {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 500;
}

.date {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  font-weight: 600;
  background-color: var(--bg-surface);
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.job-tasks {
  list-style-type: none;
}

.job-tasks li {
  position: relative;
  padding-left: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.job-tasks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 4px;
  height: 4px;
  background-color: var(--text-tertiary);
  border-radius: 50%;
}

.job-tasks li strong {
  color: var(--text-primary);
  font-weight: 600;
}
