/* Taustan muotoilu */
body {
  background-color: white;
  color: black;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  margin: 0;
  padding: 0;
}

.bar-container {
  /* display: flex; */
  height: 10%;
  width: 100%;
  background-color: white;
}

.bar-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 160px;
  background-color: #112855;
  font-size: 16px;
  color: white;
  border-bottom: 1px solid black;
  padding: 8px 12px;
  z-index: 1000;
  box-sizing: border-box;
  overflow: hidden;
}

.bar-top a {
  color: red;
}

.bar-top p {
  margin: 4px 0;
  line-height: 1.4;
}

.company-logo {
  position: absolute;
  right: 12px;
  top: 12px;
  max-height: 80px;
}

.search-container {
  display: flex;
  gap: 8px;
  margin: 8px 0;
  max-width: 500px;
}

#searchInput {
  flex: 1;
  padding: 8px 12px;
  font-size: 14px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s ease;
}

#searchInput:focus {
  border-color: #c41e3a;
}

.search-btn {
  padding: 8px 24px;
  background: linear-gradient(135deg, #c41e3a 0%, #a01828 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(196, 30, 58, 0.3);
}

.search-btn:hover {
  background: linear-gradient(135deg, #a01828 0%, #801320 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(196, 30, 58, 0.4);
}

.search-btn:active {
  transform: translateY(0);
}

.flex-bars {
    display: flex;
    gap: 16px;
    margin-top: 170px; /* Space for fixed header */
    margin-left: auto;
    margin-right: auto;
    max-width: 1800px; /* Limit total width to center the layout */
    padding: 16px;
    min-height: calc(100vh - 190px); /* Full height minus header */
    align-items: flex-start;
}

/* menu */
.flex-bar-1 {
    flex: 0 0 auto;
    width: 320px;
    padding: 8px;
}

/* tuotteet (center column) */
.flex-bar-2 {
    flex: 1 1 auto;
    padding: 8px;
    min-width: 0; /* Allows flex item to shrink below content size */
}

/* ostoskori */
.flex-bar-3 {
    flex: 0 0 auto;
    width: 520px;
    padding: 8px;
    border: 1px solid black;
}

.tuoteikkuna {
  background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  width: 100%;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
  overflow: hidden;
  hyphens: none;
  -webkit-hyphens: none;
  -ms-hyphens: none;
  word-wrap: break-word;
  overflow-wrap: break-word;
  transition: all 0.3s ease;
}

.tuoteikkuna:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
  border-color: #c41e3a;
}

.tuoteikkuna table {
  width: 100%;
}

.tuoteikkuna table td {
  padding: 8px 12px;
  vertical-align: top;
}

.tuoteikkuna table td b {
  color: #2c3e50;
  font-weight: 600;
  font-size: 13px;
}

.tuoteikkuna table img {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.tuoteikkuna table img:hover {
  transform: scale(1.05);
  cursor: pointer;
}

.tuoteikkuna button {
  padding: 10px 20px;
  background: linear-gradient(135deg, #c41e3a 0%, #a01828 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(196, 30, 58, 0.3);
}

.tuoteikkuna button:hover {
  background: linear-gradient(135deg, #a01828 0%, #801320 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(196, 30, 58, 0.4);
}

.tuoteikkuna button:active {
  transform: translateY(0);
}

.tuoteikkuna .quantity-btn {
  padding: 6px 12px;
  font-size: 16px;
  font-weight: bold;
  min-width: 36px;
  background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
}

.tuoteikkuna .quantity-btn:hover {
  background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
}

.tuoteikkuna input[type="text"] {
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  padding: 8px;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.tuoteikkuna input[type="text"]:focus {
  outline: none;
  border-color: #c41e3a;
}

#productlist {
  background-color: white;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: calc(100vh - 180px);
  padding: 16px;
}

#cart {
  color: black;
  background-color: white;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: calc(100vh - 180px); /* Prevent overflow beyond viewport */
}

#tuotekuvapopup {
  left: 10%;
  top: 10%;
  right: 10%;
  bottom: 10%;
  background-color: white;
  position: fixed;
  visibility: hidden;
  z-index: 9999;
  border: 1px solid black;
}

#tuotekuvapopupkuva {
  height: 100%;
  padding: 10px;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
  overflow: auto;
  background-color: rgba(0,0,0,0.6);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background-color: #fff;
  margin: 2% auto !important;
  padding: 0 !important;
  border: none;
  width: 90% !important;
  max-width: 1600px !important;
  min-width: 0 !important;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  max-height: 92vh;
  overflow: hidden;
  animation: slideIn 0.3s ease;
  box-sizing: border-box;
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-content h2 {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: white;
  margin: 0;
  padding: 20px 30px;
  font-size: 24px;
  border-radius: 12px 12px 0 0;
}

#orderHistoryContent {
  padding: 10px;
  max-height: calc(90vh - 80px);
  overflow-y: auto;
  box-sizing: border-box;
}

.close {
  color: white;
  float: right;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  transition: all 0.2s ease;
  opacity: 0.8;
}

.close:hover,
.close:focus {
  opacity: 1;
  transform: rotate(90deg);
}

.order-history-container {
  padding: 10px 0;
}

.order-date-group {
  margin-bottom: 35px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  overflow: hidden;
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-bottom: 2px solid #dee2e6;
}

.order-header h3 {
  margin: 0;
  color: #2c3e50;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-date-icon {
  font-size: 20px;
}

.order-total {
  color: #2c3e50;
  font-size: 16px;
  padding: 8px 16px;
  background-color: white;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

.order-total strong {
  color: #28a745;
  font-size: 18px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  background-color: white;
  font-size: 13px;
  table-layout: auto;
}

.history-table thead {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: white;
}

.history-table thead th {
  padding: 14px 12px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  border: none;
}

.history-table tbody td {
  padding: 12px;
  border: 1px solid #e9ecef;
  text-align: left;
}

.history-table tbody td code {
  background-color: #f8f9fa;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #495057;
  border: 1px solid #dee2e6;
}

.history-table tbody tr:nth-child(even) {
  background-color: #f8f9fa;
}

.history-table tbody tr:hover {
  background-color: #e3f2fd;
  transition: background-color 0.2s ease;
}

.history-table tfoot {
  background-color: #f8f9fa;
  border-top: 3px solid #2c3e50;
}

.history-table tfoot .total-row td {
  padding: 16px 12px;
  color: #2c3e50;
}

.reorder-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.reorder-btn:hover {
  background: linear-gradient(135deg, #218838 0%, #1aa179 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(40, 167, 69, 0.4);
}

.reorder-btn:active {
  transform: translateY(0);
}

.cart-icon {
  font-size: 14px;
}

/* Admin controls styling */
.admin-btn {
  padding: 6px 12px;
  background: linear-gradient(135deg, #ff8c00 0%, #ff6b00 100%);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(255, 140, 0, 0.3);
  margin-right: 6px;
}

.admin-btn:hover {
  background: linear-gradient(135deg, #ff6b00 0%, #ff4500 100%);
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(255, 140, 0, 0.4);
}

.admin-btn:active {
  transform: translateY(0);
}