/* ==========================================================================
   ThaiSelling - Orange & White Theme Design System
   ========================================================================== */

/* 1. CSS Variables & Reset */
:root {
    --primary: #f27424;          /* Vibrant Warm Orange */
    --primary-dark: #d95c14;     /* Darker Warm Orange */
    --primary-light: #fff4ee;    /* Soft Warm Peach Tint */
    --primary-gradient: linear-gradient(135deg, #f27424, #1f2937);
    --accent: #f59e0b;           /* Amber/Yellow for Stars & Highlights */
    --accent-red: #ef4444;       /* Hot red for Flash Sale / Mall Tag */
    --accent-green: #10b981;     /* Green for positive stats / success */
    --white: #ffffff;
    --bg-light: #f8fafc;
    --text-dark: #0f172a;        /* Deep slate text */
    --text-muted: #64748b;       /* Muted slate text */
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --font-heading: 'Kanit', sans-serif;
    --font-body: 'Sarabun', sans-serif;
    --font-mono: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    font-family: var(--font-body);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-dark);
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* 2. Global Utilities */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-family: var(--font-heading);
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--white);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-secondary:hover {
    background-color: var(--primary-light);
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-dark);
}

.btn-outline:hover {
    background-color: var(--border);
}

.btn-danger {
    background-color: var(--accent-red);
    color: var(--white);
}

.btn-danger:hover {
    background-color: #dc2626;
    transform: translateY(-2px);
}

.btn-success {
    background-color: var(--accent-green);
    color: var(--white);
}

.btn-success:hover {
    background-color: #059669;
    transform: translateY(-2px);
}

/* 3. Header & Navigation */
.app-header {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    font-family: var(--font-heading);
}

.logo-accent {
    color: var(--text-dark);
    font-weight: 800;
}

.logo-text {
    color: #000000;
}

.brand-t {
    color: var(--accent-red);
}

.logo-icon {
    font-size: 28px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.header-search {
    flex-grow: 1;
    max-width: 600px;
}

.search-input-wrapper {
    display: flex;
    background-color: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: var(--transition);
}

.search-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.header-search input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 10px 15px;
    outline: none;
    color: var(--text-dark);
}

.search-btn {
    background-color: var(--primary);
    border: none;
    color: var(--white);
    padding: 0 20px;
    cursor: pointer;
    transition: var(--transition);
}

.search-btn:hover {
    background-color: var(--primary-dark);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.cart-icon-wrapper {
    position: relative;
    font-size: 22px;
    color: var(--text-muted);
    padding: 5px;
}

.cart-icon-wrapper:hover {
    color: var(--primary);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--accent-red);
    color: var(--white);
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
    font-family: var(--font-mono);
}

.user-menu-wrapper {
    position: relative;
}

.user-profile-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.user-profile-trigger:hover {
    background-color: var(--primary-light);
    border-color: var(--primary);
}

.user-avatar-placeholder {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.user-name-text {
    font-size: 14px;
    font-weight: 500;
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    width: 240px;
    padding: 10px;
    display: none;
    flex-direction: column;
    z-index: 1100;
    animation: slideDown 0.2s ease-out;
}

.user-profile-trigger.show-menu .user-dropdown-menu {
    display: flex;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-header-info {
    padding: 10px 12px;
}

.user-phone {
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 15px;
}

.user-role-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 500;
    margin-top: 5px;
}

.role-buyer { background-color: #f1f5f9; color: var(--text-muted); }
.role-merchant { background-color: var(--primary-light); color: var(--primary); }
.role-admin { background-color: #fef3c7; color: #b45309; }

.dropdown-divider {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 8px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 14px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.dropdown-item:hover {
    background-color: var(--bg-light);
    color: var(--primary);
}

.highlight-item {
    font-weight: 500;
    color: var(--primary);
}

.highlight-item:hover {
    background-color: var(--primary-light);
}

.danger-item {
    color: var(--accent-red);
}

.danger-item:hover {
    background-color: #fef2f2;
    color: var(--accent-red);
}

.login-btn-link {
    background-color: var(--primary);
    color: var(--white);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-btn-link:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

/* 4. App Main Layout */
.app-main-content {
    flex-grow: 1;
    padding: 30px 0;
}

/* 5. Homepage Zones (Shopee-like Layout) */

/* Hero Banner Zone */
.hero-zone {
    margin-bottom: 30px;
}

.banner-carousel {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    height: 320px;
    box-shadow: var(--shadow-md);
    background: var(--primary-gradient);
}

.banner-slide {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 40px 60px;
    color: var(--white);
}

.banner-content {
    max-width: 50%;
}

.banner-tag {
    background-color: var(--accent-red);
    color: var(--white);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 15px;
    font-family: var(--font-heading);
}

.banner-content h2 {
    font-size: 36px;
    line-height: 1.2;
    margin-bottom: 15px;
    color: var(--white);
}

.banner-content p {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 25px;
}

.banner-img-container {
    max-width: 40%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-img-container img {
    max-height: 90%;
    object-fit: contain;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.3));
}

/* Category grid zone */
.zone-section {
    background-color: var(--white);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.zone-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--bg-light);
    padding-bottom: 12px;
}

.zone-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    color: var(--text-dark);
}

.zone-title i {
    color: var(--primary);
    font-size: 24px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    max-height: 299px;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    margin-top: 2px;
    padding-top: 5px;
}

.category-grid.expanded {
    max-height: 2000px;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-align: center;
    transition: var(--transition);
}

.category-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.category-card-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 12px;
    transition: var(--transition);
}

.category-card:hover .category-card-icon {
    background-color: var(--primary);
    color: var(--white);
}

.category-card span {
    font-weight: 500;
    font-size: 15px;
}

.category-card small {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 4px;
}

/* Flash Sale Zone */
.flash-header {
    background-color: var(--primary);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    padding: 16px 24px;
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -24px -24px 24px -24px;
    flex-wrap: wrap;
    gap: 12px;
}

.flash-title {
    display: flex;
    align-items: center;
    gap: 15px;
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: bold;
    color: var(--white);
    flex-wrap: wrap;
}

.flash-title i {
    color: var(--accent);
    animation: flash 1s infinite alternate;
}

@keyframes flash {
    from { opacity: 0.5; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1.1); }
}

.flash-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.timer-box {
    background-color: var(--white);
    color: var(--primary-dark);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 16px;
    min-width: 32px;
    text-align: center;
}

.timer-colon {
    font-weight: bold;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.product-grid-scroll {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding-bottom: 5px;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.product-grid-scroll::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.product-grid-scroll .product-card {
    flex: 1 1 calc(25% - 15px);
    min-width: 220px;
}

/* Product Card Component */
.product-card {
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: var(--transition);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.product-badge-discount {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--accent-red);
    color: var(--white);
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 4px;
    z-index: 10;
}

.product-badge-mall {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, var(--primary), #06b6d4);
    color: var(--white);
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 4px;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(26, 86, 219, 0.3);
}

.product-img-wrapper {
    height: 180px;
    background-color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    position: relative;
    overflow: hidden;
}

.product-img-wrapper img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    transition: var(--transition);
}

.product-card:hover .product-img-wrapper img {
    transform: scale(1.08);
}

.product-details-box {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-name-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    height: 44px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: var(--text-dark);
}

.product-shop-name {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 10px;
}

.product-shop-name i {
    font-size: 10px;
}

.product-pricing {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: auto;
    margin-bottom: 10px;
}

.product-price-current {
    color: var(--primary);
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.product-price-original {
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: line-through;
    font-family: var(--font-mono);
}

.product-rating-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.stars-rating {
    color: var(--accent);
}

.sales-vol {
    font-family: var(--font-mono);
}

.flash-progress-wrapper {
    margin-top: 10px;
    position: relative;
}

.flash-progress-bar-bg {
    background-color: #fed7aa;
    height: 16px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.flash-progress-fill {
    background: linear-gradient(90deg, #f97316, var(--accent-red));
    height: 100%;
    border-radius: 10px;
    transition: var(--transition);
}

.flash-progress-text {
    position: absolute;
    width: 100%;
    text-align: center;
    font-size: 10px;
    font-weight: bold;
    color: var(--white);
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Mall shop grid zone */
.mall-shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.mall-shop-card {
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: var(--transition);
}

.mall-shop-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.mall-shop-logo-container {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-light);
}

.mall-shop-logo-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mall-shop-details {
    flex-grow: 1;
}

.mall-shop-name {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mall-shop-badge {
    background-color: var(--primary);
    color: var(--white);
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.mall-shop-desc {
    font-size: 12px;
    color: var(--text-muted);
    height: 36px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-top: 4px;
}

.mall-shop-btn {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}

/* 6. Product Detail Page (product.php) */
.product-detail-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 40px;
    background-color: var(--white);
    border-radius: var(--radius-md);
    padding: 30px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 30px;
}

.product-detail-image-box {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-light);
    border-radius: var(--radius-md);
    padding: 30px;
    height: 450px;
    border: 1px solid var(--border);
}

.product-detail-image-box img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.product-detail-info-box {
    display: flex;
    flex-direction: column;
}

.product-detail-title {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 12px;
}

.product-detail-meta-row {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
    border-bottom: 1px solid var(--bg-light);
    padding-bottom: 15px;
}

.meta-rating {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rating-score {
    color: var(--text-dark);
    font-weight: bold;
    font-family: var(--font-mono);
}

.meta-sales-count span {
    color: var(--text-dark);
    font-weight: bold;
    font-family: var(--font-mono);
}

.product-detail-price-box {
    background-color: var(--primary-light);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.detail-price-current {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    font-family: var(--font-mono);
}

.detail-price-original {
    font-size: 16px;
    color: var(--text-muted);
    text-decoration: line-through;
    font-family: var(--font-mono);
}

.detail-discount-percent {
    background-color: var(--accent-red);
    color: var(--white);
    font-size: 12px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
}

.product-detail-description {
    font-size: 15px;
    color: var(--text-dark);
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.product-detail-shop-box {
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: var(--bg-light);
    border-radius: var(--radius-sm);
    padding: 15px 20px;
    margin-bottom: 25px;
}

.detail-shop-logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--white);
}

.detail-shop-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-shop-info {
    flex-grow: 1;
}

.detail-shop-name {
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.product-detail-purchase-form {
    margin-top: auto;
}

.purchase-qty-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.qty-label {
    font-size: 14px;
    color: var(--text-muted);
}

.qty-selector-container {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.qty-btn {
    width: 36px;
    height: 36px;
    background-color: var(--white);
    border: none;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.qty-btn:hover {
    background-color: var(--bg-light);
}

.qty-input {
    width: 50px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    outline: none;
    font-family: var(--font-mono);
    font-weight: bold;
}

.qty-stock-label {
    font-size: 13px;
    color: var(--text-muted);
}

.purchase-actions-container {
    display: flex;
    gap: 15px;
}

.purchase-actions-container .btn {
    flex: 1;
    padding: 14px 24px;
    font-size: 16px;
}

/* Reviews List Section */
.reviews-section {
    background-color: var(--white);
    border-radius: var(--radius-md);
    padding: 30px;
    box-shadow: var(--shadow-sm);
}

.reviews-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--bg-light);
    padding-bottom: 15px;
}

.reviews-avg-box {
    display: flex;
    align-items: center;
    gap: 20px;
}

.reviews-avg-num {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary);
    font-family: var(--font-mono);
}

.reviews-avg-stars {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.review-item {
    border-bottom: 1px solid var(--bg-light);
    padding-bottom: 20px;
}

.review-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.review-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.reviewer-name {
    font-weight: 600;
    font-size: 14px;
}

.review-date {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.review-rating {
    color: var(--accent);
    margin-bottom: 8px;
}

.review-comment {
    font-size: 14px;
    color: var(--text-dark);
}

/* 7. Shopping Cart Page (cart.php) */
.cart-layout-grid {
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 30px;
}

.cart-items-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cart-shop-group {
    background-color: var(--white);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.cart-shop-header {
    background-color: var(--primary-light);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.cart-item-row {
    display: grid;
    grid-template-columns: 0.8fr 2fr 1fr 1fr 0.3fr;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--bg-light);
}

.cart-item-row:last-child {
    border-bottom: none;
}

.cart-item-img {
    width: 70px;
    height: 70px;
    background-color: var(--bg-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.cart-item-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cart-item-info h4 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
}

.cart-item-price {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 14px;
}

.cart-item-total {
    font-family: var(--font-mono);
    font-weight: bold;
    color: var(--primary);
    font-size: 16px;
}

.cart-delete-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
}

.cart-delete-btn:hover {
    color: var(--accent-red);
}

.cart-summary-panel {
    background-color: var(--white);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 25px;
    box-shadow: var(--shadow-sm);
    height: fit-content;
}

.summary-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--bg-light);
    padding-bottom: 10px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 12px;
}

.summary-row.total-row {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary);
    border-top: 1px solid var(--border);
    padding-top: 15px;
    margin-top: 15px;
    margin-bottom: 25px;
}

.summary-row span:last-child {
    font-family: var(--font-mono);
}

.checkout-btn {
    width: 100%;
    padding: 12px 24px;
    font-size: 16px;
}

/* Empty Cart View */
.empty-cart-view {
    text-align: center;
    background-color: var(--white);
    border-radius: var(--radius-md);
    padding: 60px 40px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.empty-cart-view i {
    font-size: 64px;
    color: var(--border);
    margin-bottom: 20px;
}

.empty-cart-view h2 {
    font-size: 22px;
    margin-bottom: 10px;
}

.empty-cart-view p {
    color: var(--text-muted);
    margin-bottom: 25px;
}

.empty-cart-view .btn-shop-now {
    padding: 9px 20px;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(242, 116, 36, 0.2);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.empty-cart-view .btn-shop-now i {
    font-size: 11px;
}

.empty-cart-view .btn-shop-now:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(242, 116, 36, 0.4);
    background-color: var(--primary-dark);
}

/* 8. Authentication (login.php) */
.auth-layout-container {
    max-width: 450px;
    margin: 40px auto;
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 35px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header i {
    font-size: 40px;
    color: var(--primary);
    margin-bottom: 12px;
}

.auth-header h2 {
    font-size: 24px;
    margin-bottom: 6px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 14px;
}

.form-control-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
}

.form-control-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.auth-submit-btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    margin-top: 10px;
}

/* OTP Simulation Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.otp-modal-box {
    background-color: var(--white);
    border-radius: var(--radius-md);
    padding: 30px;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: zoomIn 0.3s ease-out;
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.otp-modal-icon {
    font-size: 36px;
    color: var(--accent);
    margin-bottom: 15px;
}

.simulated-otp-display {
    background-color: var(--bg-light);
    border: 1px dashed var(--primary);
    padding: 10px;
    border-radius: var(--radius-sm);
    margin: 15px 0;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 4px;
    color: var(--primary);
    font-family: var(--font-mono);
}

/* 9. Checkout Page (checkout.php) */
.checkout-form-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 30px;
}

.checkout-card {
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 25px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 25px;
}

.checkout-card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--bg-light);
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkout-card-title i {
    color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* 10. Member Profile Page (profile.php) */
.profile-layout-grid {
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 30px;
}

.profile-sidebar {
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 25px;
    box-shadow: var(--shadow-sm);
    height: fit-content;
}

.profile-summary-header {
    text-align: center;
    margin-bottom: 25px;
}

.profile-avatar-large {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 12px auto;
}

.profile-summary-header h3 {
    font-size: 18px;
}

.profile-menu-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
}

.profile-menu-item:hover, .profile-menu-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
}

.profile-content-panel {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Tabs structure */
.tabs-navigation-row {
    display: flex;
    flex-wrap: wrap;
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

/* Generic tab button styles */
.tab-btn {
    padding: 14px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    font-family: var(--font-heading);
}

.tab-btn:hover {
    background-color: var(--bg-light);
}

.tab-btn.active {
    border-bottom-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* Specific horizontal tab styles for merchant dashboard tab bar */
.tabs-navigation-row .tab-btn {
    flex: 0 0 25%;
    max-width: 25%;
    padding: 14px 10px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-sizing: border-box;
    text-align: center;
    border-radius: 0;
}

.tabs-navigation-row .tab-btn:hover {
    background-color: var(--bg-light);
}

.tabs-navigation-row .tab-btn.active {
    background-color: var(--bg-light);
    color: var(--primary);
    box-shadow: inset 0 -3px 0 var(--primary);
    border-bottom-color: var(--border); /* maintain the grid border base line */
    font-weight: 600;
}

@media (min-width: 993px) {
    .tabs-navigation-row .tab-btn:nth-child(4n) {
        border-right: none;
    }
}

@media (max-width: 992px) {
    .tabs-navigation-row .tab-btn {
        flex: 0 0 50%;
        max-width: 50%;
    }
    .tabs-navigation-row .tab-btn:nth-child(2n) {
        border-right: none;
    }
}

@media (max-width: 576px) {
    .tabs-navigation-row .tab-btn {
        flex: 0 0 100%;
        max-width: 100%;
        border-right: none;
    }
}

.tab-panel-content {
    display: none;
}

.tab-panel-content.active {
    display: block;
}

/* Order card component */
.order-list-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.order-history-card {
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.order-history-card-header {
    background-color: var(--bg-light);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-meta-info {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

.order-id-txt {
    font-weight: 600;
    color: var(--text-dark);
}

.order-status-badge {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: bold;
}

.status-pending { background-color: #fef3c7; color: #d97706; }
.status-paid { background-color: #e0f2fe; color: #0284c7; }
.status-shipping { background-color: #fae8ff; color: #c084fc; }
.status-completed { background-color: #d1fae5; color: #059669; }
.status-cancelled { background-color: #fee2e2; color: #dc2626; }

.order-item-list-row {
    padding: 15px 20px;
    border-bottom: 1px solid var(--bg-light);
    display: grid;
    grid-template-columns: 1fr 5fr 2fr;
    align-items: center;
    gap: 15px;
}

.order-item-img {
    width: 50px;
    height: 50px;
    background-color: var(--bg-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
}

.order-item-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.order-item-name h5 {
    font-size: 14px;
    font-weight: 500;
}

.order-item-qty {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
}

.order-item-price-calc {
    text-align: right;
    font-family: var(--font-mono);
    font-size: 14px;
}

.order-history-card-footer {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-total-price-box {
    font-size: 14px;
}

.order-total-price-box span {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary);
    font-family: var(--font-mono);
}

/* Timeline status tracking */
.order-tracking-timeline-box {
    background-color: var(--bg-light);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin: 20px;
}

.timeline-title-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 13px;
}

.tracking-timeline-line {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin: 20px 0 10px 0;
}

.tracking-timeline-line::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 20px;
    right: 20px;
    height: 4px;
    background-color: var(--border);
    z-index: 1;
}

.timeline-step-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    width: 80px;
}

.node-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--white);
    border: 4px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-step-node.completed .node-dot {
    border-color: var(--primary);
    background-color: var(--primary);
}

.timeline-step-node.active .node-dot {
    border-color: var(--primary);
    background-color: var(--white);
}

.node-label-text {
    font-size: 11px;
    font-weight: 500;
    margin-top: 8px;
    text-align: center;
    color: var(--text-muted);
}

.timeline-step-node.completed .node-label-text,
.timeline-step-node.active .node-label-text {
    color: var(--primary);
    font-weight: bold;
}

/* 11. Merchant Portal Page (merchant.php) */
.merchant-dashboard-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.merchant-summary-card {
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 15px;
}

.summary-card-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.color-orange { background-color: var(--primary-light); color: var(--primary); }
.color-green { background-color: #d1fae5; color: var(--accent-green); }
.color-yellow { background-color: #fef3c7; color: var(--accent); }
.color-red { background-color: #fee2e2; color: var(--accent-red); }
.color-blue { background-color: #e0f2fe; color: #0284c7; }

.summary-card-details h4 {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: normal;
}

.summary-card-details span {
    font-size: 20px;
    font-weight: bold;
    font-family: var(--font-mono);
    color: var(--text-dark);
}

.table-data-wrapper {
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--bg-light);
}

.data-table th {
    background-color: var(--bg-light);
    font-family: var(--font-heading);
    font-weight: 500;
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
}

.data-table tr:hover td {
    background-color: var(--bg-light);
}

/* 12. Admin Dashboard Page (admin.php) */
.admin-reports-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 25px;
}

.report-card-panel {
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.report-card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--bg-light);
    padding-bottom: 8px;
}

.report-card-title i {
    color: var(--primary);
}

/* Banned labels */
.banned-row {
    opacity: 0.65;
    background-color: #f8fafc;
}

.ban-badge-status {
    background-color: var(--accent-red);
    color: var(--white);
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

/* 13. App Footer styling */
.app-footer {
    background-color: var(--primary-dark);
    color: var(--white);
    padding: 50px 0 20px 0;
    margin-top: auto;
    border-top: 4px solid var(--primary);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1.5fr 3fr;
    gap: 50px;
}

.footer-brand-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 700;
    color: var(--white);
    font-family: var(--font-heading);
}

.footer-logo .logo-text {
    color: #000000;
}

.footer-tagline {
    font-size: 13px;
    opacity: 0.8;
}

.footer-socials {
    display: flex;
    gap: 12px;
}

.footer-socials a {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.footer-socials a:hover {
    background-color: var(--primary);
    transform: translateY(-2px);
}

.footer-links-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.footer-link-group h3 {
    font-size: 16px;
    margin-bottom: 20px;
    position: relative;
}

.footer-link-group h3::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 30px;
    height: 2px;
    background-color: var(--accent);
}

.footer-link-group ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-link-group a {
    font-size: 13px;
    opacity: 0.8;
}

.footer-link-group a:hover {
    opacity: 1;
    color: var(--accent);
    padding-left: 5px;
}

.footer-bottom {
    max-width: 1200px;
    margin: 40px auto 0 auto;
    padding: 20px 20px 0 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-size: 12px;
    opacity: 0.7;
}

/* 14. Responsive Layout adjustments */
@media (max-width: 992px) {
    .product-detail-layout {
        grid-template-columns: 1fr;
    }
    .cart-layout-grid {
        grid-template-columns: 1fr;
    }
    .checkout-form-grid {
        grid-template-columns: 1fr;
    }
    .profile-layout-grid {
        grid-template-columns: 1fr;
    }
    .footer-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .merchant-dashboard-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .admin-reports-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-wrap: wrap;
        padding: 10px 15px;
        gap: 10px;
    }
    .header-search {
        order: 3;
        width: 100%;
        max-width: 100%;
    }
    /* ซ่อนไอคอนหน้า Thaiselling.com บนมือถือ */
    .header-logo .logo-icon,
    .header-logo svg {
        display: none !important;
    }
    /* ปรับขนาดโลโก้ให้กระชับขึ้น */
    .header-logo {
        font-size: 20px;
    }
    /* ลดระยะห่างและดันชิดขวาของเมนูทางขวา */
    .header-actions {
        gap: 12px;
        margin-left: auto;
    }
    .banner-carousel {
        height: 200px;
    }
    .banner-slide {
        padding: 20px;
    }
    .banner-content h2 {
        font-size: 22px;
    }
    .banner-img-container {
        display: none;
    }
    .merchant-dashboard-summary-grid {
        grid-template-columns: 1fr;
    }
}

/* Payment method styling */
.payment-method-option:has(input[type="radio"]:checked) {
    border-color: var(--primary) !important;
    background-color: var(--primary-light) !important;
}

/* Saved address active option styling */
.saved-address-option:has(input[type="radio"]:checked) {
    border-color: var(--primary) !important;
    background-color: var(--primary-light) !important;
}

/* Toast Notification styling */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast-notification {
    background-color: #059669; /* Success green */
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-notification.error {
    background-color: #dc2626; /* Danger red */
}

.toast-notification i {
    font-size: 16px;
}

/* Product Gallery Styles */
.product-gallery-container {
    display: flex;
    flex-direction: column;
}

.product-thumbnails-row {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.product-thumbnails-row::-webkit-scrollbar {
    height: 4px;
}
.product-thumbnails-row::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 2px;
}

.thumbnail-item {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    background-color: var(--bg-light);
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: var(--transition);
}

.thumbnail-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s;
}

.thumbnail-item:hover {
    border-color: var(--primary-light);
}

.thumbnail-item:hover img {
    transform: scale(1.05);
}

.thumbnail-item.active {
    border-color: var(--primary);
}

/* Responsive login button text & alignment */
@media (max-width: 576px) {
    .login-btn-link .desktop-text {
        display: none !important;
    }
    .login-btn-link .mobile-text {
        display: inline !important;
    }
    /* ให้กล่องเมนูผู้ใช้ / ปุ่มเข้าสู่ระบบ ดันชิดขวาของพื้นที่เพจ */
    .header-actions {
        margin-left: auto;
    }
    /* ซ่อนแบนเนอร์โฆษณาหลักในหน้าจอมือถือ */
    .hero-zone {
        display: none !important;
    }
}
@media (min-width: 577px) {
    .login-btn-link .mobile-text {
        display: none !important;
    }
    .login-btn-link .desktop-text {
        display: inline !important;
    }
}
