/* ======================================================= */
/* OrderManagement.css - Updated with Header and Footer Styles */
/* ======================================================= */

/* CSS Variables - Same as Customerdashboard */
:root {
  --primary-color: #004d40;
  --secondary-color: #17422f;
  --accent-color: #66bb6a;
  --highlight-color: #72F7BD;
  --text-light: #fff;
  --text-dark: #333;
  --bg-light: #f0f0f0;
  --border-light: #ccc;
  --header-height: 65px;

  /* Original Order Management Variables */
  --background: hsl(210, 40%, 98%);
  --foreground: hsl(222.2, 47.4%, 11.2%);
  --card: hsl(0, 0%, 100%);
  --card-foreground: hsl(222.2, 47.4%, 11.2%);
  --primary: hsl(217.2, 91.2%, 59.8%);
  --primary-foreground: hsl(0, 0%, 100%);
  --secondary: hsl(210, 40%, 96.1%);
  --secondary-foreground: hsl(217.2, 91.2%, 40%);
  --muted-foreground: hsl(215.4, 16.3%, 46.9%);
  --destructive: hsl(0, 84.2%, 60.2%);
  --destructive-foreground: hsl(0, 0%, 100%);
  --success: hsl(142.1, 76.2%, 36.3%);
  --success-foreground: hsl(0, 0%, 100%);
  --border: hsl(214.3, 31.8%, 91.4%);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
  line-height: 1.6;
  overflow-x: hidden;
  padding-top: var(--header-height);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ======================================================= */
/* HEADER STYLES - Same as Customerdashboard */
/* ======================================================= */

/* Shopping Cart Badge Styles */
.cart-link {
  position: relative;
  display: inline-block;
}

.cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: #ff4444;
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.cart-badge.hidden {
  display: none;
}

.cart-page-link {
  transition: transform 0.2s ease;
}

.cart-page-link:hover {
  transform: scale(1.1);
}

/* Diamond Icon Styling - WHITE COLOR */
.diamond-link {
  position: relative;
  transition: color 0.3s, transform 0.3s;
}

.diamond-link:hover {
  color: var(--accent-color);
  transform: scale(1.1);
}

/* Diamond icon is now white */
.diamond-link .fa-diamond {
  color: var(--text-light);
}

.diamond-link:hover .fa-diamond {
  animation: sparkle 0.6s ease-in-out;
  color: var(--accent-color);
}

@keyframes sparkle {
  0% { transform: scale(1); }
  50% { transform: scale(1.2) rotate(15deg); }
  100% { transform: scale(1); }
}

/* Main Header Styles */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 50px;
  background-color: var(--primary-color);
  color: var(--text-light);
  position: fixed;
  width: 100%;
  box-sizing: border-box;
  z-index: 1000;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
}

.logo-container { 
  display: flex; 
  align-items: center; 
  gap: 5px; 
  color: var(--text-light); 
  font-weight: 700; 
}

.logo-circle { 
  width: 45px; 
  height: 45px; 
  background-color: var(--primary-color); 
  border-radius: 50%; 
  display: flex; 
  justify-content: center; 
  align-items: center; 
  overflow: hidden; 
}

.logo-circle img { 
  max-width: 80%; 
  height: auto; 
  border-radius: 50%; 
}

.logo-text { 
  display: flex; 
  flex-direction: column; 
  justify-content: center; 
}

.logo-main { 
  font-size: 24px; 
  line-height: 1; 
  margin-bottom: -4px; 
}

.logo-sub { 
  font-size: 16px; 
  line-height: 1; 
}

nav { 
  display: flex; 
  flex-grow: 1; 
  justify-content: flex-end; 
  align-items: center; 
  padding: 0; 
  margin: 0 40px 0 0; 
  position: relative; 
  z-index: 1000; 
}

nav ul { 
  list-style: none; 
  display: flex; 
  margin: 0; 
  padding: 0; 
}

nav ul li { 
  margin: 0 15px; 
  font-size: 14px; 
  font-weight: 500; 
}

nav a:hover { 
  text-decoration: underline; 
}

.header-actions { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
}

.search-bar { 
  display: flex; 
  align-items: center; 
  border: 1px solid var(--border-light); 
  border-radius: 5px; 
  overflow: hidden; 
  background-color: var(--text-light); 
  margin: 0 20px; 
}

.search-bar input { 
  border: none; 
  padding: 8px 10px; 
  outline: none; 
  width: 200px; 
  font-size: 14px; 
  color: var(--text-dark); 
}

.search-bar button { 
  background-color: var(--bg-light); 
  border: none; 
  padding: 8px 10px; 
  cursor: pointer; 
  color: var(--text-dark); 
}

.search-bar button:hover { 
  background-color: #ddd; 
}

.icon-links { 
  display: flex; 
  align-items: center; 
  gap: 25px; 
  font-size: 18px; 
  color: var(--text-light); 
  position: relative;
}

.icon-links a { 
  transition: color 0.3s; 
}

.icon-links a:hover { 
  color: var(--accent-color); 
}

/* ======================================================= */
/* MAIN CONTENT STYLES */
/* ======================================================= */

main {
  padding: 2rem 0;
  flex: 1;
}

section {
  margin-bottom: 3rem;
}

.section-header {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.section-badge {
  padding: 0.75rem 2rem;
  border-radius: 9999px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  font-weight: bold;
  font-size: 1.25rem;
}

.section-badge.completed {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.section-badge.cancelled {
  background-color: var(--destructive);
  color: var(--destructive-foreground);
}

/* ====== CENTERED ORDERS CONTAINER ====== */
.orders-container {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 0 1rem;
}

.orders-grid {
  display: grid;
  gap: 1.5rem; /* more space between cards to avoid visual overlap */
  grid-template-columns: 1fr;
  max-width: 1080px; /* fits 3 x 320px cards + gaps comfortably */
}

@media (min-width: 768px) {
  .orders-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .orders-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Card - COMPACT VERSION */
.card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  overflow: visible;
  transition: all 0.3s ease;
  max-width: 320px; /* wider to give badges/text breathing room */
  width: 100%;
  margin: 0 auto;
  position: relative;
}}

.card:hover {
  box-shadow: 0 4px 8px -2px rgba(0, 0, 0, 0.1);
}

.card-content {
  padding: 1rem 0.75rem 0.75rem 0.75rem;
  padding-top: 2rem;
}

/* Close/Remove Order Button */
.close-order-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 32px;
  height: 32px;
  background-color: rgba(220, 38, 38, 0.95);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 20;
  padding: 0;
  line-height: 1;
}

.close-order-btn:hover {
  background-color: rgba(220, 38, 38, 1);
  transform: scale(1.1);
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.4);
}

.close-order-btn:active {
  transform: scale(0.95);
}

/* Fade out animation */
@keyframes fadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

/* Order Card Header */
.order-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.order-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--card-foreground);
  margin-bottom: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-info p {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.4rem;
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid transparent;
}

.badge.success {
  background-color: var(--success);
  color: var(--success-foreground);
}

.badge.destructive {
  background-color: var(--destructive);
  color: var(--destructive-foreground);
}

/* Order Items */
.order-items {
  background-color: hsla(210, 40%, 96.1%, 0.3);
  padding: 0.5rem;
  border-radius: 0.3rem;
  margin-bottom: 0.5rem;
}

.order-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.order-item:last-child {
  border-bottom: none;
}

.item-details h4 {
  font-weight: 500;
  color: var(--card-foreground);
  margin-bottom: 0.1rem;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.item-details p {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin: 0;
}

.item-price {
  font-weight: 600;
  color: var(--card-foreground);
  font-size: 0.85rem;
}

/* Total Section */
.order-total {
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

.total-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
}

.total-row.grand-total {
  font-size: 0.9rem;
  font-weight: bold;
  margin-top: 0.25rem;
}

/* Rating (Diamonds) */
.rating-section {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.rating-section h4 {
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--primary-color);
  font-size: 0.95rem;
}

.stars { display: flex; gap: 0.4rem; margin-bottom: 0.25rem; }
.star { cursor: pointer; transition: transform 0.15s ease; color: #9aa5a5; font-size: 1.2rem; }
.star i { pointer-events: none; }
.star:hover { transform: scale(1.1); }
.star.filled { color: var(--primary-color); }

.rating-label { color: #4f5d56; font-weight: 600; }

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.375rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn.btn-primary {
  background-color: var(--primary-color);
  color: #fff;
}

.btn.btn-primary:hover {
  background-color: #0f7b5f;
}

/* Stronger styles for modal submit button */
.modal .btn.btn-primary { background-color: var(--primary-color); color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.2); }
.modal .btn.btn-primary:hover { background-color: #0f7b5f; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Cancelled Order Card */
.cancelled-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.cancelled-info-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.cancelled-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background-color: hsla(210, 40%, 96.1%, 0.5);
  border-radius: 0.375rem;
}

.cancelled-item-img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  background-color: white;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  padding: 4px;
  flex-shrink: 0;
}

.cancelled-item-details {
  flex: 1;
  min-width: 0;
}

.cancelled-item-details h4 {
  font-weight: 600;
  color: var(--card-foreground);
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  word-break: break-word;
  line-height: 1.3;
}

.item-attributes {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.item-attributes p {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin: 0;
}

.cancelled-item-price {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-color);
  white-space: nowrap;
  align-self: center;
}

/* Review Button */
.review-btn {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.5rem;
  font-size: 0.85rem;
  text-align: center;
  border-radius: 0.3rem;
  font-weight: 500;
}

/* ======================================================= */
/* REVIEW MODAL STYLES */
/* ======================================================= */

.modal {
  display: block; /* visible when not hidden */
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal.hidden {
  display: none;
}

.modal-content {
  background-color: #fefefe;
  margin: 5% auto;
  padding: 0;
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  padding: 1.5rem;
  background-color: var(--primary-color); /* dark green */
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.5rem;
}

.close-modal {
  color: white;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.close-modal:hover {
  color: var(--accent-color);
}

.modal-body {
  padding: 1.5rem;
}

.order-summary {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.order-summary h4 {
  margin-bottom: 1rem;
  color: var(--card-foreground);
}

.items-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.items-preview .item-tag {
  background-color: var(--secondary);
  padding: 0.25rem 0.5rem;
  border-radius: 20px;
  font-size: 0.875rem;
  color: var(--secondary-foreground);
}

.rating-section {
  margin-bottom: 1.5rem;
}

.rating-label {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  min-height: 1.2em;
}

.review-form {
  margin-top: 1rem;
}

.review-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--card-foreground);
}

.review-form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: 'Roboto', sans-serif;
  font-size: 1rem;
  min-height: 100px;
  resize: vertical;
}

.modal-footer {
  padding: 0 1.5rem 1.5rem;
  text-align: right;
}

/* ======================================================= */
/* FOOTER STYLES - Same as Customerdashboard */
/* ======================================================= */

.main-footer { 
  width: 100%; 
  background-color: var(--secondary-color); 
  color: var(--text-light);
  margin: 0;
  padding: 0;
  margin-top: auto;
}

.footer-main-content { 
  display: flex; 
  justify-content: space-between; 
  padding: 40px 20px 20px 20px; 
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  flex-wrap: wrap;
}

.footer-col { 
  flex: 1; 
  padding: 0 15px; 
  min-width: 200px; 
  box-sizing: border-box;
  margin-bottom: 20px;
}

.footer-col h3 { 
  font-size: 18px; 
  border-bottom: 1px solid var(--accent-color); 
  padding-bottom: 8px; 
  margin-bottom: 20px; 
  font-weight: 700; 
  color: var(--text-light); 
}

.footer-info { 
  max-width: 300px; 
}

.footer-info .logo-container { 
  margin-bottom: 20px; 
}

.footer-info .logo-container .logo-main { 
  font-size: 20px; 
}

.footer-info .logo-container .logo-sub { 
  font-size: 14px; 
}

.footer-info p { 
  font-size: 14px; 
  line-height: 1.6; 
  margin-top: 20px; 
  color: #ccc; 
}

.footer-links ul { 
  list-style: none; 
  padding: 0; 
  margin: 0; 
}

.footer-links ul li { 
  margin-bottom: 8px; 
}

.footer-links a { 
  font-size: 14px; 
  color: #e0e0e0; 
  transition: color 0.3s; 
}

.footer-links a:hover { 
  color: var(--accent-color); 
}

.footer-contact p { 
  font-size: 14px; 
  line-height: 1.8; 
  margin-bottom: 10px; 
  color: #ccc; 
}

.footer-contact i { 
  color: var(--accent-color); 
  margin-right: 10px; 
  width: 15px; 
  text-align: center; 
}

.footer-social { 
  text-align: left; 
}

.social-icons { 
  display: flex; 
  gap: 10px; 
  justify-content: flex-start; 
}

.social-icons a { 
  display: flex; 
  justify-content: center; 
  align-items: center; 
  width: 35px; 
  height: 35px; 
  border-radius: 50%; 
  background-color: var(--primary-color); 
  color: var(--text-light); 
  font-size: 16px; 
  transition: background-color 0.3s; 
}

.social-icons a:hover { 
  background-color: var(--accent-color); 
}

.footer-bottom-bar { 
  width: 100%; 
  background-color: var(--primary-color); 
  padding: 12px 20px; 
  text-align: center; 
  font-size: 12px; 
  margin: 0;
  box-sizing: border-box;
}

/* ======================================================= */
/* RESPONSIVE DESIGN */
/* ======================================================= */

@media (max-width: 1024px) {
  .main-header {
    flex-direction: column;
    padding: 15px;
    height: auto;
    position: relative;
  }
  
  body {
    padding-top: 0;
  }
  
  nav {
    margin: 10px 0;
    justify-content: center;
  }
  
  nav ul {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  nav ul li {
    margin: 5px 10px;
  }
  
  .header-actions {
    flex-direction: column;
    gap: 15px;
  }
  
  .search-bar {
    margin: 0;
    width: 100%;
  }
  
  .search-bar input {
    width: 100%;
  }
  
  .icon-links {
    width: 100%;
    justify-content: space-around;
  }
  
  .footer-main-content {
    flex-direction: column;
    text-align: center;
    padding: 30px 20px 20px 20px;
  }
  
  .footer-col {
    padding: 15px 0;
    min-width: auto;
  }
  
  .footer-social .social-icons {
    justify-content: center;
  }
  
  .footer-info .logo-container {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .orders-grid {
    grid-template-columns: 1fr;
  }
  
  .order-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .cancelled-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .modal-content {
    width: 95%;
    margin: 10% auto;
  }
}
/* ====== ITEM ATTRIBUTES STYLES ====== */
.item-attributes {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-top: 0.25rem;
}

.item-attributes p {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin: 0;
  line-height: 1.2;
}
/* ====== GREEN BACKGROUND FOR COMPLETED ORDERS HEADER ====== */
.section-badge.completed {
  background-color: var(--primary-color) !important; /* Header green color */
  color: var(--text-light) !important;
}

/* ====== GREEN BACKGROUND FOR ADD REVIEW BUTTON ====== */
.review-btn {
  background-color: var(--primary-color) !important; /* Header green color */
  color: var(--text-light) !important;
  border: none;
  font-weight: 500;
}

.review-btn:hover {
  background-color: #003d33 !important; /* Slightly darker green on hover */
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
/* Prevent layout shift when scrollbar appears/disappears */
html {
  overflow-y: scroll;
}

/* Ensure Cancelled Orders grid and cards are not visually cut (stack above neighbors) */
#cancelledOrders {
  position: relative;
  z-index: 101; /* above most content; below modals (2000) and header (1000) not needed when scrolled */
  overflow: visible;
}
#cancelledOrders .card {
  position: relative;
  z-index: 102;
  overflow: visible;
}
/* Make grid container not clip children */
.orders-container { overflow: visible; }
