/* 🔴 CAT Theme Variables */
:root {
  --primary: #FFCD11;
  /* Caterpillar Yellow */
  --primary-dark: #FFB300;
  --dark-bg: #212121;
  /* Dark Grey/Black */
  --sidebar-bg: #1c1c1c;
  --text-on-dark: #FFCD11;
  --light-bg: #f4f4f4;
  --sidebar-w: 250px;
}

body {
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: var(--light-bg);
  margin: 0;
  color: #333;
  direction: rtl;
}

.hidden {
  display: none !important;
}

/* Login Screen */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: linear-gradient(135deg, #000, #333);
}

.login-box {
  background: white;
  padding: 40px;
  border-radius: 8px;
  width: 320px;
  text-align: center;
  border-top: 5px solid var(--primary);
}

.login-box h2 {
  color: #000;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.login-box input {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
  background: #f9f9f9;
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #000;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  text-transform: uppercase;
  transition: 0.3s;
}

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

/* Layout */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar - Dark & Industrial */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid #333;
  display: flex;
  flex-direction: column;
  padding: 20px;
  z-index: 100;
  transition: 0.3s;
  text-align: left;
  direction: ltr;
  color: #ccc;
}

.sidebar-header {
  font-size: 22px;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 30px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 2px solid #333;
  padding-bottom: 10px;
}

.menu-item {
  padding: 12px 15px;
  margin-bottom: 5px;
  border-radius: 4px;
  cursor: pointer;
  color: #bbb;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: 0.2s;
}

.menu-item:hover {
  background: #333;
  color: var(--primary);
}

.menu-item.active {
  background: var(--primary);
  color: #000;
  font-weight: bold;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid #333;
  padding-top: 20px;
}

/* Content */
.main-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  position: relative;
  background: #e0e0e0;
}

.menu-toggle {
  display: none;
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 200;
  background: #000;
  color: var(--primary);
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
}

/* Cards */
.card {
  background: white;
  border-radius: 2px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-top: 3px solid #000;
}

/* Inputs & Filters */
.filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 15px;
}

.search-full {
  width: 100%;
  padding: 12px;
  border-radius: 4px;
  border: 1px solid #ccc;
  box-sizing: border-box;
  font-size: 15px;
}

select,
input {
  width: 100%;
  padding: 10px;
  margin-top: 5px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  background: white;
}

.time-input {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Buttons */
.save-btn {
  background: #000;
  color: var(--primary);
  border: none;
  padding: 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  width: 100%;
  margin-top: 15px;
  text-transform: uppercase;
}

.save-btn:hover {
  background: #333;
}

.admin-btn {
  background: #000;
  color: white;
  border: none;
  padding: 10px;
  border-radius: 4px;
  width: 100%;
  margin-top: 10px;
  cursor: pointer;
  transition: 0.2s;
}

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

.excel-btn {
  background: #1b5e20;
  color: white;
  border: none;
  padding: 5px 12px;
  border-radius: 2px;
  font-size: 12px;
  cursor: pointer;
  margin-left: 10px;
}

/* Stats & Tabs */
.log-stats-bar {
  display: flex;
  justify-content: space-between;
  background: #000;
  color: white;
  padding: 12px 15px;
  border-radius: 4px;
  margin-bottom: 15px;
  font-size: 13px;
  border-bottom: 3px solid var(--primary);
}

.log-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.log-stat-num {
  font-size: 18px;
  font-weight: bold;
  color: var(--primary);
}

.tabs-container {
  display: flex;
  margin-bottom: 15px;
  background: #ddd;
  padding: 5px;
  border-radius: 4px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  font-weight: bold;
  color: #555;
  cursor: pointer;
  border-radius: 4px;
  transition: 0.2s;
}

.tab-btn.active {
  background: #000;
  color: var(--primary);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Stats Row */
.stat-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.stat-box {
  flex: 1;
  background: white;
  border-radius: 4px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-top: 3px solid var(--primary);
}

.stat-box h4 {
  margin: 0 0 10px 0;
  color: #555;
  font-size: 14px;
}

.stat-val {
  font-size: 28px;
  font-weight: bold;
  color: #000;
}

/* Tables */
.cost-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.cost-table td,
.cost-table th {
  padding: 8px;
  border-bottom: 1px solid #eee;
  text-align: left;
}

.cost-table th {
  background: #333;
  color: white;
  border-bottom: 3px solid var(--primary);
}

/* Items */
.todo-item {
  background: #fff;
  border: 1px solid #eee;
  border-left: 4px solid #999;
  border-radius: 4px;
  margin-bottom: 8px;
  overflow: hidden;
}

.todo-header {
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.todo-header:hover {
  background: #f9f9f9;
}

.todo-body {
  padding: 15px;
  background: #fcfcfc;
  border-top: 1px solid #eee;
  display: none;
}

.todo-body.open {
  display: block;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    right: -260px;
    height: 100%;
    text-align: right;
    direction: rtl;
  }

  .sidebar.show {
    right: 0;
  }

  .menu-toggle {
    display: block;
  }

  .main-content {
    padding: 10px;
    margin-top: 40px;
  }

  .stat-row {
    flex-direction: column;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== AUTOCOMPLETE STYLES ==================== */
.autocomplete-wrapper {
  position: relative;
  width: 100%;
}

.autocomplete-input {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.autocomplete-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(255, 205, 17, 0.3);
  outline: none;
}

.autocomplete-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 250px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.autocomplete-suggestions.active {
  display: block;
}

.autocomplete-item {
  padding: 12px 15px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
  background: #FFF8E1;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item .item-icon {
  font-size: 20px;
}

.autocomplete-item .item-main {
  font-weight: bold;
  color: #333;
}

.autocomplete-item .item-sub {
  font-size: 11px;
  color: #666;
  margin-top: 2px;
}

.autocomplete-item .item-badge {
  background: #eee;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  color: #555;
}

.autocomplete-no-results {
  padding: 15px;
  text-align: center;
  color: #999;
  font-style: italic;
}

/* Picklist Filter Style */
.picklist-item {
  padding: 10px 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.2s;
}

.picklist-item:hover {
  background: #fff3cd;
}

.picklist-item .item-icon {
  font-size: 16px;
}

.picklist-item .item-main {
  flex: 1;
  font-size: 13px;
}

.filters-grid .autocomplete-wrapper {
  width: 100%;
}

.filters-grid .autocomplete-input {
  width: 100%;
  padding: 10px 15px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.filters-grid .autocomplete-input:focus {
  border-color: #FFCD11;
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 205, 17, 0.2);
}

.filters-grid .autocomplete-suggestions {
  max-height: 250px;
}

/* ==================== REPORT TABS ==================== */
.report-tabs {
  display: flex;
  gap: 5px;
  background: #f0f0f0;
  padding: 5px;
  border-radius: 8px;
}

.report-tab-btn {
  flex: 1;
  padding: 12px 15px;
  border: none;
  background: transparent;
  font-weight: bold;
  color: #555;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.3s;
  font-size: 13px;
}

.report-tab-btn:hover {
  background: #e0e0e0;
}

.report-tab-btn.active {
  background: #000;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ==================== EQUIPMENT LOG SUMMARY ==================== */
.eq-summary-item {
  text-align: center;
  padding: 10px 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  min-width: 100px;
}

.eq-summary-item span {
  display: block;
  font-size: 11px;
  color: #666;
  margin-bottom: 5px;
}

.eq-summary-item strong {
  font-size: 20px;
  color: #333;
}

/* Status Colors in Tables */
.status-working {
  color: #2e7d32;
  font-weight: bold;
}

.status-breakdown {
  color: #d32f2f;
  font-weight: bold;
}

.status-standby {
  color: #f57c00;
  font-weight: bold;
}

.status-holiday {
  color: #9e9e9e;
  font-style: italic;
}

/* Day Rows */
.day-row-friday {
  background: #fff3e0 !important;
}

.day-row-missing {
  background: #ffebee !important;
}

/* Enhanced Table Hover */
.cost-table tbody tr:hover {
  background: #f5f5f5;
}

/* ==================== COMPARISON STYLES ==================== */
.comparison-summary {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  margin-top: 20px;
}

.comp-card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.comp-card h4 {
  margin: 0 0 15px 0;
  text-align: center;
  font-size: 16px;
}

.month1-card {
  border-top: 4px solid #2196f3;
}

.month2-card {
  border-top: 4px solid #4caf50;
}

.comparison-card {
  border-top: 4px solid #ff9800;
  background: #fff8e1;
}

.comp-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.comp-stats>div {
  text-align: center;
  padding: 10px;
  background: #f5f5f5;
  border-radius: 8px;
}

.comp-stats span {
  display: block;
  font-size: 11px;
  color: #666;
  margin-bottom: 5px;
}

.comp-stats strong {
  font-size: 18px;
  color: #333;
}

.diff-value {
  font-size: 18px !important;
}

.diff-positive {
  color: #2e7d32 !important;
}

.diff-negative {
  color: #d32f2f !important;
}

/* ==================== ALERT STYLES ==================== */
.alert-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin: 20px 0;
}

.alert-card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.alert-card:hover {
  transform: translateY(-3px);
}

.alert-danger {
  border-right: 4px solid #d32f2f;
}

.alert-warning {
  border-right: 4px solid #ff9800;
}

.alert-info {
  border-right: 4px solid #2196f3;
}

.alert-success {
  border-right: 4px solid #4caf50;
}

.alert-icon {
  font-size: 32px;
}

.alert-info span {
  display: block;
  font-size: 12px;
  color: #666;
}

.alert-info strong {
  font-size: 28px;
  color: #333;
}

.alerts-list {
  max-height: 300px;
  overflow-y: auto;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px;
  border-bottom: 1px solid #eee;
  transition: background 0.2s;
}

.alert-item:hover {
  background: #f9f9f9;
}

.alert-item:last-child {
  border-bottom: none;
}

.alert-item-icon {
  font-size: 24px;
}

.alert-item-content {
  flex: 1;
}

.alert-item-title {
  font-weight: bold;
  color: #333;
}

.alert-item-sub {
  font-size: 12px;
  color: #666;
  margin-top: 3px;
}

.alert-item-badge {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: bold;
}

.badge-danger {
  background: #ffebee;
  color: #d32f2f;
}

.badge-warning {
  background: #fff3e0;
  color: #e65100;
}

.badge-info {
  background: #e3f2fd;
  color: #1565c0;
}

.no-alerts {
  text-align: center;
  padding: 30px;
  color: #999;
  font-style: italic;
}

/* Responsive for alerts */
@media (max-width: 768px) {
  .alert-summary {
    grid-template-columns: 1fr 1fr;
  }

  .comparison-summary {
    grid-template-columns: 1fr;
  }

  .report-tabs {
    flex-wrap: wrap;
  }

  .report-tab-btn {
    flex: 1 1 45%;
    font-size: 11px;
    padding: 10px;
  }
}

/* ==================== PWA STYLES ==================== */
.pwa-install-prompt {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  background: #000;
  color: #FFCD11;
  padding: 15px 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.pwa-install-prompt button {
  background: #FFCD11;
  color: #000;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
}

.pwa-install-prompt .close-btn {
  background: transparent;
  color: #888;
  padding: 5px 10px;
}

/* ==================== MODAL STYLES ==================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal.hidden {
  display: none !important;
}

.modal-content {
  background: white;
  border-radius: 10px;
  padding: 25px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  border-top: 4px solid #1565c0;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-content h3 {
  margin: 0 0 20px 0;
  text-align: center;
}

.modal-content label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: #555;
}

.modal-content input {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

.modal-content input:focus {
  border-color: #1565c0;
  outline: none;
}

/* ==================== QUICK TIME BUTTONS ==================== */
.quick-time-btn {
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.quick-time-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  filter: brightness(1.1);
}

.quick-time-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.quick-time-btn small {
  opacity: 0.9;
  font-weight: normal;
}