.container{
/*
border-style: dashed;
border-color: lightgray;
*/
  padding-bottom: 80px; /* Increased from 60px to provide more space at the bottom */
}
#active_card_wrapper {
  margin-top: 2%; /* Reduced from 5% */
  background-color: var(--card-background);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px 15px; /* Added horizontal padding, reduced vertical */
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

#active_card_logo {
  flex: 0 0 12.5%; /* 1/8 of screen width */
  margin-right: 10px;
  max-width: 12.5%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#active_card_logo img {
  max-width: 100%;
  max-height: 30px;
  width: auto;
  height: auto;
  display: block;
  background-color: white;
  border-radius: 5px;
  padding: 3px;
  object-fit: contain;
}

.right {
  float: right;
  width: 8%;
  border: 1px solid #73AD21;
  padding: 10px;
  margin: 0px 0px 0px 0px;
  padding: 0px 0px 0px 0px;
}

.center_element {
  margin: auto;
  width: 50%;
  border: 3px solid green;
  padding: 10px;
}
#active_card_barcode {
  text-align: center;
  margin: 1px auto;
  max-width: 70%;
  background-color: white;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

#active_card_barcode::after {
  content: "Paspauskite kodą, kad padidintumėte";
  display: block;
  font-size: 0.7em;
  opacity: 0.7;
  margin-top: 5px;
  color: var(--text-color);
}

#active_card_barcode img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  border-radius: 4px;
  background-color: white !important;
  filter: none !important;
  /* Make sure content is crisp for scanners */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.qrcode {
  max-width: 60%;
  min-width: 60%;
  max-height: 60%;
  min-height: 60%;
}

.barcode {
  max-width: 95%;
  min-width: 95%;
  max-height: 95%;
  min-height: 95%;
}

#active_card_number {
  flex: 1;
  text-align: left;
  margin: 0;
  font-size: 0.9em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 35px; /* Space for theme toggle */
}

#active_card_number a {
  text-decoration: none;
}

#card_list_wrapper {
  margin-top: 1%; /* Reduced from 6% */
  padding-top: 1%; /* Reduced from 6% */
  border-top: #e9e9e8 solid 1px;
}

#card_list_wrapper ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  /*
  background-color: #eeeeee;
  */
}

#card_list_wrapper li {
  float: none;
  width: 20%;
  position: relative;
  display: block;
  padding: 0;
  height: auto;
  margin-bottom: 0; /* Removed to eliminate all spacing between items */
}

#card_list_wrapper li a {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  margin: 2% 2% 0 2%; /* Changed from 2% to remove bottom margin */
  text-decoration: none;
  height: 100%;
}

.logo-container {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: white;
  border-radius: 5px;
  padding: 5px;
  position: relative;
}

#card_list_wrapper ul li a.selected {
  background-color: #c2c6ff80;
}


#card_list_wrapper li a:hover {
  background-color: #b7b9e281;
}

#card_list_wrapper img {
  max-width: 80%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Priority badges for store cards */
.priority-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background-color: var(--card-background);
  color: var(--text-color);
  font-size: 0.7em;
  padding: 1px 4px;
  border-radius: 10px;
  opacity: 0.7;
}

/* Hide priority badges by default and show on hover for cleaner interface */
.priority-badge {
  visibility: hidden;
  transition: visibility 0.2s, opacity 0.2s;
}

#card_list_wrapper li a:hover .priority-badge {
  visibility: visible;
  opacity: 0.9;
}

/* Logo row styling */
.logo-row {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  margin-bottom: 0; /* Removed margin bottom */
}

.card-header-row {
  display: flex;
  align-items: center;
  margin-bottom: 0; /* Removed margin bottom (was 5px) */
  width: 100%;
}

/* Dark Theme Styles */
:root {
  --background-color: #ffffff;
  --text-color: #222222;
  --card-background: #f5f5f5;
  --card-border: #e1e1e1;
  --header-background: #f8f8f8;
}

[data-theme="dark"] {
  --background-color: #121212;
  --text-color: #e1e1e1;
  --card-background: #1e1e1e;
  --card-border: #333333;
  --header-background: #1a1a1a;
}

/* Apply theme variables */
body {
  background-color: var(--background-color);
  color: var(--text-color);
  transition: background-color 0.3s ease, color 0.3s ease;
}

#active_card_number {
  color: var(--text-color);
}

#active_card_number a {
  color: var(--text-color);
}

#card_list_wrapper {
  background-color: var(--header-background);
  border-top: 1px solid var(--card-border);
}

/* Theme toggle button */
#theme-toggle {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1000;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 5px;
  font-size: 1.5em;
  color: var(--text-color);
}

/* Adjust for dark mode */
[data-theme="dark"] #active_card_barcode {
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
}

/* Preserve background for store logos with transparency */
#active_card_logo img,
#card_list_wrapper ul li a img {
  background-color: white;
  border-radius: 5px;
  padding: 3px;
}

[data-theme="dark"] #active_card_logo img,
[data-theme="dark"] #card_list_wrapper ul li a img {
  background-color: white;
}

#filter-container {
  position: sticky; /* Change from fixed to sticky */
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  padding: 10px 20px;
  background-color: var(--background-color);
  border-top: 1px solid var(--card-border);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
  z-index: 100;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  box-sizing: border-box;
}

#card-filter {
  flex-grow: 1;
  height: 34px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background-color: var(--background-color);
  color: var(--text-color);
  padding: 0 10px;
  margin-right: 8px;
  font-size: 14px;
}

#clear-filter {
  width: 34px;
  height: 34px;
  padding: 0;
  background-color: var(--card-background);
  color: var(--text-color);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

#clear-filter .fa {
  font-size: 16px;
}

#clear-filter:hover {
  background-color: var(--card-border);
}

/* Add hidden class for cards that don't match the filter */
.hidden-card {
  display: none !important;
}

/* Dark mode adjustments for filter */
[data-theme="dark"] #filter-container {
  background-color: var(--background-color);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

/* Modal styles for barcode display */
.barcode-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-content {
  background-color: white;
  margin: auto;
  padding: 15px;
  border-radius: 10px;
  width: 90%;
  max-width: 95%;
  max-height: 95%;
  position: relative;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.close-modal {
  position: absolute;
  top: 10px;
  right: 15px;
  color: #333;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
}

.modal-image-container {
  width: 100%;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-barcode-img {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  object-fit: contain;
  background-color: white;
}

.modal-barcode-img.barcode {
  max-width: 85%;
}

.modal-barcode-img.qrcode {
  max-width: 80%;
}

.modal-instructions {
  margin-top: 15px;
  color: #333;
  font-size: 14px;
}

/* Rotate content for wide barcodes */
.rotate-content .modal-image-container {
  transform: rotate(90deg);
  width: 70vh;
  height: 70vw;
  max-height: 70vh;
}

.rotate-content .modal-barcode-img.barcode {
  max-width: none;
  max-height: none;
  width: auto;
  height: 50vh;
}

/* Dark theme adjustments */
[data-theme="dark"] .modal-content {
  background-color: #1e1e1e;
}

[data-theme="dark"] .close-modal {
  color: #e1e1e1;
}

[data-theme="dark"] .modal-instructions {
  color: #e1e1e1;
}

/* Ensure barcode background stays white even in dark mode */
[data-theme="dark"] .modal-image-container {
  background-color: white;
}

[data-theme="dark"] .modal-barcode-img {
  background-color: white;
}

/* Header Controls (Dark Mode Toggle and Logout) */
.header-controls {
  position: fixed;
  top: 10px;
  z-index: 1000;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Right side controls (dark mode) */
.header-controls-right {
  right: 10px;
}

/* Left side controls (logout) */
.header-controls-left {
  left: 10px;
}

/* Theme toggle button */
#theme-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 5px;
  font-size: 1.5em;
  color: var(--text-color);
  margin: 0;
}

/* Logout button styling */
#logout-button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 5px;
  font-size: 1.5em;
  color: var(--text-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

#logout-button:hover, #theme-toggle:hover {
  opacity: 0.7;
}

#logout-button i {
  font-size: 1.3em;
}

/* Mobile keyboard adjustment */
@media screen and (max-width: 768px) {
  .container {
    padding-bottom: 50px; /* Reduced padding for mobile */
  }
  
  /* Adjust when virtual keyboard is likely active */
  .keyboard-open .container {
    padding-bottom: 10px;
  }
  
  .keyboard-open #card_list_wrapper {
    margin-bottom: 10px;
  }
}
