/* קובץ סגנון משופר לבלוג - מותאם ומבוסס ביצועים */
@import url("dark-mode.css");

:root {
  /* ===== COLOR SYSTEM ===== */
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --bg-light: #f8fafc;
  --border-light: #e2e8f0;

  /* ===== LAYOUT SYSTEM ===== */
  --touch-target-min: 44px;
  --mobile-padding: clamp(1rem, 4vw, 2rem);
  --content-max-width: min(65ch, 90vw);
  --section-spacing: clamp(2rem, 5vw, 4rem);
  --border-radius: clamp(8px, 1vw, 16px);

  /* ===== TYPOGRAPHY SYSTEM ===== */
  --base-font-size: clamp(1rem, 2.5vw, 1.125rem);
  --heading-scale: clamp(1.25rem, 4vw, 2.5rem);

  /* ===== EFFECTS SYSTEM ===== */
  --shadow-light: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.15);
  --shadow-heavy: 0 20px 40px rgba(0, 0, 0, 0.15);
  --transition-fast: 0.2s ease;
  --transition-medium: 0.3s ease;
  --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== BASE STYLES ===== */
body {
  font-family: "Rubik", "Segoe UI", Arial, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: var(--base-font-size);
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* ===== TYPOGRAPHY SYSTEM ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  line-height: 1.2;
  word-break: break-word;
}

h1 {
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: clamp(1.5rem, 5vw, 2rem);
  border-bottom: 3px solid var(--border-light);
  padding-bottom: 0.5rem;
  margin-top: 2rem;
}

h3 {
  font-size: clamp(1.25rem, 4vw, 1.75rem);
}
h4 {
  font-size: clamp(1.125rem, 3.5vw, 1.5rem);
}

p {
  max-width: var(--content-max-width);
  margin-bottom: 1.5em;
}

/* ===== LINK SYSTEM ===== */
a {
  color: #3b82f6;
  transition: var(--transition-medium);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  /* color: #1d4ed8; */
  text-decoration-thickness: 2px;
  transform: translateY(-1px);
}

/* ===== BUTTON SYSTEM ===== */
.btn {
  border-radius: 8px;
  font-weight: 500;
  transition: var(--transition-medium);
  min-height: var(--touch-target-min);
  min-width: var(--touch-target-min);
  padding: 0.75rem 1.5rem;
  border: none;
}

.btn:hover {
  transform: translateY(-2px);
}

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

.btn-primary:hover {
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
  color: white;
}

.btn-outline-primary {
  color: #667eea;
  border: 2px solid #667eea;
  background: transparent;
}

.btn-outline-primary:hover {
  background: var(--primary-gradient);
  border-color: transparent;
  color: white;
  transform: translateY(-2px);
}

.btn-sm {
  min-height: 36px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* ===== CARD SYSTEM ===== */
.card,
.post-card,
.post-card-enhanced {
  border: none;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-light);
  transition: var(--transition-smooth);
  height: 100%;
  background: white;
  position: relative;
}

.post-card::before,
.post-card-enhanced::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-gradient);
  transform: scaleX(0);
  transition: var(--transition-medium);
}

.post-card:hover::before,
.post-card-enhanced:hover::before {
  transform: scaleX(1);
}

.post-card:hover,
.post-card-enhanced:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-heavy);
}

.card-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: 2rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  line-height: 1.4;
}

.card-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  flex-grow: 1;
}

.card-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid #f1f5f9;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

/* ===== TAG SYSTEM ===== */
.tag-badge,
.tag-enhanced,
.post-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  margin: 0.25rem;
  border-radius: 25px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  color: #475569;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition-smooth);
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
  min-height: 32px;
}

.tag-badge::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  transition: left 0.5s;
}

.tag-badge:hover::before {
  left: 100%;
}

.tag-badge:hover,
.tag-badge.active {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-medium);
  border-color: rgba(255, 255, 255, 0.3);
}

/* ===== IMAGE SYSTEM ===== */
img {
  max-width: 100%;
  height: auto;
  box-sizing: border-box;
}

.main-image {
  overflow: hidden;
  border-radius: var(--border-radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  margin-bottom: 2rem;
  position: relative;
}

.main-image::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    45deg,
    rgba(102, 126, 234, 0.1) 0%,
    rgba(118, 75, 162, 0.1) 100%
  );
  opacity: 0;
  transition: var(--transition-medium);
}

.main-image:hover::after {
  opacity: 1;
}

.main-image img {
  width: 100%;
  transition: var(--transition-smooth);
}

.main-image:hover img {
  transform: scale(1.05);
}

/* ===== POST CONTENT SYSTEM ===== */
.post-content,
.post-content-enhanced {
  line-height: 1.8;
  font-size: 1.125rem;
  color: #374151;
  background: white;
  border-radius: var(--border-radius);
  padding: 2.5rem;
  box-shadow: var(--shadow-light);
  margin-bottom: 2rem;
}

.post-content img {
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: var(--transition-medium);
  display: block;
  margin: 10px auto;
  box-sizing: border-box;
}

.post-content img:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

.post-content h2,
.post-content h3 {
  margin-top: 3rem;
  margin-bottom: 1.5rem;
  position: relative;
}

.post-content h2::before {
  content: "";
  position: absolute;
  top: -0.5rem;
  right: 0;
  width: 60px;
  height: 4px;
  background: var(--primary-gradient);
  border-radius: 2px;
}

.post-content blockquote {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-right: 4px solid #3b82f6;
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: 8px;
  font-style: italic;
  position: relative;
  box-shadow: var(--shadow-light);
}

.post-content blockquote::before {
  content: '"';
  position: absolute;
  top: -10px;
  right: 15px;
  font-size: 4rem;
  color: #3b82f6;
  opacity: 0.3;
  font-family: Georgia, serif;
}

/* ===== CODE SYSTEM ===== */
.post-content code,
.advanced-editor-content code {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-family: "JetBrains Mono", "Fira Code", "Courier New", monospace;
  font-size: 0.9em;
  color: #dc2626;
  border: 1px solid #e5e7eb;
  direction: ltr;
  text-align: left;
}

.post-content pre,
.advanced-editor-content pre {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #e2e8f0;
  padding: 1.5rem;
  border-radius: 12px;
  overflow-x: auto;
  margin: 2rem 0;
  font-family: "JetBrains Mono", "Fira Code", "Courier New", monospace;
  box-shadow: var(--shadow-medium);
  position: relative;
  direction: ltr;
  text-align: left;
}

.post-content pre::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 30px;
  background: linear-gradient(90deg, #ef4444 0%, #f59e0b 33%, #10b981 66%);
  border-radius: 12px 12px 0 0;
}

.post-content pre code {
  background: transparent;
  padding: 0;
  border: none;
  color: inherit;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ===== TABLE SYSTEM ===== */
.table-responsive,
.table-responsive-enhanced {
  border-radius: 8px;
  box-shadow: var(--shadow-light);
  overflow-x: auto;
  margin: 1.5rem 0;
}

.table-responsive::-webkit-scrollbar {
  height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: var(--primary-gradient);
  border-radius: 4px;
}

.post-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 2rem 0;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-medium);
  font-size: clamp(0.8rem, 2vw, 0.95rem);
}

.post-content table thead {
  background: var(--primary-gradient);
  color: white;
}

.post-content table th {
  padding: clamp(0.5rem, 2vw, 1rem);
  font-weight: 600;
  text-align: right;
  border: none;
  position: relative;
}

.post-content table td {
  padding: clamp(0.5rem, 2vw, 1rem);
  border-bottom: 1px solid #f1f5f9;
  border-right: 1px solid #f1f5f9;
  transition: var(--transition-medium);
  text-align: right;
  word-break: break-word;
}

.post-content table tbody tr {
  transition: var(--transition-medium);
}

.post-content table tbody tr:nth-child(even) {
  background-color: #f8fafc;
}

.post-content table tbody tr:hover {
  background-color: #e0f2fe;
  transform: scale(1.01);
  box-shadow: var(--shadow-light);
}

/* ===== FORM SYSTEM ===== */
.form-control,
.form-select {
  min-height: var(--touch-target-min);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
  transition: var(--transition-medium);
}

.form-control:focus,
.form-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===== PAGINATION SYSTEM ===== */
.pagination {
  margin: 3rem 0;
  justify-content: center;
}

.pagination .page-link {
  color: #3b82f6;
  background-color: white;
  border: 2px solid #e5e7eb;
  padding: 0.75rem 1rem;
  margin: 0 0.25rem;
  border-radius: 8px;
  transition: var(--transition-medium);
  font-weight: 500;
}

.pagination .page-item.active .page-link {
  background: var(--primary-gradient);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.pagination .page-link:hover {
  color: #1d4ed8;
  background-color: #f8fafc;
  border-color: #3b82f6;
  transform: translateY(-2px);
  box-shadow: var(--shadow-light);
}

/* ===== COMMENTS SYSTEM ===== */
.comments-section {
  margin: var(--section-spacing) 0;
}

.comments-section .card {
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-medium);
}

.comment {
  padding: 1.5rem;
  border-bottom: 1px solid #f1f5f9;
  transition: var(--transition-medium);
  border-radius: 12px;
  margin-bottom: 1rem;
  background: white;
  border: 1px solid #f1f5f9;
}

.comment:hover {
  background-color: #f8fafc;
  border-color: #e2e8f0;
  transform: translateX(-5px);
  box-shadow: var(--shadow-light);
}

.comment-highlight {
  animation: highlightComment 3s ease;
  border-color: #fbbf24;
}

@keyframes highlightComment {
  0%,
  70% {
    background-color: #fef3c7;
    border-color: #fbbf24;
  }
  100% {
    background-color: white;
    border-color: #f1f5f9;
  }
}

/* ===== ANIMATION SYSTEM ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes highlight {
  0% {
    background-color: rgba(255, 235, 59, 0.3);
  }
  50% {
    background-color: rgba(255, 235, 59, 0.6);
  }
  100% {
    background-color: transparent;
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

.fade-in {
  animation: fadeInUp 0.6s ease forwards;
}

.loading {
  animation: pulse 2s infinite;
}

/* ===== UTILITY CLASSES ===== */
.content-constrained {
  max-width: var(--content-max-width);
  margin-left: auto;
  margin-right: auto;
}

.safe-area-inset {
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

.rtl {
  direction: rtl;
  text-align: right;
}

.touch-active {
  transform: scale(0.98);
  opacity: 0.8;
}

.reduced-motion *,
.reduced-motion *::before,
.reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .posts-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }

  .post-content {
    font-size: 1rem;
    padding: 1.5rem;
    margin: 1rem 0;
  }

  .card-body {
    padding: 1.5rem;
  }

  .post-content img {
    max-width: calc(100% - 2rem) !important;
    margin: 1rem auto;
    border-radius: 8px;
  }

  .post-content table {
    font-size: 0.85rem;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .tag-badge {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    margin: 0.2rem;
  }

  .hero-section {
    border-radius: 12px;
    margin-bottom: 2rem;
    padding: var(--mobile-padding);
  }

  .main-image {
    margin-bottom: 1.5rem;
    border-radius: 12px;
  }
}

@media (max-width: 480px) {
  .post-content {
    padding: 1rem;
    font-size: 0.95rem;
  }

  h1 {
    font-size: 1.75rem;
  }
  h2 {
    font-size: 1.5rem;
  }
  h3 {
    font-size: 1.25rem;
  }
}

/* ===== HIGH CONTRAST & ACCESSIBILITY ===== */
@media (prefers-contrast: high) {
  :root {
    --primary-gradient: #0000ff;
  }

  body {
    background: white;
    color: black;
  }

  .btn-primary {
    background: #0000ff;
    border-color: #0000ff;
    color: white;
  }

  .card {
    border: 2px solid black;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .floating-toolbar,
  .share-section-enhanced,
  .comments-section,
  .btn {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  * {
    background: transparent !important;
    color: black !important;
  }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
.floating-toolbar,
.floating-toolbar-toggle {
  will-change: transform;
  backface-visibility: hidden;
}

img[loading="lazy"] {
  opacity: 0;
  transition: var(--transition-medium);
}

img[loading="lazy"].loaded {
  opacity: 1;
}
