/* --- Global Variables & Basic Styles --- */
:root {
    /* Main Palette from NEW design */
    --bg-main: #f4f7fa;
    --bg-surface: #ffffff;
    --border-color: #e9ecef;
    --header-bg: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-danger: #dc3545;
    
    /* Side Border Colors from NEW design */
    --side-color-choice: #fd7e14;
    --side-color-lab: #0d6efd;
    --side-color-spirit: #6c757d;
    --side-color-mandatory: #343a40;

    /* Category Badge BG Colors from NEW design */
    --cat-choice-bg: #fff8f0;
    --cat-lab-bg: #f0f6ff;
    --cat-spirit-bg: #f8f9fa;
    --cat-mandatory-bg: #f1f3f5;

    /* Original palette (for components we are not touching) */
    --border-light: #ddd;
    --border-medium: #dee2e6;
    --primary-color: #007bff;
    --primary-light: rgba(0, 123, 255, 0.25);
    --success-color: #28a745;
    --success-bg-light: #eaf6ec;
    --danger-color: #ef4444;
    --icon-color: #9ca3af;
    --icon-color-hover: var(--text-danger);
    --progress-done-bg: #10b981;
    --progress-planned-bg: #a7f3d0;
    --progress-track-bg: #f0f0f0;
    --card-purple-bg: #f3e8ff;
    --card-purple-border: #c084fc;
    --card-purple-fill: #a855f7;
    --card-green-bg: #dcfce7;
    --card-green-border: #4ade80;
    --card-green-fill: #22c55e;
    --card-red-bg: #fee2e2;
    --card-red-border: #f87171;
    --card-red-fill: var(--danger-color);
    --card-orange-bg: #ffedd5;
    --card-orange-border: #fb923c;
    --card-orange-fill: #f97316;
    --card-blue-bg: #dbeafe;
    --card-blue-border: #60a5fa;
    --card-blue-fill: #3b82f6;

    --header-height: 64px;
    --font-family: 'Heebo', sans-serif;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font-family);
  background: var(--bg-main);
  direction: rtl;
  margin: 0;
  padding-top: var(--header-height);
}

/* ===== Site Header ===== */
.site-header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-medium);
    height: var(--header-height);
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.header-container {
    width: 100%;
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}
.bug-report-link {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #f0f0f0;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}
.bug-report-link:hover {
    background-color: #e0e0e0;
    color: var(--text-primary);
}
.bug-report-link svg { color: var(--text-primary); }
.table-wrapper {
    overflow-x: auto; /* <--- זה הכלל שמוסיף את פס הגלילה האופקי */
    width: 100%;
}
/* ===== Content Wrapper & Layout ===== */
.content-wrapper { display: flex; height: calc(100vh - var(--header-height)); }
.main { order: 1; flex: 1; min-width: 0; padding: 30px; overflow-y: auto;}
.summary {
  order: 2; flex: 0 0 320px; padding: 20px; background: var(--bg-surface);
  border-left: 1px solid var(--border-light); overflow-y: auto;
}
.summary h2 { margin-top: 0; font-size: 22px; }

/* ===== Summary Column Styles ===== */
.total-progress-card { background-color: var(--bg-surface); border: 1px solid var(--border-light); border-radius: 12px; padding: 12px 20px; margin-bottom: 18px; }
.hero-stat { text-align: center; margin: 16px 0; }
.hero-value { font-size: 44px; font-weight: 800; color: var(--progress-done-bg); line-height: 1; }
.hero-subtext { font-size: 16px; color: var(--text-primary); font-weight: 500; }
.hero-breakdown-text { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.hero-breakdown-text strong { font-weight: 700; color: var(--text-primary); }
.total-progress-legend {
    display: flex;
    flex-wrap: wrap;          /* <-- החלק החשוב: מאפשר לפריטים לרדת שורה */
    justify-content: flex-start; /* <-- מצמיד את הפריטים להתחלה (ימין) */
    gap: 12px;                /* <-- רווח אופקי בין פריטים */
    row-gap: 8px;             /* <-- רווח אנכי קטן אם פריט יורד שורה */
    margin-top: 12px;
    padding: 0;
}.legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.legend-item .dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-item strong { font-weight: 700; color: var(--text-primary); }
.progress-bar-container { width: 100%; background-color: var(--progress-track-bg); border-radius: 50px; height: 10px; overflow: hidden; }
.stacked-progress-bar { display: flex; height: 100%; width: 100%; }
.bar-segment { transition: width 0.5s ease-in-out; }
.summary-cards { display: flex; flex-direction: column; gap: 12px; }
.requirement-card { border-radius: 8px; padding: 12px 16px; border: none; border-left: 5px solid transparent; box-shadow: 0 1px 3px rgba(0,0,0,0.03); }
.card-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.card-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--text-primary); }
.card-progress-summary { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.card-progress-summary strong { font-weight: 700; }
.card-progress-breakdown { font-size: 13px; color: var(--text-secondary); font-weight: 500; margin-top: 8px; }
.card-progress-breakdown .separator { margin: 0 4px; opacity: 0.5; }
.card-footnote { font-size: 12px; color: var(--text-secondary); opacity: 0.9; margin: 8px 0 0 0; padding-top: 8px; border-top: 1px solid rgba(0,0,0,0.05); }
.requirement-card.purple  { background: var(--card-purple-bg); border-color: var(--card-purple-border); }
.requirement-card.purple .bar-completed { background-color: var(--card-purple-fill); }
.requirement-card.purple .bar-planned { background-color: rgba(168, 85, 247, 0.5); }
.requirement-card.purple .card-progress-summary strong { color: var(--card-purple-fill); }
.requirement-card.green   { background: var(--card-green-bg); border-color: var(--card-green-border); }
.requirement-card.green .bar-completed { background-color: var(--card-green-fill); }
.requirement-card.green .bar-planned { background-color: rgba(34, 197, 94, 0.5); }
.requirement-card.green .card-progress-summary strong { color: var(--card-green-fill); }
.requirement-card.red { background: var(--card-red-bg); border-color: var(--card-red-border); }
.requirement-card.red .bar-completed { background-color: var(--card-red-fill); }
.requirement-card.red .bar-planned { background-color: rgba(239, 68, 68, 0.5); }
.requirement-card.red .card-progress-summary strong { color: var(--card-red-fill); }
.requirement-card.orange { background: var(--card-orange-bg); border-color: var(--card-orange-border); }
.requirement-card.orange .bar-completed { background-color: var(--card-orange-fill); }
.requirement-card.orange .bar-planned { background-color: rgba(249, 115, 22, 0.5); }
.requirement-card.orange .card-progress-summary strong { color: var(--card-orange-fill); }
.requirement-card.blue { background: var(--card-blue-bg); border-color: var(--card-blue-border); }
.requirement-card.blue .bar-completed { background-color: var(--card-blue-fill); }
.requirement-card.blue .bar-planned { background-color: rgba(59, 130, 246, 0.5); }
.requirement-card.blue .card-progress-summary strong { color: var(--card-blue-fill); }
.reset-container { margin-top: 24px; }
.reset-btn { width: 100%; padding: 10px; border: 1px solid var(--danger-color); background: transparent; color: var(--danger-color); border-radius: 8px; cursor: pointer; font-weight: 500; }

/* ======================================================= */
/* ===== Main Content (Semesters) ===== */
/* ======================================================= */

#add-semester-btn {
    background-color: var(--text-secondary); color: white; border: none; 
    padding: 10px 20px; border-radius: 8px; font-weight: 700; 
    font-family: var(--font-family); cursor: pointer;
    margin-top: 20px;
}
.semester-container {
    background-color: var(--bg-surface); border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    overflow: hidden; margin-bottom: 30px;
}
.semester-header { padding: 20px 24px; border-bottom: 1px solid var(--border-color); }
.semester-header h3 { display: flex; justify-content: space-between; align-items: center; margin: 0 0 4px 0; font-size: 22px; }
.semester-header p { margin: 0; color: var(--text-secondary); font-size: 14px; }
.delete-semester-btn { background: none; border: 1px solid var(--border-color); color: var(--text-secondary); font-size: 13px; padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.delete-semester-btn:hover { background-color: #f8f9fa; color: var(--text-danger); border-color: var(--text-danger);}

.courses-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.courses-table thead { background-color: var(--header-bg); }
.courses-table th {
    padding: 12px 24px; font-size: 12px; font-weight: 700; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.5px; text-align: right; border-bottom: 1px solid var(--border-color);
}
.courses-table td { padding: 16px 24px; vertical-align: middle; }

.course-row { border-bottom: 1px solid var(--border-color); }
.course-row:last-child { border-bottom: none; }
.course-row td:first-child { border-right: 4px solid transparent; } /* Side color border */

/* Category specific styles for row border */
.course-row.mandatory td:first-child { border-right-color: var(--side-color-mandatory); }
.course-row.choice td:first-child { border-right-color: var(--side-color-choice); }
.course-row.lab td:first-child { border-right-color: var(--side-color-lab); }
.course-row.spirit td:first-child { border-right-color: var(--side-color-spirit); }

/* Drag and drop styles */
.course-row .drag-handle {
    width: 20px; text-align: center; color: #ced4da; cursor: grab;
    padding-right: 12px;
    padding-left: 0;
}
.course-row .drag-handle:active { cursor: grabbing; }
.semester-container tbody.drop-hover { background: #e6f0ff; }
.course-row.dragging { opacity: 0.5; background: #f8f9fa; }

/* Course info styling */
.course-info .name { font-weight: 500; font-size: 16px; color: var(--text-primary); }
.course-info .code { font-size: 13px; color: var(--text-secondary); }
.course-prereqs { font-size: 13px; color: var(--text-secondary); word-wrap: break-word; }

/* Cell alignment */
.data-cell { text-align: center !important; }

/* Category badge */
.category-badge {
    display: inline-block; padding: 4px 12px; font-size: 12px; font-weight: 700;
    border-radius: 16px; line-height: 1.2; border: 1px solid;
}
.category-badge.mandatory { background-color: var(--cat-mandatory-bg); color: var(--side-color-mandatory); border-color: var(--side-color-mandatory); }
.category-badge.choice    { background-color: var(--cat-choice-bg); color: var(--side-color-choice); border-color: var(--side-color-choice); }
.category-badge.lab       { background-color: var(--cat-lab-bg); color: var(--side-color-lab); border-color: var(--side-color-lab); }
.category-badge.spirit    { background-color: var(--cat-spirit-bg); color: var(--side-color-spirit); border-color: var(--side-color-spirit); }
/* Tags and icons */
.core-tag { color: var(--text-secondary); font-weight: 700; font-size: 13px; }
.english-icon { color: #0d6efd; width: 20px; height: 20px; }
.delete-btn { background: none; border: none; padding: 4px; color: var(--text-secondary); line-height: 1; cursor: pointer; }
.delete-btn:hover { color: var(--text-danger); }
.delete-btn svg { width: 20px; height: 20px; }
.done-checkbox { cursor: pointer; }

/* Semester footer */
.semester-footer { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; background-color: var(--header-bg); border-top: 1px solid var(--border-color); }
.semester-summary { font-weight: 700; color: var(--text-primary); }
.add-course-btn { 
    background-color: #0d6efd; color: white; border: none; padding: 8px 16px; 
    border-radius: 8px; font-weight: 700; font-family: var(--font-family); 
    cursor: pointer; display: flex; align-items: center; gap: 8px; 
}
.add-course-btn:hover { background-color: #0b5ed7; }

/* ======================================================= */
/* ===== Responsive Design ===== */
/* ======================================================= */

/* --- Mobile view for semester courses (Cards) --- */
.mobile-courses-list { display: none; /* Initially hidden, shown via media query */ }

@media (max-width: 1280px) {
    /* Hide desktop table and show mobile list */
    .courses-table { display: none; }
    .mobile-courses-list { display: flex; flex-direction: column; gap: 16px; padding: 16px; }

    .course-card {
        display: flex; flex-direction: column;
        border-radius: 10px; background-color: var(--bg-surface);
        box-shadow: 0 4px 15px rgba(0,0,0,0.06);
        border: 1px solid var(--border-color);
        border-right: 4px solid transparent; /* Side color border */
    }
    /* Category specific styles for card border */
    .course-card.mandatory { border-right-color: var(--side-color-mandatory); }
    .course-card.choice { border-right-color: var(--side-color-choice); }
    .course-card.lab { border-right-color: var(--side-color-lab); }
    .course-card.spirit { border-right-color: var(--side-color-spirit); }

    .card-header {
        display: flex; gap: 12px; align-items: center;
        padding: 12px 16px; border-bottom: 1px solid var(--border-color);
    }
    .card-header .course-info { flex-grow: 1; }
    .card-header .drag-handle { cursor: grab; color: #ced4da; }
    .card-header .drag-handle:active { cursor: grabbing; }

    .card-body { padding: 16px; }
    .card-prereq { font-size: 13px; margin-top: 12px; }
    .card-prereq strong { color: var(--text-primary); }
    .card-stats {
        display: grid; grid-template-columns: repeat(2, 1fr);
        gap: 16px; font-size: 14px;
        padding-top: 16px; margin-top: 16px;
        border-top: 1px solid var(--border-color);
    }
    .stat-item .label { font-size: 12px; color: var(--text-secondary); }
    .stat-item .value { font-weight: 700; color: var(--text-primary); }
}

/* General responsive adjustments */
@media (max-width: 768px) { 
  body { padding-top: var(--header-height); }
  .content-wrapper { flex-direction: column; height: auto; }
  .summary, .main { overflow: visible; max-height: none; }
  .summary {
    flex: 0 0 auto; order: 1; border-left: none;
    border-bottom: 1px solid var(--border-light);
  }
  .main { order: 2; padding: 15px; }
  .total-progress-card {
      position: sticky; top: var(--header-height); z-index: 100;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }
}
@media (max-width: 480px) {
  .header-container { padding: 0 15px; }
  h1, h2, h3 { font-size: 18px; }
}

/* ===== Site Footer (Updated for Main Content Area) ===== */
.site-footer-bottom {
  text-align: center;
  padding: 24px;
  margin-top: 30px; /* This adds space above the footer */
  font-size: 14px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
}

.site-footer-bottom a {
  color: var(--text-primary);
  font-weight: 700;
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer-bottom a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

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

/* החלף את הסלקטור .bug-report-link בזה כדי שיחול על שני הכפתורים */
.header-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #f0f0f0;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.header-action-btn:hover {
    background-color: #e0e0e0;
    color: var(--text-primary);
}

.header-action-btn svg {
    color: var(--text-primary);
}