/* -------------------- Base Styles & Fonts -------------------- */
/* #region */

@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #d32f2f;
    --primary-color-dark: #a01818;
    --background-color-light: #f4f7f9;
    --surface-color-light: #fff;
    --text-color-light: #333;
    --text-color-medium: #666;
    --border-color-light: #e0e0e0;
    --shadow-color-light: rgba(0, 0, 0, 0.05);

    --background-color-dark: #121212;
    --surface-color-dark: #1e1e1e;
    --text-color-dark: #e0e0e0;
    --text-color-medium-dark: #b0b0b0;
    --border-color-dark: #333;
    --shadow-color-dark: rgba(255, 255, 255, 0.05);

    --primary-red: #d32f2f;
    --dark-red: #a01818;
    --medium-grey: #666;
    --light-grey: #f0f0f0;
}
body {
    font-family: 'Kanit', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color-light);
    color: var(--text-color-light);
    transition: background-color 0.5s ease, color 0.5s ease;
}
.dashboard-container {
    display: flex;
    min-height: 100vh;
}
body.dark-mode {
    background-color: var(--background-color-dark);
    color: var(--text-color-dark);
}
body.dark-mode .main-header,
body.dark-mode .sidebar,
body.dark-mode .control-box,
body.dark-mode .price-data-section,
body.dark-mode .table-container {
    background-color: var(--surface-color-dark);
    box-shadow: 0 5px 20px var(--shadow-color-dark);
}
body.dark-mode .menu-item a {
    color: var(--text-color-medium-dark);
}
body.dark-mode .sidebar-brand span,
body.dark-mode .main-header .user-profile span {
    color: var(--text-color-dark);
}
body.dark-mode .menu-item a:hover {
    background-color: #2e2e2e;
}
body.dark-mode h2,
body.dark-mode h3 {
    color: var(--text-color-dark);
}
body.dark-mode .section-header h2 {
    border-left-color: var(--primary-color);
}
body.dark-mode .table-container table th {
    background-color: #2e2e2e;
    color: var(--text-color-medium-dark);
}
body.dark-mode .price-table tr:nth-child(even) {
    background-color: #252525;
}
body.dark-mode input,
body.dark-mode select {
    background-color: #2e2e2e;
    color: var(--text-color-dark);
    border-color: #444;
}
body.dark-mode input:focus,
body.dark-mode select:focus {
    outline-color: var(--primary-color);
}
/* #endregion */
/* -------------------------------------------------------------- */

/* -------------------- Sidebar Styles -------------------- */
/* #region */

.sidebar {
    width: 250px;
    background-color: #fff;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.05);
    transition: width 0.3s ease-in-out;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}
.sidebar.collapsed {
    width: 80px;
}
.sidebar-header {
    display: flex;
    align-items: center;
    padding: 20px;
    justify-content: space-between;
}
.sidebar.collapsed .sidebar-header {
    justify-content: center;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.6em;
    font-weight: 700;
    color: var(--dark-grey);
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.3s ease;
}
.sidebar.collapsed .sidebar-brand {
    opacity: 0;
}
.sidebar-brand span {
    transition: opacity 0.3s ease;
}
.sidebar-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}
.sidebar-toggle-btn {
    font-size: 1.3em;
    cursor: pointer;
    color: var(--medium-grey);
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}
.sidebar-toggle-btn:hover {
    background-color: var(--light-grey);
}
.sidebar.collapsed .sidebar-toggle-btn {
    margin-right: -10px;
}
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}
.menu-item {
    padding: 0 10px;
    margin: 5px 0;
}
.menu-item a {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    padding: 15px 15px;
    color: var(--medium-grey);
    transition: all 0.3s ease;
    border-radius: 10px;
}
.menu-item a:hover {
    background-color: var(--light-grey);
    color: var(--primary-red);
}
.menu-item.active a {
    background: linear-gradient(to right, #e75c5c, #d32f2f);
    color: #fff;
    box-shadow: 0 5px 20px rgba(211, 47, 47, 0.2);
}
.menu-item i {
    font-size: 1.2em;
    width: 25px;
    text-align: center;
}
.menu-item a .menu-text {
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.3s ease;
}
.sidebar.collapsed .menu-item a .menu-text {
    display: none;
}

/* #endregion */
/* -------------------------------------------------------------- */

/* -------------------- Main Content Styles (Improved) -------------------- */
/* #region */

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    /* margin-left: 250px;  */
}
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background-color: var(--surface-color-light);
    box-shadow: 0 2px 5px var(--shadow-color-light);
    transition: background-color 0.5s ease;
}
.page-title {
    margin: 0;
    font-size: 2em;
    font-weight: 700;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
}
.user-profile i {
    font-size: 1.5em;
}
.theme-toggle {
    cursor: pointer;
    font-size: 1.5em;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}
.theme-toggle:hover {
    transform: scale(1.1);
}
.toggle-icon {
    transition: all 0.5s ease;
}

/* all section */
.content-area {
    padding: 40px;
    flex-grow: 1;
    background-color: white;
}
.section-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.section-header h2 {
    font-size: 1.5em;
    font-weight: 600;
    color: var(--text-color-light);
    border-left: 4px solid var(--primary-color);
    padding-left: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.page-section {
    display: none;
}
.page-section.active {
    display: block;
}

/* #endregion */
/* -------------------------------------------------------------- */


/* -------------------- Dashboard details -------------------- */
/* #region */

.card-grid {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 40px;
}
.info-card-box {
    width: 100%;
    height: 100%;
}
.info-card {
    background-color: #fff;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 5px;
    border-left: 5px solid var(--primary-red);
    flex-direction: column;
    justify-content: space-between;
}
.info-card-title {
    display: flex;
    flex-direction: column;
    gap: 3px;

}
body.dark-mode .info-card {
    background-color: var(--surface-color-dark);
    box-shadow: 0 5px 20px var(--shadow-color-dark);
}
.card-icon {
    font-size: 2.5em;
    color: var(--primary-red);
}
.card-details {
    display: flex;
    flex-direction: column;
}
.card-title {
    font-size: 0.9em;
    color: var(--medium-grey);
}
body.dark-mode .card-title {
    color: var(--text-color-medium-dark);
}
.card-value {
    font-size: 2em;
    font-weight: 700;
    color: var(--dark-red);
}
body.dark-mode .card-value {
    color: var(--text-color-dark);
}


/* chart */
.db-info-customer {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

.db-info-customer-item1 {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    width: 70%;
    margin: 20px auto;
    font-family: 'Arial', sans-serif;
    color: #333;
}
.db-chart-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chart-col {
  display: flex;
  flex-direction: row;
  gap: 20px;
}

.chart-box {
  flex: 1;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.info-box-chart h6 {
  font-size: 14px;
  margin-bottom: 12px;
  color: #444;
  text-align: center;
}



.db-info-customer-item2 {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    width: 30%;
    margin: 20px auto;
    font-family: 'Arial', sans-serif;
    color: #333;
}
.db-info-customer-item2 .card-header h3 {
    text-align: center;
    font-size: 20px;
    margin-bottom: 20px;
    color: #b30000;
}

/* List */
.province-top-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.province-top-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 10px;
    font-size: 16px;
    background: linear-gradient(90deg, #ffe5e5 0%, #fff 100%);
    transition: transform 0.2s, box-shadow 0.2s;
}

/* Hover effect */
.province-top-list li:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Rank badge */
.province-top-list li .rank {
    display: inline-block;
    width: 50px;
    text-align: center;
    font-weight: bold;
    font-size: 18px;
}

/* Count badge */
.province-top-list li .count {
    background: #b30000;
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 14px;
}

/* Top 3 style */
.province-top-list li:nth-child(1) {
    background: linear-gradient(90deg, #ffd700 0%, #fffacd 100%);
    color: #000;
}
.province-top-list li:nth-child(1) .rank::before { content: "🥇 "; }

.province-top-list li:nth-child(2) {
    background: linear-gradient(90deg, #c0c0c0 0%, #f0f0f0 100%);
    color: #000;
}
.province-top-list li:nth-child(2) .rank::before { content: "🥈 "; }

.province-top-list li:nth-child(3) {
    background: linear-gradient(90deg, #b87333 0%, #f5deb3 100%);
    color: #fff;
}
.province-top-list li:nth-child(3) .rank::before { content: "🥉 "; }




/* #endregion */
/* -------------------------------------------------------------- */



/* -------------------- Discount Cards -------------------- */
/* #region */

.coupon-box {
    max-width: 76vw;

}

body.dark-mode .discount-card {
    background-color: var(--surface-color-dark);
    box-shadow: 0 5px 20px var(--shadow-color-dark);
}
.discount-header {
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
}
.discount-code {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--dark-red);
}
.discount-value {
    font-size: 1.1em;
    font-weight: 600;
    color: #fff;
    background-color: var(--primary-red);
    padding: 5px 10px;
    border-radius: 8px;
}
.discount-description {
    font-size: 0.9em;
    color: var(--medium-grey);
    margin: 0;
}
body.dark-mode .discount-description {
    color: var(--text-color-medium-dark);
}
.discount-stats {
    display: flex;
    flex-direction: column;
    margin-top: 15px;
    gap: 8px;
    border-top: 1px dashed var(--border-color-light);
    padding-top: 10px;
}
body.dark-mode .discount-stats {
    border-top-color: var(--border-color-dark);
}
.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: var(--medium-grey);
}
body.dark-mode .stat-item {
    color: var(--text-color-medium-dark);
}
.stat-item i {
    color: var(--primary-red);
}


.coupon-creation-box {
    background-color: #f7f9fc;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px;
    margin-top: 30px;
}
.coupon-form-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.coupon-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}
.form-group {
    display: flex;
    flex-direction: column;
}
.form-group label {
    font-weight: bold;
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
}
.form-group input,
.form-group select {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}
.form-group input:focus,
.form-group select:focus {
    border-color: #007bff;
    outline: none;
}
.create-btn {
    grid-column: 1 / -1;
    padding: 12px 25px;
    background-color: #24d80d;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.create-btn:hover {
    background-color: #218838;
}
.cancel-btn {
    grid-column: 1 / -1;
    padding: 12px 25px;
    background-color: #ff0000;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.cancel-btn:hover {
    background-color: #882121;
}
.status-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    font-weight: bold;
    display: none;
}
.status-message.success {
    background-color: #d4edda;
    color: #155724;
}
.status-message.error {
    background-color: #f8d7da;
    color: #721c24;
}
.button-group-container {
    margin-top: 20px;
    text-align: center;
}
.button-group {
    display: flex;
    justify-content: center;
    gap: 15px;
}
.action-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
}
.action-btn:hover {
    transform: translateY(-2px);
}
.action-btn i {
    margin-right: 8px;
}
.action-btn.download-btn {
    background-color: #3498db;
    color: white;
}
.action-btn.download-btn:hover {
    background-color: #2980b9;
}
.action-btn.reset-btn {
    background-color: #e74c3c;
    color: white;
}
.action-btn.reset-btn:hover {
    background-color: #c0392b;
}
.action-btn.save-btn {
    background-color: #2ecc71;
    color: white;
}
.action-btn.save-btn:hover {
    background-color: #27ae60;
}
.discount-card .card-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.edit-coupon-btn,
.delete-coupon-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease, transform 0.1s ease;
}
.edit-coupon-btn {
    background-color: #ffc107;
    /* Warning yellow */
    color: #333;
}
.edit-coupon-btn:hover {
    background-color: #e0a800;
}
.delete-coupon-btn {
    background-color: #dc3545;
    /* Danger red */
    color: white;
}
.delete-coupon-btn:hover {
    background-color: #c82333;
}
.edit-coupon-btn i,
.delete-coupon-btn i {
    margin-right: 5px;
}


/* --- Coupon Search Bar --- */
.coupon-search-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 10px;
    background-color: var(--surface-color-light);
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}
body.dark-mode .coupon-search-container {
    background-color: var(--surface-color-dark);
    box-shadow: 0 2px 5px var(--shadow-color-dark);
}
.coupon-search-container input[type="text"] {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color-light);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}
body.dark-mode .coupon-search-container input[type="text"] {
    border-color: var(--border-color-dark);
}
.coupon-search-container input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 2px rgba(218, 110, 15, 0.3);
}
#clearCouponSearchBtn {
    background-color: var(--medium-grey);
    color: white;
    padding: 10px 15px;
    height: 44px;
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
#clearCouponSearchBtn:hover {
    background-color: var(--dark-red);
}
#clearCouponSearchBtn i {
    margin-right: 0;
}




.coupon-content-area {
    width: 100%;
    overflow-x: hidden; 
    box-sizing: border-box;
}
.coupon-card-grid-wrapper {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 20px; 
    -webkit-overflow-scrolling: touch; 
    scrollbar-width: thin;
    scrollbar-color: var(--primary-red) transparent;
    cursor: grab; 
    scroll-snap-type: x mandatory;
}
.coupon-card-grid-wrapper::-webkit-scrollbar {
    height: 8px;
}
.coupon-card-grid-wrapper::-webkit-scrollbar-track {
    background: transparent; 
}
.coupon-card-grid-wrapper::-webkit-scrollbar-thumb {
    background-color: var(--primary-red); 
    border-radius: 4px; 
}
.coupon-card-grid-wrapper::-webkit-scrollbar-thumb:hover {
    background-color: #c0392b; 
}

.coupon-card-grid {
    display: inline-flex; 
    gap: 20px;
    padding: 10px 0; 
    flex-shrink: 0;
}
.discount-card {
    flex: 0 0 auto;
    width: 300px; 
    background-color: #fff;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    border-top: 5px solid var(--primary-red);
}
body.dark-mode .discount-card {
    background-color: var(--surface-color-dark);
    box-shadow: 0 5px 20px var(--shadow-color-dark);
}
.discount-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.discount-code {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--dark-red);
}
/* #endregion */

/* -------------------------------------------------------------- */



/* -------------------- Control Boxes -------------------- */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.control-box {
    background-color: var(--surface-color-light);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px var(--shadow-color-light);
    transition: background-color 0.5s ease;
}

body.dark-mode .control-box {
    background-color: var(--surface-color-dark);
    box-shadow: 0 10px 30px var(--shadow-color-dark);
}

.control-box h3 {
    font-size: 1.2em;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-color-medium);
}

body.dark-mode .control-group label {
    color: var(--text-color-medium-dark);
}

.control-box select,
.control-box input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color-light);
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 1em;
    color: var(--text-color-light);
    transition: all 0.3s ease;
}

body.dark-mode .control-box select,
body.dark-mode .control-box input {
    background-color: var(--surface-color-dark);
    color: var(--text-color-dark);
    border-color: var(--border-color-dark);
}

.control-box input:focus,
.control-box select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.2);
}

.input-with-select {
    display: flex;
    gap: 5px;
}

.input-with-select select {
    width: auto;
    flex-shrink: 0;
}

.control-box button {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    background-color: var(--primary-color);
    color: #fff;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.control-box button:hover {
    background-color: var(--primary-color-dark);
    transform: translateY(-2px);
}

.control-box button i {
    margin-right: 8px;
}

.hidden-scope {
    display: none;
}





/* -------------------- Tables (Improved) -------------------- */
.price-data-section {
    background-color: var(--surface-color-light);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px var(--shadow-color-light);
    overflow-x: auto;
    transition: background-color 0.5s ease;
}

body.dark-mode .price-data-section {
    background-color: var(--surface-color-dark);
    box-shadow: 0 10px 30px var(--shadow-color-dark);
}

.table-container {
    border-radius: 10px;
    overflow: hidden;
}

.price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1em;
    text-align: left;
}

.price-table th,
.price-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color-light);
    white-space: nowrap;
}

body.dark-mode .price-table th,
body.dark-mode .price-table td {
    border-color: var(--border-color-dark);
}

.price-table th {
    background-color: var(--background-color-light);
    font-weight: 600;
    color: var(--text-color-medium);
}

body.dark-mode .price-table th {
    background-color: #2e2e2e;
    color: var(--text-color-medium-dark);
}

.price-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

body.dark-mode .price-table tbody tr:nth-child(even) {
    background-color: #252525;
}

.price-table tbody tr:hover {
    background-color: var(--primary-color);
    color: #fff;
}
.price-table tbody tr:hover td {
    color: #fff;
    transition: color 0.3s ease;
}
.price-table tbody tr:hover th {
    color: #fff;
    transition: color 0.3s ease;
}
.price-table input {
    width: 100px;
    text-align: right;
    border: 1px solid var(--border-color-light);
    border-radius: 5px;
    padding: 8px;
}
body.dark-mode .price-table input {
    background-color: var(--surface-color-dark);
    color: var(--text-color-dark);
    border-color: var(--border-color-dark);
}
.price-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}
.btn-group button {
    padding: 10px 15px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease;
}
#savePriceBtn {
    background-color: #28a745;
    color: #fff;
}
#savePriceBtn:hover {
    background-color: #218838;
}
#downloadJsonBtn {
    background-color: #007bff;
    color: #fff;
}
#downloadJsonBtn:hover {
    background-color: #0069d9;
}
#resetDataBtn {
    background-color: #ffc107;
    color: #333;
}
#resetDataBtn:hover {
    background-color: #e0a800;
}
.status-badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: bold;
    color: white;
    white-space: nowrap;
}
.status-badge.pending {
    background-color: #ffc107;
    color: #333;
}
.status-badge.completed {
    background-color: #28a745;
}





/* -------------------- Product ADD EDIT DELETE (Improved & Modernized) -------------------- */
:root {
   
    --background-light: #f8f9fa;
    --card-bg: #ffffff;
    --border-color: #e9ecef;
    --text-dark: #343a40;
    --text-muted: #6c757d;
    --font-family: 'Sarabun', sans-serif;
}


.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.section-header h2 {
    font-size: 2.5rem;
    color: var(--text-dark);
    font-weight: 700;
}

.section-header h2 i {
    margin-right: 15px;
    color: var(--primary-color);
}

.db-product-container {
    display: grid;
    gap: 30px;
}

.db-product-select {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.db-product-select-box {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    width: 100%;
}

.db-product-select-box > div {
    flex: 1 1 45%;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    text-align: center;
    border: 1px solid var(--border-color);
}

.db-product-select-box > div:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1);
}

.db-product-select-box h4 {
    margin: 0;
    font-size: 1.6rem;
    color: var(--primary-color);
    font-weight: 600;
}

.db-product-select-box h4 i {
    color: var(--danger-color);
    margin-right: 10px;
}

#product-table-section,
#product-form-section {
    display: none;
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.db-product-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.db-product-action h4 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin: 0;
}

.product-list-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
    margin-top: 20px;
}

.product-list-table th,
.product-list-table td {
    padding: 15px;
    text-align: left;
}

.product-list-table thead th {
    background-color: var(--background-light);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.product-list-table tbody tr {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-list-table tbody tr:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.product-list-table img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.product-list-table .action-buttons .btn {
    padding: 10px 15px;
    font-size: 0.9rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: none;
    font-weight: 600;
}

.product-list-table .action-buttons .btn-warning {
    background-color:rgb(255, 98, 0);
    color: #fff;
}

.product-list-table .action-buttons .btn-danger {
    background-color: red;
    color: #fff;
}

.product-list-table .action-buttons .btn-warning:hover,
.product-list-table .action-buttons .btn-danger:hover {
    transform: scale(1.05);
}

.product-form h4 {
    margin-bottom: 2rem;
    font-size: 1.8rem;
    color: var(--primary-color);
    font-weight: 600;
}

.product-form .form-group {
    margin-bottom: 1.8rem;
}

.product-form label {
    font-weight: 600;
    margin-bottom: 0.8rem;
    display: block;
    color: var(--text-dark);
}

.product-form input,
.product-form textarea,
.product-form select {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    background-color: var(--background-light);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.product-form input:focus,
.product-form textarea:focus,
.product-form select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(0, 123, 255, 0.3);
    outline: none;
}

.product-form .btn-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.product-form .btn {
    padding: 14px 30px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    border: none;
}

.product-form .btn-success {
    background-color: rgb(1, 176, 1);
    color: #fff;
}

.product-form .btn-secondary {
    background-color: red;
    color: #fff;
}

.product-form .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}

.db-action-buttons-group .btn {
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.db-action-buttons-group #downloadJsonProductBtn {
    background-color:rgb(0, 162, 255);
    color: #fff;
}

.db-action-buttons-group #resetProductDataBtn {
    background-color: red;
    color: #fff;
}








/* -------------------- Customer ADD EDIT DELETE -------------------- */
.db-customer-container {
    display: grid;
    gap: 30px;
}

.db-customer-select {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.db-customer-select-box {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    width: 100%;
}

.db-customer-select-box > div {
    flex: 1 1 45%;
    background-color: var(--background-light);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    text-align: center;
    border: 1px solid var(--border-color);
}

.db-customer-select-box > div:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1);
}

.db-customer-select-box h4 {
    margin: 0;
    font-size: 1.6rem;
    color: var(--primary-color);
    font-weight: 600;
}

.db-customer-select-box h4 i {
    color: var(--danger-color);
    margin-right: 10px;
}

#customer-table-section,
#customer-form-section {
    display: none;
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.db-customer-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.db-customer-action h4 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin: 0;
}

.customer-list-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
    margin-top: 20px;
}

.customer-list-table th,
.customer-list-table td {
    padding: 15px;
    text-align: left;
}

.customer-list-table thead th {
    background-color: var(--background-light);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    cursor: pointer;
}

.customer-list-table thead th:hover {
    color: var(--primary-color);
}

.customer-list-table tbody tr {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.customer-list-table tbody tr:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.customer-list-table .action-buttons .btn {
    padding: 10px 15px;
    font-size: 0.9rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: none;
    font-weight: 600;
}

.customer-list-table .action-buttons .btn-warning {
    background-color: orange;
    color: #fff;
}

.customer-list-table .action-buttons .btn-danger {
    background-color: red;
    color: #fff;
}

.customer-list-table .action-buttons .btn-warning:hover,
.customer-list-table .action-buttons .btn-danger:hover {
    transform: scale(1.05);
}

.customer-list-table .action-buttons .btn-status {
    background-color: rgb(6, 194, 6);
    color: #fff;
    margin-right: 5px;
}
.customer-list-table .action-buttons .btn-status:hover {
    background-color: #007bff;
}

#customerStatus {
    margin-top: 10px;
}

.customer-form h4 {
    margin-bottom: 2rem;
    font-size: 1.8rem;
    color: var(--primary-color);
    font-weight: 600;
}

.customer-form .form-group {
    margin-bottom: 1.8rem;
}

.customer-form label {
    font-weight: 600;
    margin-bottom: 0.8rem;
    display: block;
    color: var(--text-dark);
}

.customer-form input,
.customer-form textarea,
.customer-form select {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    background-color: var(--background-light);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.customer-form input:focus,
.customer-form textarea:focus,
.customer-form select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(0, 123, 255, 0.3);
    outline: none;
}

.customer-form .btn-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.customer-form .btn {
    padding: 14px 30px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    border: none;
}

.customer-form .btn-success {
    background-color: rgb(1, 176, 1);
    color: #fff;
}

.customer-form .btn-secondary {
    background-color: red;
    color: #fff;
}

.customer-form .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}

.sort-container {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between label and select dropdown */
    margin-right: 15px; /* Add some space to the right of the container */
}

#sortCustomer {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 14px;
    background-color: #fff;
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#sortCustomer:hover {
    border-color: #007bff;
}

#sortCustomer:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.25);
}
.db-action-buttons-group #downloadJsonCustomerBtn {
    background-color:rgb(0, 162, 255);
    color: #fff;
}

.db-action-buttons-group #resetCustomerDataBtn {
    background-color: red;
    color: #fff;
}
/* Styling for Search and Sort Container */
.db-action-buttons-group.action-search-filter {
    /* ใช้ Flexbox เพื่อจัดวาง Search และ Sort ให้อยู่ในแถวเดียวกัน */
    display: flex;
    justify-content: flex-start; /* จัดเรียงจากซ้าย */
    align-items: center;
    gap: 20px; /* ระยะห่างระหว่างช่องค้นหากับช่องเรียงลำดับ */
    margin-bottom: 15px;
    flex-wrap: wrap; /* ให้ขึ้นบรรทัดใหม่เมื่อหน้าจอแคบ */
}

/* Styling for Search Container */
.search-container {
    display: flex;
    align-items: center;
    flex-grow: 1; /* ให้ช่องค้นหาขยายตัวได้มากกว่าช่องเรียงลำดับ */
    max-width: 400px; /* จำกัดความกว้างสูงสุดของช่องค้นหา */
    min-width: 250px;
}

.search-container label {
    margin-right: 10px;
    font-weight: 600;
    color: #555;
    white-space: nowrap; /* ป้องกันไม่ให้ข้อความ "ค้นหา:" ขึ้นบรรทัดใหม่ */
}

.search-container i.fas {
    margin-right: 5px;
    color: #ad1807ce; /* สีเดียวกับปุ่มหลัก */
}

.search-container input[type="text"] {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    flex-grow: 1;
    width: 100%;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s ease-in-out;
}

.search-container input[type="text"]:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Styling for Sort Container */
.sort-container {
    display: flex;
    align-items: center;
}

.sort-container label {
    margin-right: 10px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.sort-container select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: #fff;
    cursor: pointer;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    /* ซ่อนลูกศร default ในบางเบราว์เซอร์ */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* เพิ่มลูกศร custom (ถ้าจำเป็นต้องใช้ CSS เท่านั้น) */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23000%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-24.8%200L146.2%20185.6%2030.3%2069.4a17.6%2017.6%200%200%200-24.8%2024.8l130.4%20130.5a17.6%2017.6%200%200%200%2024.8%200l130.5-130.5c6.5-6.4%206.5-16.9%200-23.3z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
    padding-right: 30px; /* เผื่อที่สำหรับลูกศร custom */
}

/* Styling for General Action Buttons Group (เช่น ปุ่มดาวน์โหลด) */
.db-action-buttons-group.action-buttons-export {
    display: flex;
    justify-content: flex-end; /* จัดเรียงไปทางขวาของหน้าจอ (ถ้าคุณต้องการให้อยู่ขวา) */
    /* หรือใช้ justify-content: flex-start; ถ้าต้องการให้อยู่ซ้าย */
    gap: 10px; /* ระยะห่างระหว่างปุ่มแต่ละปุ่ม */
    margin-bottom: 15px; /* ระยะห่างจากด้านล่าง */
    flex-wrap: wrap; /* เพื่อให้ขึ้นบรรทัดใหม่เมื่อหน้าจอแคบ */
}

/* Styling for the buttons (สมมติว่าใช้ Bootstrap หรือคล้ายกัน) */
.db-action-buttons-group .btn {
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s ease;
}

/* ปรับสีตามความเหมาะสม (ตัวอย่างใช้สีมาตรฐาน) */
/* ปุ่ม Excel (Primary/Success) */
#downloadExcelCustomerBtn.btn-primary {
    background-color: #007bff; /* สีน้ำเงิน */
    color: white;
}
#downloadExcelCustomerBtn.btn-primary:hover {
    background-color: #0056b3;
}

/* ปุ่ม JSON (Info/Secondary) */
#downloadJsonCustomerBtn.btn-info {
    background-color: #17a2b8; /* สีฟ้า */
    color: white;
}
#downloadJsonCustomerBtn.btn-info:hover {
    background-color: #117a8b;
}

/* ปุ่ม Reset (Warning) */
#resetCustomerDataBtn.btn-warning {
    background-color: #ffc107; /* สีเหลือง */
    color: #343a40; /* ตัวอักษรสีเข้ม */
}
#resetCustomerDataBtn.btn-warning:hover {
    background-color: #e0a800;
}

/* ไอคอนในปุ่ม */
.db-action-buttons-group .btn i.fas {
    margin-right: 5px;
}

/* ==================================== */
/* CUSTOMER PAGINATION STYLES (ปรับปรุงใหม่ให้ดูดีขึ้น) */
/* ==================================== */

/* กำหนดขนาดฟอนต์เริ่มต้นสำหรับ Bootstrap Pagination */
.pagination {
    --bs-pagination-font-size: 0.9rem;
    margin: 1.5rem 0; /* เว้นระยะห่างด้านบนและล่าง */
    display: flex;
}

/* ปรับสไตล์ลิงก์ (ปุ่ม) แต่ละอันใน Pagination */
.pagination .page-link {
    padding: 0.5rem 0.8rem; /* เพิ่ม Padding ให้อ่านและกดง่ายขึ้น */
    border-radius: 8px; /* ใช้ขอบมนให้เข้ากับสไตล์การ์ดของคุณ */
    margin: 0 3px; /* เพิ่มช่องว่างระหว่างปุ่ม */
    border: 1px solid var(--border-color, #ddd); /* ใช้ตัวแปรสีของคุณ หรือ default */
    color: var(--text-dark, #333); 
    background-color: var(--card-bg, #fff); 
    transition: all 0.2s ease-in-out;
    font-weight: 500;
}

.pagination .page-item a:not(.active):hover {
    background-color: var(--background-light, #f8f9fa); 
    border-color: var(--primary-color, #007bff);
    color: var(--primary-color, #007bff);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color, #007bff); /* ใช้สีหลักของระบบคุณ */
    border-color: var(--primary-color, #007bff);
    color: #fff; /* ตัวอักษรสีขาว */
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
    pointer-events: none; /* ไม่ให้คลิกหน้าเดิมซ้ำ */
    z-index: 2; /* ทำให้ปุ่ม Active อยู่ด้านบน */
}

.pagination .page-item:first-child .page-link,
.pagination .page-item:last-child .page-link {
    font-weight: 600;
    letter-spacing: 0.5px;
}


.pagination .page-item.disabled .page-link,
.pagination .page-item.disabled span {
    color: var(--text-muted, #6c757d); /* สีตัวอักษรจางลง */
    background-color: var(--background-light, #fff);
    border-color: #eee;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* จัดการจุดไข่ปลา (...) */
.pagination .page-item.disabled span.page-link {
    background-color: transparent !important;
    border: none !important;
    cursor: default;
}

/* สไตล์สำหรับ nav container โดยรวม */
nav[aria-label="Customer Page navigation"] {
    padding-bottom: 1rem;
}