/* עדכון לקובץ style.css - רספונסיבי למחשבים וניידים עם שורות מתכונתות */

/* ===== כללי ===== */
:root {
  --primary-color: #2c3e50;
  --secondary-color: #3498db;
  --success-color: #2ecc71;
  --danger-color: #e74c3c;
  --warning-color: #f39c12;
  --light-color: #ecf0f1;
  --dark-color: #2c3e50;
  --gray-color: #bdc3c7;
  --text-color: #333;
  --border-radius: 0.25rem;
  --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --transition: all 0.3s ease;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text-color);
  background-color: #f8f9fa;
  direction: rtl;
  display: flex;
  position: relative;
}

/* ===== סרגל צדדי ===== */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 250px;
  background-color: var(--primary-color);
  color: #fff;
  z-index: 1000;
  transition: var(--transition);
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

.sidebar-logo img {
  height: 40px;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1.25rem;
  padding: 5px;
}

.sidebar-menu {
  padding: 20px 0;
}

.sidebar-item {
  padding: 10px 20px;
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: var(--transition);
}

.sidebar-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
}

.sidebar-item.active {
  background-color: var(--secondary-color);
  color: #fff;
}

.sidebar-icon {
  margin-left: 15px;
  width: 20px;
  text-align: center;
}

.sidebar-user {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user-name {
  font-weight: 600;
  margin-bottom: 5px;
}

.sidebar-user-role {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* כפתור תפריט מובייל - מוסתר במחשב */
.mobile-menu-toggle {
  display: none;
}

/* ===== תוכן ראשי ===== */
.main-content {
  flex: 1;
  margin-right: 250px;
  padding: 20px;
  min-height: 100vh;
  width: calc(100% - 250px);
  transition: var(--transition);
  position: relative;
}

.main-content.expanded {
  margin-right: 0;
  width: 100%;
}

/* כותרת דף */
.page-header {
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
}

.page-title {
  margin: 0;
  font-size: 1.8rem;
}

/* קלפים */
.card {
  border: none;
  border-radius: 10px;
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  margin-bottom: 20px;
  overflow: visible;
}

.card:hover {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
  background-color: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 15px 20px;
}

.card-body {
  padding: 20px;
}

/* כרטיסי סטטיסטיקה */
.stats-card {
  background-color: #fff;
  border-radius: 10px;
  box-shadow: var(--box-shadow);
  padding: 20px;
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  transition: var(--transition);
  height: auto;
}

.stats-card:hover {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  transform: translateY(-5px);
}

.stats-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-left: 15px;
  color: #fff;
}

.stats-info {
  flex-grow: 1;
}

.stats-value {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
}

.stats-label {
  color: #6c757d;
  margin: 0;
}

.stats-card.primary .stats-icon {
  background-color: var(--primary-color);
}

.stats-card.success .stats-icon {
  background-color: var(--success-color);
}

.stats-card.danger .stats-icon {
  background-color: var(--danger-color);
}

.stats-card.warning .stats-icon {
  background-color: var(--warning-color);
}

/* === טבלאות עם שורות מתכונתות (כללי לכל הדפים) === */
.table-container {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* איפוס כל הסגנונות הקיימים של הטבלה */
.table {
  margin: 0 !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: transparent !important;
}

/* כותרות הטבלה */
.table thead th {
  background: linear-gradient(135deg, #495057 0%, #343a40 100%) !important;
  color: white !important;
  font-weight: 600 !important;
  border: none !important;
  padding: 15px 12px !important;
  text-align: center !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 10 !important;
}

.table thead th:first-child {
  border-top-right-radius: 8px !important;
}

.table thead th:last-child {
  border-top-left-radius: 8px !important;
}

/* === שורות מתכונתות חזקות === */
.table tbody tr {
  transition: all 0.2s ease !important;
  border: none !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02) !important;
}

/* שורות זוגיות - רקע אפור כהה */
.table tbody tr:nth-child(even) {
  background: #e9ecef !important;
}

/* שורות אי-זוגיות - רקע לבן */
.table tbody tr:nth-child(odd) {
  background: #ffffff !important;
}

/* אפקט hover על שורות */
.table tbody tr:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
  z-index: 5 !important;
  position: relative !important;
  background: #e3f2fd !important; /* כחול בהיר בהובר */
}

/* תאי טבלה */
.table tbody td {
  padding: 12px !important;
  vertical-align: middle !important;
  border: none !important;
  border-bottom: 1px solid rgba(0,0,0,0.08) !important;
  font-size: 0.9rem !important;
}

/* עיצוב מיוחד לעמודות ספציפיות */
.table tbody td:first-child {
  font-weight: 600 !important;
  color: #2c3e50 !important;
}

/* שיפור נראות בורדרים */
.table thead th {
  border-bottom: 3px solid #dee2e6 !important;
}

/* וידוא שכל השורות מתכונתות */
.table > tbody > tr:nth-child(even) > td {
  background-color: #e9ecef !important;
}

.table > tbody > tr:nth-child(odd) > td {
  background-color: #ffffff !important;
}

/* ביטול כל הרקעים האחרים */
.table > tbody > tr > td {
  background-image: none !important;
}

.table > tbody > tr {
  background-image: none !important;
}

/* מודאל */
.modal-dialog {
  max-width: 650px;
}

.modal-content {
  border-radius: 10px;
  border: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.modal-header {
  background-color: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  padding: 15px 20px;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  border-top: 1px solid #e9ecef;
  padding: 15px 20px;
  background-color: #f8f9fa;
}

/* כפתור התנתקות (צבע אדום) */
#logoutBtn {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: #fff;
}

#logoutBtn:hover {
    background-color: #c0392b;
    border-color: #c0392b;
}

/* במקרה שיש עיצוב קיים של outline, נדרוס אותו */
.sidebar-user .btn-outline-light#logoutBtn {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: #fff;
}

.sidebar-user .btn-outline-light#logoutBtn:hover {
    background-color: #c0392b;
    border-color: #c0392b;
}

/* ===== Mobile Overlay ===== */
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.mobile-overlay.active {
  display: block;
}

/* ===== תמיכה במובייל ===== */
@media (max-width: 768px) {
  /* סרגל צדדי במובייל */
  .sidebar {
    transform: translateX(100%);
    width: 280px;
    right: -280px;
  }
  
  .sidebar.active {
    transform: translateX(0);
    right: 0;
  }

  /* תוכן ראשי במובייל */
  .main-content {
    margin-right: 0;
    width: 100%;
    padding: 15px;
  }

  .main-content.sidebar-open {
    margin-right: 0;
  }

  /* כותרת דף במובייל */
  .page-header {
    flex-direction: column;
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
  }

  .page-title {
    font-size: 1.5rem;
    margin-bottom: 10px;
  }

  /* כפתור המבורגר */
  .mobile-menu-toggle {
    display: block;
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1001;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  }

  /* כרטיסי סטטיסטיקה במובייל */
  .stats-card {
    padding: 15px;
    margin-bottom: 15px;
  }

  .stats-icon {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    margin-left: 10px;
  }

  .stats-value {
    font-size: 1.5rem;
  }

  .stats-label {
    font-size: 0.9rem;
  }

  /* קלפים במובייל */
  .card {
    margin-bottom: 15px;
  }

  .card-header {
    padding: 12px 15px;
  }

  .card-body {
    padding: 15px;
  }

  /* מודאל במובייל */
  .modal-dialog {
    margin: 5px;
    max-width: calc(100% - 10px);
  }

  .modal-header {
    padding: 12px 15px;
  }

  .modal-body {
    padding: 15px;
  }

  .modal-footer {
    padding: 12px 15px;
  }

  /* סרגל צדדי במובייל - תוכן */
  .sidebar-header {
    padding: 15px;
  }

  .sidebar-logo img {
    height: 35px;
  }

  .sidebar-item {
    padding: 12px 15px;
    font-size: 0.95rem;
  }

  .sidebar-icon {
    margin-left: 12px;
    width: 18px;
  }

  .sidebar-user {
    padding: 15px;
  }

  .sidebar-user-name {
    font-size: 0.95rem;
  }

  .sidebar-user-role {
    font-size: 0.75rem;
  }

  /* כפתורים במובייל */
  .btn {
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  .btn-sm {
    padding: 5px 8px;
    font-size: 0.8rem;
  }

  .btn-lg {
    padding: 12px 20px;
    font-size: 1rem;
  }

  /* פורמים במובייל */
  .form-control, .form-select {
    font-size: 1rem; /* מונע זום באייפון */
    padding: 8px 12px;
  }

  .form-label {
    font-size: 0.9rem;
    margin-bottom: 5px;
  }

  /* רשת במובייל */
  .row > * {
    margin-bottom: 10px;
  }

  /* טבלאות במובייל */
  .table-responsive {
    border-radius: 8px;
  }

  .table {
    font-size: 0.85rem;
  }

  .table th, .table td {
    padding: 8px 6px !important;
    vertical-align: middle;
  }

  /* כפתורי פעולה במובייל */
  .action-buttons {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  .action-buttons .btn {
    width: 100%;
    font-size: 0.8rem;
    padding: 6px 8px;
  }
}

/* ===== מסכים קטנים מאוד ===== */
@media (max-width: 480px) {
  .main-content {
    padding: 10px;
  }

  .page-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
  }

  .page-title {
    font-size: 1.3rem;
  }

  .stats-card {
    padding: 12px;
    flex-direction: column;
    text-align: center;
  }

  .stats-icon {
    margin-left: 0;
    margin-bottom: 10px;
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
  }

  .stats-value {
    font-size: 1.3rem;
  }

  .stats-label {
    font-size: 0.85rem;
  }

  .card-header {
    padding: 10px 12px;
  }

  .card-body {
    padding: 12px;
  }

  .modal-dialog {
    margin: 2px;
    max-width: calc(100% - 4px);
  }

  .btn {
    font-size: 0.85rem;
    padding: 6px 10px;
  }

  .table {
    font-size: 0.8rem;
  }

  .table th, .table td {
    padding: 6px 4px !important;
  }
}

/* ===== תמיכה במסכים גדולים ===== */
@media (min-width: 1200px) {
  .main-content {
    padding: 30px;
  }

  .page-header {
    margin-bottom: 40px;
  }

  .page-title {
    font-size: 2rem;
  }

  .stats-card {
    padding: 25px;
  }

  .stats-value {
    font-size: 2rem;
  }

  .card-body {
    padding: 25px;
  }
}

/* ===== הסתרת כפתור המבורגר במחשבים ===== */
@media (min-width: 769px) {
  .mobile-menu-toggle {
    display: none;
  }
}

/* ===== שיפורים נוספים למובייל ===== */
@media (max-width: 768px) {
  /* מניעת זום בעת מגע בשדות טקסט באייפון */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="url"],
  textarea,
  select {
    font-size: 16px !important; /* מונע זום אוטומטי */
  }

  /* שיפור גלילה אופקית בטבלאות */
  .table-responsive {
    -webkit-overflow-scrolling: touch; /* גלילה חלקה באייפון */
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 1rem;
  }

  /* שיפור תצוגת מודלים */
  .modal-content {
    max-height: 95vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* שיפור כפתורים במובייל - גודל מינימלי למגע */
  .btn, button {
    min-height: 44px; /* מינימום לפי הנחיות Apple */
    min-width: 44px;
  }

  .btn-sm {
    min-height: 36px;
    min-width: 36px;
  }

  /* שיפור כרטיסים */
  .card {
    border-radius: 12px;
    margin-bottom: 1rem;
  }

  /* שיפור spacing בין אלמנטים */
  .row {
    margin-right: -10px;
    margin-left: -10px;
  }

  .row > * {
    padding-right: 10px;
    padding-left: 10px;
  }

  /* שיפור פילטרים */
  .card-body .row .col-md-3,
  .card-body .row .col-md-4,
  .card-body .row .col-md-6 {
    margin-bottom: 0.75rem;
  }

  /* viewport meta - מניעת זום על double tap */
  * {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    -webkit-touch-callout: none;
  }

  a, button {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.2);
  }
}

/* ===== שיפורים למסכים קטנים מאוד (320px-480px) ===== */
@media (max-width: 480px) {
  /* הקטנת גופנים */
  html {
    font-size: 14px;
  }

  /* שיפור header */
  .page-header {
    gap: 10px;
  }

  .page-header .btn {
    width: 100%;
  }

  /* שיפור טבלאות - הסתרת עמודות לא חיוניות */
  .table th:nth-child(n+5),
  .table td:nth-child(n+5) {
    display: none; /* מסתיר עמודות מעבר ל-4 */
  }

  /* בעמוד הזמנות - שמירת עמודות חשובות */
  .orders-table th:nth-child(1),
  .orders-table td:nth-child(1),
  .orders-table th:nth-child(2),
  .orders-table td:nth-child(2),
  .orders-table th:last-child,
  .orders-table td:last-child {
    display: table-cell !important;
  }

  /* שיפור כפתורי פעולה */
  .action-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 5px;
  }

  .action-buttons .btn {
    flex: 1 1 48%;
    min-width: 80px;
    font-size: 0.75rem;
    padding: 8px 4px;
  }

  /* שיפור מרווחים */
  .mb-3 {
    margin-bottom: 0.75rem !important;
  }

  .mb-4 {
    margin-bottom: 1rem !important;
  }
}

/* ===== תמיכה בטאבלטים (768px-1024px) ===== */
@media (min-width: 768px) and (max-width: 1024px) {
  .main-content {
    padding: 20px;
  }

  .table {
    font-size: 0.9rem;
  }

  .stats-card {
    padding: 20px;
  }
}

/* ===== תמיכה במצב landscape במובייל ===== */
@media (max-width: 896px) and (orientation: landscape) {
  .sidebar {
    width: 240px;
  }

  .main-content {
    padding: 15px;
  }

  .page-header {
    margin-bottom: 15px;
  }

  .modal-dialog {
    max-height: 90vh;
  }
}

/* ===== תיקון בעיות ידועות ב-iOS ===== */
@supports (-webkit-touch-callout: none) {
  /* תיקון ל-iOS בלבד */
  input, textarea, select {
    -webkit-appearance: none;
    appearance: none;
  }

  .form-control, .form-select {
    border-radius: 8px; /* iOS מעדיף פינות מעוגלות יותר */
  }

  /* תיקון גלילה במודלים */
  .modal-body {
    -webkit-overflow-scrolling: touch;
  }
}