/* style.css */
:root {
  --primary-color: #7a42f4; /* Deep Purple */
  --primary-dark: #5e35b1;
  --secondary-color: #ff9800; /* Amber */
  --secondary-dark: #fb8c00;
  --bg-light: #f4f7f9; /* Off-white for body background */
  --content-bg: #ffffff; /* White for main content wrapper */
  --text-dark: #333333;
  --text-grey: #666666;
  --border-color: #e0e0e0;
  --success-color: #4caf50;
  --success-bg: #e8f5e9;
  --error-color: #f44336;
  --white: #ffffff;
  --font-family: 'Roboto', sans-serif;
}

/* Base Styles */
body {
  background: var(--bg-light);
  font-family: var(--font-family);
  color: var(--text-dark);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Make main content flexible */
main {
  flex: 1 0 auto;
}

/* Header Styles */
header {
  background: var(--primary-color);
  /* Adjusted padding to make room for a larger logo */
  padding: 0.6rem 0 0.6rem; 
  text-align: center;
  color: var(--white);
  margin-bottom: 0; 
  position: relative;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* New: Styling for the logo container moved into the header */
.brand-logo.header-logo {
    position: relative;
    transform: none;
    left: auto;
    display: block;
    width: fit-content;
    margin: 0 auto;
    padding: 0;
    line-height: 1;
}

header h1 {
  /* Reduced header text size */
  font-size: 1.8rem;
  margin: 0.5rem 0 0.25rem;
  color: var(--white);
  font-weight: 700;
}

header p {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
}

header p a {
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.5);
  transition: border-bottom 0.2s ease;
}

header p a:hover {
    border-bottom: 1px solid var(--white);
}

.container {
  padding: 0 4px;
  width: 96%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Main Content Wrapper */
.main-content-wrapper {
    padding: 4px 0;
    margin-top: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    margin-bottom: 16px;
}


.container h4 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0.6rem 0 0.6rem;
  color: var(--primary-dark);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 10px;
}

/* Cooldown Notice (Keep existing styles for functionality) */
.cooldown-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  margin-bottom: 15px;
  background-color: #fff3e0;
  border-radius: 4px;
  color: #e65100;
  font-weight: 500;
  animation: pulseWarning 2s infinite;
}

.cooldown-notice i {
  color: #e65100;
}

@keyframes pulseWarning {
  0% { box-shadow: 0 0 0 0 rgba(230, 81, 0, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(230, 81, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(230, 81, 0, 0); }
}

/* Dynamic Timer Display in Payment Modal */
#cooldownContainer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
  margin-bottom: 15px;
  background-color: #ffecb3; 
  color: #f57f17; 
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  border: 1px solid #ffb300;
}

#cooldownMessage {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

#cooldownMessage i {
  font-size: 1.5rem;
}


/* Navigation */
.nav-wrapper {
  padding: 0 1rem;
  background-color: var(--primary-color);
}

.brand-logo {
	/* CLEANUP: Remove absolute positioning from generic brand-logo class */
	position: static;
	left: auto;
	transform: none;
	z-index: auto; 
}

.brand-logo img {
  vertical-align: middle;
  margin-right: 10px;
  /* Increased logo size */
  height: 100px; 
}

nav ul a {
  color: var(--white);
  transition: background-color 0.2s ease;
}

nav ul a:hover {
  background-color: var(--primary-dark);
}

/* Product Grid */
#product-grid {
  /* CHANGED: Reduced margin to 0.6em top/bottom for compactness */
  margin: 0.6em 0 !important;
}

.product-card {
  height: auto;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--white);
  border-radius: 10px; /* More rounded corners */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* Deeper shadow */
  margin-bottom: 15px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
  /* FIX: Ensure it is the positioning context for the badge */
  position: relative; 
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.card-content {
  padding: 12px !important; /* Increase padding */
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.diamond-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 10px;
}

.diamond-emoji {
  font-size: 2.2rem;
  margin-bottom: 4px;
}

.diamond-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-dark);
  text-align: center;
  line-height: 1.2;
}

.card-action {
  position: relative;
  padding: 10px 12px !important;
  border-top: 1px solid var(--border-color);
}

.price-container {
  margin: 5px 0;
  position: relative;
  /* FIX: Badge is now absolute to card, so we can reduce height */
  min-height: 40px; 
}

.discount-badge {
  /* TWEAK: Repositioned to top-right of .product-card */
  position: absolute;
  top: 2px; /* Tighter to the top */
  right: 2px; /* Tighter to the right */
  background: linear-gradient(45deg, var(--error-color), #d32f2f);
  color: var(--white);
  /* TWEAK: Increased border-radius for pill look */
  border-radius: 20px; 
  /* TWEAK: Increased font size and padding */
  padding: 3px 10px; 
  font-size: 0.8rem; 
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.price-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
}

.original-price {
  /* TWEAK: Make smaller */
  text-decoration: line-through;
  color: var(--text-grey);
  font-size: 0.8rem; 
  margin-bottom: 2px;
}

.discounted-price {
  /* TWEAK: Make bigger */
  font-size: 1.5rem; 
  font-weight: 700;
  color: var(--error-color);
}

.product-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.add-to-cart-btn, 
.buy-now-btn {
  flex: 1;
  min-width: 0;
  /* CHANGED: Reduced height from 38px to 36px */
  height: 36px;
  line-height: 36px;
  /* CHANGED: Reduced padding from 0 10px to 0 8px */
  padding: 0 8px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.add-to-cart-btn {
  background-color: var(--primary-color) !important;
}

.buy-now-btn {
  background-color: var(--secondary-color) !important;
}

.add-to-cart-btn:hover {
  background-color: var(--primary-dark) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.buy-now-btn:hover {
  background-color: var(--secondary-dark) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Cart Styles */
.fixed-cart {
  position: fixed;
  width: 320px;
  max-height: 70vh;
  overflow-y: auto;
  z-index: 998;
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  top: 120px;
  right: 20px;
}

.fixed-cart.hidden {
  transform: translateX(120%);
  opacity: 0;
  pointer-events: none;
}

.cart-section {
  padding: 15px;
}

.cart-section h6 {
  margin-top: 0;
  font-size: 1.3rem;
  color: var(--primary-dark);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.collection {
  border: none;
  margin: 0;
}

.collection-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-color);
  color: var(--text-dark);
  font-size: 0.95rem;
}

.collection-item:last-child {
    border-bottom: none;
}

#total-display {
    padding: 10px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--error-color);
    border-top: 1px solid var(--border-color);
    margin-top: 10px;
    display: block;
}

.remove-item-btn {
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--error-color) !important;
  transition: color 0.2s ease, transform 0.2s ease;
}

.remove-item-btn:hover {
    color: var(--error-color) !important;
    background-color: transparent !important;
    transform: scale(1.1);
}

/* Cart buttons styling for proper spacing/width */
.cart-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

.cart-buttons .btn {
  height: 38px;
  line-height: 38px;
  padding: 0 10px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 4px;
}

.cart-buttons .close-cart-btn {
  width: 25%;
  min-width: auto;
  padding: 0;
  flex: 0 0 auto;
}

.cart-buttons .clear-cart-btn {
  flex-basis: 35%;
  flex-grow: 0;
  white-space: nowrap;
}

.cart-buttons .modal-trigger {
  flex-basis: 40%;
  flex-grow: 1; /* Allow to expand if clear is missing */
}


/* Floating Cart Button Styles */
#floatingCartContainer {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 997;
  transition: all 0.3s ease;
}

#floatingCartBtn {
  background-color: var(--secondary-color) !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transform: scale(1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#floatingCartBtn:hover {
  background-color: var(--secondary-dark) !important;
  transform: scale(1.05);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

/* Badges */
.badge-cart {
  /* TWEAK: Set explicit size and shape for circular look */
  position: absolute;
  top: -10px; 
  right: -10px;
  min-width: 20px;
  height: 20px;
  line-height: 20px; /* Reset line-height */
  border-radius: 50%; /* Make it circular */
  
  /* FIX: Use Flexbox for guaranteed centering */
  display: flex;
  align-items: center; /* Vertical center */
  justify-content: center; /* Horizontal center */

  /* TWEAK: Increase font size */
  background: var(--error-color);
  color: var(--white);
  border: 2px solid var(--white);
  font-size: 13px;
  font-weight: 700;
}

/* Checkout Modal (FIXED) */
.modal {
  z-index: 1003;
  border-radius: 12px;
  overflow: hidden;
  /* 2. Adjusted max-height for desktop */
  max-height: 75vh; 
  /* FIX: Essential for persistent footer */
  display: flex; 
  flex-direction: column;
}

.modal[style*="display: block"], .modal[style*="display: block;"] {
  display: flex !important;
}

.modal .modal-content {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-footer {
  padding: 15px 20px;
  text-align: right;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  background-color: var(--bg-light);
  /* FIX: Ensure buttons are centered horizontally */
  display: flex;
  justify-content: center;
}

/* NEW FLEX PROPERTIES FOR MODAL FOOTER BUTTONS */
#detailsFooter button, 
#paymentFooter button, 
#confirmationFooter button{
    flex: 1 1 auto; /* Allow buttons to grow equally */
    max-width: 48%; /* Keep them from growing beyond half-width */
}
/* END NEW FLEX PROPERTIES */


.modal-content h5 {
    font-size: 1.8rem;
    color: var(--primary-dark);
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 20px;
}

.modal-content h6 {
    font-size: 1.2rem;
    color: var(--secondary-dark);
    border-left: 4px solid var(--secondary-color);
    padding-left: 10px;
    margin-top: 20px;
    margin-bottom: 15px;
    font-weight: 500;
}

/* Input Fields */
.input-field {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

/* 🚨 NEW: Hide Name input field */
.input-field:has(input#name) {
    display: none !important;
}

.input-field label {
  color: var(--text-grey);
}

.input-field input:focus + label {
  color: var(--primary-color) !important;
}

.input-field .active {
  color: var(--primary-color) !important;
}

/* Select element styling for dropdowns */
.browser-default {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--white);
  padding: 8px 10px;
  height: auto;
  display: block;
}

/* ID Verification */
.id-verification-container {
  margin-top: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Fixed User Info Card */
.userinfo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
  padding: 10px 15px;
  background: var(--success-bg);
  border-radius: 8px;
  border: 1px solid var(--success-color);
  color: var(--success-color);
  box-shadow: none; 
}

.userinfo img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--success-color);
  flex-shrink: 0;
}

.userinfo p {
  margin: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.userinfo p span:first-child {
    color: var(--text-dark);
    font-weight: 600;
    font-size: 1rem;
}

/* Payment Section */
.payment-method-content {
  display: none;
  padding: 15px;
  background: var(--white);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-top: 15px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* 1. Center QR Image */
#qrMethod {
  text-align: center;
}

.payment-method-content p {
    margin: 8px 0;
    font-size: 0.95rem;
}

.payment-label {
  color: var(--text-dark);
  min-width: 100px;
  display: inline-block;
}

.payment-value {
  color: var(--primary-dark);
}

.account-number-row {
    display: flex;
    align-items: center;
}

.copy-btn {
  cursor: pointer;
  color: var(--secondary-color);
  vertical-align: middle;
  margin-left: 8px;
  transition: color 0.2s ease, transform 0.2s ease;
}

.copy-btn:hover {
  color: var(--secondary-dark);
  transform: scale(1.1);
}

.customer-info-display {
  border: 1px dashed var(--primary-color);
  background: #f0f4ff;
  border-radius: 6px;
  padding: 15px;
}

.customer-info-display h6 {
    border-left: none;
    padding-left: 0;
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
}
.customer-info-display p {
    margin: 4px 0;
}
.customer-info-display strong {
    color: var(--primary-dark);
}

.payment-total-display {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  margin: 20px 0;
  padding: 10px;
  background: var(--primary-color);
  border-radius: 8px;
  color: var(--white);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tos-link {
    font-size: 0.9rem;
    color: var(--text-grey);
}

/* Receipt Upload */
.clickable-upload {
  border: 2px dashed var(--primary-color);
  border-radius: 10px;
  background-color: var(--content-bg);
  padding: 20px;
}

.upload-prompt i {
  color: var(--secondary-color);
}

.receipt-info {
  background-color: var(--success-bg);
  color: var(--success-color);
  border-top: none;
  font-weight: 500;
  border-radius: 0 0 8px 8px;
}

.receipt-preview-header {
    background-color: var(--bg-light);
}

/* 1. Constraint for uploaded image preview: max-height 128px */
.receipt-image-container img {
    max-width: 100%;
    /* ADDED: Max height constraint */
    max-height: 128px; 
    object-fit: contain; /* ADDED: Ensures image scales correctly within the max height */
    display: block;
    margin: 0 auto;
    border-radius: 4px;
}

/* Footer */
footer {
  background: var(--primary-dark); /* Darker footer */
  color: var(--white);
  padding: 20px 0;
  text-align: center;
  margin-top: auto;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}

/* Scroll Indicator (Desktop/General Styles) */
.scroll-indicator {
    position: absolute;
    bottom: 0; 
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(122, 66, 244, 0.9), transparent);
    color: var(--white);
    text-align: center;
    padding: 15px 10px 5px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10;
    display: none; 
    opacity: 1;
    transition: opacity 0.3s ease;
    
    /* FIX: Make clickable */
    pointer-events: auto;
    cursor: pointer;
}

/* Animation for the scrolling icon */
.scroll-indicator i {
    font-size: 2rem;
    animation: bounce 1.5s infinite;
    display: block; 
    margin: 0 auto 5px;
}

.scroll-indicator.hide {
    opacity: 0;
    pointer-events: none; 
}

/* Bounce Keyframes */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

/* --- NEW USER FEATURE STYLES --- */

/* Tab Styles (Matching primary-color) */
.user-tabs-container {
    margin-top: 20px;
    margin-bottom: 0 !important;
}

.tabs .tab a {
    color: var(--primary-color) !important; /* Text color for tabs */
    font-weight: 500;
}

.tabs .tab a:hover {
    color: var(--primary-dark) !important;
}

.tabs .indicator {
    background-color: var(--secondary-color); /* Indicator color */
    height: 3px;
}

.tabs .tab a.active {
    color: var(--primary-dark) !important;
    font-weight: 700;
}

/* Form Tab Container */
.user-form-tab {
    padding-top: 20px;
    background-color: var(--content-bg);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.user-form-tab .card-panel {
    box-shadow: none; /* Remove redundant shadow inside the main container */
    padding: 20px; /* Default padding for Login, Register, History, Profile */
    margin: 0;
}

/* 🚨 FIX: Override padding for the Topup tab's card-panel to allow the product grid to stretch wider */
#tab-topup .card-panel {
    /* Use 0 for horizontal padding, 0 for top padding (as h5 will handle margin), 20px bottom */
    padding: 0 0 20px 0 !important; 
}

/* 1. Base style for all card headers (Login, Register, History, Profile) */
.user-form-tab h5 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-top: 0;
    margin-bottom: 10px; 
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

/* 2. Style the H5 in the Topup tab with custom margin for top/left/right, maintaining all visual consistency */
#tab-topup h5 {
    /* Re-apply all visual styles */
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-dark);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    
    /* 🚨 USER REQUEST: 20px margin top, right, left */
    margin-top: 20px !important; 
    margin-left: 20px !important;
    margin-right: 20px !important;
    
    /* Keep bottom margin small for the line separator */
    margin-bottom: 10px;

    /* Remove padding override, as margin is now used for spacing */
    padding-left: 0 !important; 
    padding-right: 0 !important;
}

/* Profile Card Styling */
.profile-card h5 {
    /* Use the same style as the h4 in the topup section for consistency */
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-dark);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.profile-card h6 {
    font-size: 1.1rem;
    color: var(--secondary-dark);
    margin-top: 15px;
    margin-bottom: 10px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 5px;
    border-left: none; /* Override default h6 style */
    padding-left: 0; /* Override default h6 style */
}

.profile-card p {
    margin: 8px 0;
    font-size: 0.95rem;
}

.profile-card strong {
    color: var(--text-dark);
    display: inline-block;
    min-width: 120px;
}

/* Button Styling */
#loginBtn {
    width: 100%;
    margin-top: 20px;
}
#registerBtn {
    width: 100%;
    margin-top: 20px;
    background-color: var(--secondary-color) !important;
}
#registerBtn:hover {
    background-color: var(--secondary-dark) !important;
}

/* User Status Header Bar */
#userStatusDisplay {
    background: var(--primary-dark); /* Darker purple for contrast */
    padding: 8px 20px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    color: white;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    /* Ensure it respects the parent's full width */
    width: 100%; 
}

#userStatusDisplay strong {
    font-weight: 700;
    color: var(--secondary-color);
    margin-right: 5px;
}

/* Customize logout button to fit the smaller status bar */
#logoutBtn {
    height: 30px;
    line-height: 30px; 
    padding: 0 10px; 
    margin-left: 10px;
    display: flex;
    align-items: center;
}
#logoutBtn i {
    font-size: 16px;
    line-height: 30px;
}
#logoutBtn span {
    font-size: 14px;
}
/* --- END NEW USER FEATURE STYLES --- */

/* --- HISTORY SUMMARY CARDS --- */
.history-summary-grid {
    margin-top: 15px;
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
}

.summary-card {
    flex: 1 1 calc(50% - 5px); /* Two cards per row on mobile/tablet */
    min-width: 140px;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    color: var(--white);
    transition: transform 0.2s;
}

.summary-card:hover {
    transform: translateY(-2px);
}

.summary-card h6 {
    font-size: 0.9rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    border-left: none;
    padding-left: 0;
    margin-bottom: 5px;
}

.summary-card p {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-card p i {
    font-size: 1.8rem;
}

/* Specific Card Colors */
.card-total-orders { background: linear-gradient(135deg, #1e88e5, #0d47a1); } /* Blue */
.card-done-orders { background: linear-gradient(135deg, #66bb6a, var(--success-color)); } /* Green */
.card-failed-orders { background: linear-gradient(135deg, #ef5350, var(--error-color)); } /* Red */
.card-total-amount { background: linear-gradient(135deg, #ffb300, var(--secondary-dark)); } /* Amber */
.card-total-diamonds { background: linear-gradient(135deg, #7e57c2, var(--primary-dark)); } /* Purple */

/* Order History Table Status Badges */
.history-table .status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--white);
}

.history-table .status-badge.done,
.history-table .status-badge.✅ {
    background-color: var(--success-color);
}
.history-table .status-badge.failed,
.history-table .status-badge.❌ {
    background-color: var(--error-color);
}
.history-table .status-badge.created {
    background-color: #03a9f4; /* Cyan */
}
.history-table .status-badge.processing {
    background-color: #ff9800; /* Amber */
}

/* Mobile Friendly Table Styles */
@media screen and (max-width: 600px) {
	#announcementStrip {
        margin: 5px 0 10px 0; /* Reduced vertical margin on mobile */
        border-radius: 0; /* Full width edge to edge */
        box-shadow: none;
        padding: 8px 10px;
    }
    #announcementStrip p {
        font-size: 0.8rem;
    }
	
    .history-table {
        border: 1px solid var(--border-color);
        width: 100%;
        margin-top: 15px;
    }
    
    .history-table thead {
        display: none; /* Hide header row on mobile */
    }
    
    .history-table tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid var(--border-color);
        border-radius: 4px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }
    
    .history-table td {
        /* Display as blocks */
        display: block; 
        text-align: right !important;
        border-bottom: 1px solid #f5f5f5;
        padding: 8px 10px;
        position: relative;
    }
    
    .history-table td:before {
        /* Create pseudo-element for column label */
        content: attr(data-label);
        position: absolute;
        left: 10px;
        font-weight: 500;
        color: var(--text-grey);
    }
    
    .history-table td:last-child {
        border-bottom: none;
    }
    
    /* Filter Controls Mobile Styling */
    .filter-controls .input-field {
        margin-bottom: 10px;
    }
    
    /* Ensure buttons are stacked or fill width */
    .filter-controls .filter-buttons-container {
        padding: 0 0.75rem; /* Match Materialize row padding */
        margin-top: 10px;
    }
    .filter-controls .filter-buttons-container .row {
        gap: 8px;
        display: flex;
    }
    .filter-controls .filter-buttons-container .col {
        padding: 0 !important;
    }
    
    /* Filter Summary Cards */
    .history-summary-grid {
        gap: 8px;
        justify-content: center;
        margin: 10px 0;
    }
    .summary-card {
        flex: 1 1 calc(50% - 4px);
        min-width: calc(50% - 4px);
        padding: 10px;
    }
    .summary-card p {
        font-size: 1.3rem;
    }
    .summary-card p i {
        font-size: 1.5rem;
    }
}

/* Responsive Styles */
@media screen and (max-width: 600px) {
  /* NEW: Reset container padding to make space for flush-left menu icon */
  nav .container {
      padding: 0 !important;
  }
  
  /* 2. Navbar/Sidebar Layout Fixes */
  .nav-wrapper {
	  /* Ensure padding is sufficient for the left menu icon and balance the logo */
	  padding: 0 1rem 0 0.5rem; /* Reduced left padding for a flush appearance */
  }
  .brand-logo {
	  /* Ensure the logo is not too wide for the navbar on small screens
       and does not overlap the right content (desktop cart icon is still there) */
	  position: absolute;
	  left: 50%;
	  transform: translateX(-50%);
      max-width: calc(100% - 8rem); /* Limit width so it respects padding on both sides */
  }

  header h1 {
    /* Smaller text for better contrast with larger logo */
    font-size: 1.5rem;
  }
  .container h4 {
    font-size: 1.3rem;
  }

  .main-content-wrapper {
      margin-top: 0px;
      border-radius: 0;
      padding: 0px 0;
  }

  .fixed-cart {
    max-height: 50vh;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.25);
  }

  #floatingCartContainer {
    bottom: 10px;
    right: 10px;
  }

  /* 虫 PRODUCT GRID TWEAKS FOR 3 COLUMNS 虫 */
  #product-grid .col {
    width: 33.333%; /* CHANGED: 3 products per row */
    float: left;
    padding: 2px; /* Reduced external padding for compactness */
  }
  
  .product-card {
    min-height: 140px; /* Reduced min-height */
    margin-bottom: 0; /* Margin comes from .col padding for tighter control */
  }

  .card-content {
    padding: 8px !important; /* Reduced internal padding */
    /* Add padding to the top of the content so the badge doesn't overlap everything */
    padding-top: 15px !important; 
  }

  .diamond-emoji {
    font-size: 1.6rem; /* Smaller diamond icon */
    margin-bottom: 2px;
  }
  
  .diamond-amount {
    font-size: 1.1rem; /* Smaller diamond count text */
  }

  .original-price {
    /* TWEAK: Smaller font size */
    font-size: 0.65rem; 
  }

  .discounted-price {
    /* TWEAK: Bigger font size */
    font-size: 1.2rem; 
  }
  
  .discount-badge {
    /* TWEAK: Make smaller pill badge */
    position: absolute; 
    top: 2px; /* Tighter to the top */
    right: 2px; /* Tighter to the right */
    margin: 0;
    /* TWEAK: Increased font size and padding for visibility */
    padding: 2px 5px; 
    font-size: 0.75rem; 
    border-radius: 14px; /* Stronger pill shape */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    display: inline-block;
  }

  .card-action {
    padding: 6px !important; /* Reduced action padding */
  }
  
  .product-buttons {
    gap: 2px; /* Reduced gap between Add/Buy buttons */
  }

  .add-to-cart-btn,
  .buy-now-btn {
    font-size: 0.65rem; /* Smaller font size for button text */
    height: 28px; 
    line-height: 28px;
    padding: 0 2px; 
    border-radius: 14px;
    font-weight: 500;
  }
  /* 虫 END PRODUCT GRID TWEAKS 虫 */


  .modal {
    width: 95%;
    /* 2. Shorter modal max-height for mobile screens */
    max-height: 75vh;
  }
  
  .modal-content h5 {
    font-size: 1.5rem;
  }

  /* Adjust Modal Footer Content Alignment for small screens */
  .modal-footer {
    padding: 15px 10px; /* Reduced side padding */
  }

  #detailsFooter, 
  #paymentFooter {
    width: 100% !important; 
    max-width: 350px; 
  }
  /* END Modal Footer Content Alignment */
  
  /* Scroll indicator style for mobile */
  .scroll-indicator {
    position: absolute; /* Relative to modal-content which is the scrolling container */
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(122, 66, 244, 0.9), transparent);
    color: var(--white);
    text-align: center;
    padding: 15px 10px 5px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10;
    display: block; 
    
    /* FIX: Keep clickable */
    pointer-events: auto;
    cursor: pointer;
    
    opacity: 1;
    transition: opacity 0.3s ease;
  }
  
  /* The hide class manages visibility for both desktop/mobile via JS */
  .scroll-indicator.hide {
      opacity: 0;
      pointer-events: none;
  }

  @media only screen and (min-width: 993px) {
    .scroll-indicator:not(.hide) {
        display: block !important;
    }
  }
  
  .cart-buttons .close-cart-btn {
    flex-basis: 20%;
  }

  .cart-buttons .clear-cart-btn {
    flex-basis: 35%;
  }
  
  .cart-buttons .modal-trigger {
    flex-basis: 45%;
  }
  
  /* Responsive adjustment for small screens */
  #userStatusDisplay {
      padding: 5px 10px;
      font-size: 0.8rem;
  }
  #logoutBtn {
      height: 25px !important;
      line-height: 25px !important;
      margin-left: 5px !important;
  }
  #logoutBtn i {
      font-size: 14px !important;
  }
  #logoutBtn span {
      font-size: 12px !important;
  }
  
  /* Ensure only 3 tabs visible at a time */
  .user-tabs-container .tabs {
      display: flex;
  }
  /* Adjusted for 4 tabs on mobile */
  .user-tabs-container .tab {
      flex: 1 1 25%;
      width: auto;
  }
}

@media screen and (min-width: 601px) and (max-width: 992px) {
    #product-grid .col {
        width: 33.333%;
        float: left;
    }
}

/* --- TABS CENTERING FIX --- */
.centered-tabs-wrapper {
    /* Limit the max width of the tab bar for centering on desktop */
    max-width: 600px; /* Adjust this value as needed, 600px is a good balance for 4 tabs */
    margin: 0 auto; /* Center the container horizontally on desktop */
}

/* Ensure tabs still behave like a full-width block inside the centered wrapper */
.user-tabs-container .col.s12 {
    padding: 0; /* Remove column padding to ensure the tabs line up */
}

/* On mobile, remove the centering to use the full width */
@media screen and (max-width: 600px) {
    .centered-tabs-wrapper {
        max-width: none;
        margin: 0;
    }
}
/* --- END TABS CENTERING FIX --- */

/* --- ANNOUNCEMENT STRIP STYLES (NEW) --- */
#announcementStrip {
    /* Use a card-panel style for a contained look */
    padding: 10px 15px;
    margin-bottom: 15px; /* Space it out from the tabs */
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    
    /* Make the content centrally aligned and easy to read */
    display: flex;
    align-items: center;
    justify-content: center;
}

#announcementStrip p {
    font-size: 0.95rem;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Ensure the icon is clearly visible */
#announcementStrip i {
    color: var(--error-color); /* Use a strong color for the icon */
    font-size: 1.2rem;
    line-height: 1;
}



/* --- CUSTOM MODAL STYLES (NEW - Requirement 1) --- */

.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent black overlay */
    z-index: 1000; /* Above everything, including Materialize modals (default 999) */
    display: none; /* Controlled by JS */
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    /* Center the modal content using flexbox */
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-modal-overlay.active {
    opacity: 1;
}

.custom-modal-content {
    background-color: var(--white); /* White background */
    margin: 40px auto; /* Centered with top margin */
    padding: 24px;
    border-radius: 8px; /* Rounded corners */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); /* Shadow */
    width: 90%;
    max-width: 450px; /* Set a max width */
    transform: translateY(-50px);
    transition: transform 0.3s ease;
}

.custom-modal-overlay.active .custom-modal-content {
    transform: translateY(0);
}

/* Specific Loading Spinner Style */
.spinner-purple {
    border-color: var(--primary-color);
}
.spinner-purple .circle-clipper .circle {
    border-color: var(--primary-color);
}
.spinner-purple .gap-patch .circle {
    border-color: var(--primary-color);
}

/* Order Summary Details in Success Modal (Requirement 2) */
#orderSummaryDetails p {
    margin: 5px 0;
    font-size: 1rem;
    color: var(--text-dark);
    display: flex;
    justify-content: space-between;
}

#orderSummaryDetails strong {
    font-weight: 500;
    min-width: 120px;
    display: inline-block;
}

/* Ensure Copy button looks correct inside the list item */
#copyOrderCodeBtn {
    height: 24px;
    line-height: 24px;
    padding: 0 5px;
    font-size: 0.8rem;
    margin-top: 0;
}
#copyOrderCodeBtn i {
    font-size: 1rem;
    margin-right: 5px;
}
/* Ensure the button doesn't affect the spacing of the whole line too much */
#orderSummaryDetails p:first-child .purple-text {
    flex-shrink: 0;
}

/* --- END CUSTOM MODAL STYLES --- */

#labelConfName, 
#labelConfMangoId, 
#labelConfContactMethod, 
#labelConfContactDetails, 
#labelConfTotalDiamonds, 
#labelConfTotalPrice, 
#confReceiptTitle {
    font-weight: 800 !important;
}