/* Modern Dashboard Main CSS */

/* Basic Reset and Typography */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

/* Layout Container */
.main-content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: 250px; /* Match sidebar width */
  transition: margin-left 0.3s ease;
  padding-left: 20px;
  padding-right: 20px;
  padding-top: 20px;

}

/* Dashboard Container */
.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 15px;
}

/* Dashboard Title */
.dashboard-title {
  font-size: 28px;
  font-weight: 500;
  color: #333;
  margin-bottom: 25px;
  padding-bottom: 10px;
  border-bottom: 2px solid #E67E22;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* Exactly 2 columns */
  grid-template-rows: repeat(3, minmax(150px, auto)); /* 3 rows */
  gap: 20px;
  margin-bottom: 10px;
}

/* Grid Boxes */
.grid-box {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 20px;
  min-height: 150px;
  min-width: 600px;
  display: inline-block;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.grid-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Ensure boxes maintain aspect ratio */
.grid-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background-color: #E67E22;
}

.grid-box h2 {
  font-size: 22px;
  font-weight: 500;
  color: #444;
  margin: 0;
  z-index: 2;
}

/* Responsive behavior - switch to 1 column on mobile */
@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr; /* 1 column on mobile */
    grid-template-rows: repeat(6, minmax(150px, auto)); /* 6 rows */
  }
}

/* Different colors for different grid boxes */
.grid-box.inventory::before {
  background-color: #27ae60;
}

.grid-box.vehicles::before {
  background-color: #3498db;
}

.grid-box.forms::before {
  background-color: #e74c3c;
}

.grid-box.origin-reporting::before {
  background-color: #9b59b6;
}

.grid-box.outlook::before {
  background-color: #2980b9;
}

.grid-box.staff::before {
  background-color: #f39c12;
}

/* Sidebar Styles */
.sidebar {
  width: 250px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background-color: #fff;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  z-index: 100;
  transition: width 0.3s ease;
}

.logouser {
  display: flex;
  justify-content: center;
  padding: 20px 15px;
  border-bottom: 1px solid #eee;
}

.logouser1 {
  max-width: 80%;
}

/* Sidebar Links */
.sidebar-links {
  margin: 20px 0;
  padding: 15 15px;
  margin-left: 12px;
}

.sidebar-links a {
  display: flex;
  align-items: center;
  color: #555;
  text-decoration: none;
  padding: 12px 5px;
  border-radius: 4px;
  transition: all 0.2s ease;
  margin-bottom: 5px;
  font-weight: 500;
}

.sidebar-links a:hover {
  background-color: #f5f5f5;
  color: #E67E22;
}

.sidebar-links a::before,
.dropbtn::before {
  margin-right: 10px;
  width: 20px;
  text-align: center;
}

/* Dropdown Buttons */
.dropbtn {
  display: flex;
  align-items: center;
  color: #555;
  text-decoration: none;
  padding: 12px 5px;
  border-radius: 4px;
  transition: all 0.2s ease;
  margin-bottom: 5px;
  font-weight: 500;
}

.dropbtn:hover {
  background-color: #f5f5f5;
  color: #E67E22;
}

/* Dropdown Content */
.dropdown-content-sidebar {
  padding-left: 15px;
  display: none;
  margin-bottom: 10px;
}

.dropdown-content-sidebar a {
  color: #666;
  padding: 15px 8px 8px 30px;
  text-decoration: none;
  display: block;
  position: relative;
  border-radius: 4px;
  margin-bottom: 2px;
}

.dropdown-content-sidebar a:hover {
  background-color: #f5f5f5;
  color: #E67E22;
}

/* Show dropdown */
.show {
  display: block;
}

/* Header Bar */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #fff;
  padding: 15px 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 99;
}

.header-left h1 {
  font-size: 22px;
  font-weight: 500;
  margin: 0;
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.search-container {
  position: relative;
  width: 350px;
}

#search-bar {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  transition: all 0.2s ease;
}

#search-bar:focus {
  border-color: #E67E22;
  outline: none;
  box-shadow: 0 0 5px rgba(230, 126, 34, 0.3);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 5px;
  background-color: #fff;
  border-radius: 4px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  z-index: 10;
  display: none;
  max-height: 300px;
  overflow-y: auto;
}

.search-results.visible {
  display: block;
}

.search-results li {
  padding: 10px 15px;
  cursor: pointer;
  list-style: none;
  border-bottom: 1px solid #eee;
}

.search-results li:last-child {
  border-bottom: none;
}

.search-results li:hover {
  background-color: #f5f5f5;
}

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.icon-button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: #555;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.icon-button:hover {
  background-color: #f5f5f5;
  color: #E67E22;
}

/* Profile Menu */
.profile-menu {
  position: relative;
}

.profile-pic {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 10px;
  background-color: #fff;
  border-radius: 4px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  min-width: 200px;
  display: none;
  z-index: 20;
}

.profile-dropdown.show {
  display: block;
}

.profile-dropdown ul {
  list-style: none;
  padding: 10px 0;
}

.profile-dropdown li a {
  padding: 10px 20px;
  display: block;
  color: #555;
  text-decoration: none;
  transition: all 0.2s ease;
}

.profile-dropdown li a:hover {
  background-color: #f5f5f5;
  color: #E67E22;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background-color: #fff;
  margin: 50px auto;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  max-width: 600px;
  width: 90%;
  animation: slideIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateY(-50px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
  transition: color 0.2s ease;
}

.close:hover {
  color: #333;
}

/* Site Switcher Styles */
.site-select {
  padding: 8px 15px;
  border-radius: 4px;
  border: 1px solid #ddd;
  background-color: white;
  cursor: pointer;
  font-size: 16px;
  min-width: 200px;
  color: #333;
  transition: all 0.2s ease;
  margin-left: 15px;
}

.site-select:focus {
  outline: none;
  border-color: #E67E22;
  box-shadow: 0 0 5px rgba(230, 126, 34, 0.3);
}

.site-switch-message {
  padding: 5px 12px;
  background-color: #d4edda;
  color: #155724;
  border-radius: 4px;
  margin-left: 15px;
  display: inline-block;
  animation: fadeOut 5s forwards;
  font-size: 14px;
}

.site-switch-error {
  padding: 5px 12px;
  background-color: #f8d7da;
  color: #721c24;
  border-radius: 4px;
  margin-left: 15px;
  display: inline-block;
  animation: fadeOut 5s forwards;
  font-size: 14px;
}

@keyframes fadeOut {
  0% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}

/* Expandable Dashboard Columns */
#expandable-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.expandable-column {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.expandable-column:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.expandable-header {
  padding: 15px 20px;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.expandable-header::after {
  content: '\f054'; /* Font Awesome chevron-right */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  transition: transform 0.2s ease;
  font-size: 14px;
  color: #888;
}

.expandable-column.expanded .expandable-header::after {
  transform: rotate(90deg);
}

.expandable-column.expanded .expandable-header {
  background-color: #f9f9f9;
  border-bottom: 1px solid #eee;
}

.expandable-header a {
  text-decoration: none;
  color: #444;
  font-weight: 500;
  font-size: 16px;
  flex: 1;
}

.expandable-content {
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.expandable-column.expanded .expandable-content {
  padding: 15px 20px;
  max-height: 500px; /* Large enough to fit content */
}

.expandable-content a {
  display: block;
  padding: 8px 0;
  color: #666;
  text-decoration: none;
  transition: all 0.2s ease;
  border-radius: 4px;
}

.expandable-content a:hover {
  color: #E67E22;
  background-color: #f5f5f5;
  padding-left: 10px;
}

/* Responsive Styles */
@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 992px) {
  .sidebar {
    width: 200px;
  }
  
  .main-content {
    margin-left: 200px;
  }
  
  .search-container {
    width: 280px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 0;
    box-shadow: none;
  }
  
  .sidebar.open {
    width: 250px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .dashboard-title {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .site-select {
    margin: 10px 0 0 0;
    width: 100%;
  }
  
  .search-container {
    width: 100%;
  }
  
  .header-center {
    display: none;
  }
  
  #expandable-dashboard {
    grid-template-columns: 1fr;
  }
}

/* Footer */
footer {
  margin-top: 50px;
  padding: 20px 0;
  text-align: center;
  border-top: 1px solid #eee;
  color: #777;
  font-size: 14px;
}

footer a {
  color: #E67E22;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}