/* 
 * My Sample Factory - Main Stylesheet
 * Shop System - Clean & Modern Design
 */

/* CSS Reset & Variables */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #e1e5e9;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --border-radius: 8px;
    --border-radius-lg: 12px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--white);
}

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

a:hover {
    color: var(--accent-color);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    list-style: none;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
}

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

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header Styles */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
}

.logo {
    display: inline-block;
    height: 50px;
}

.logo img {
    height: 100%;
    width: auto;
    display: block;
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-links a {
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
}

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

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    transition: background var(--transition-fast);
}

.user-menu:hover {
    background: var(--light-bg);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Main Layout */
.main-wrapper {
    display: flex;
    min-height: calc(100vh - 73px);
}

.sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--white);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    position: sticky;
    top: 73px;
    height: calc(100vh - 73px);
    overflow-y: auto;
}

.content-area {
    flex: 1;
    padding: 32px;
    background: var(--light-bg);
}

/* Sidebar Filters */
.filter-section {
    margin-bottom: 24px;
}

.filter-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-item:hover {
    background: var(--light-bg);
}

.filter-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-color);
    cursor: pointer;
}

.filter-item label {
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    flex: 1;
}

.filter-item .count {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--light-bg);
    padding: 2px 8px;
    border-radius: 12px;
}

/* Parent Tag Accordion */
.tag-group {
    margin-bottom: 16px;
}

.tag-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--light-bg);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.tag-header:hover {
    background: var(--border-color);
}

.tag-header span {
    font-weight: 500;
    font-size: 14px;
}

.tag-toggle {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast);
}

.tag-toggle.active {
    transform: rotate(180deg);
}

.tag-children {
    padding: 8px 0 8px 24px;
    display: none;
}

.tag-children.active {
    display: block;
}

.child-tag {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.child-tag:hover {
    background: var(--light-bg);
}

.child-tag input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-color);
}

/* Size Filter */
.size-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.size-option {
    padding: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 13px;
    transition: all var(--transition-fast);
}

.size-option:hover {
    border-color: var(--accent-color);
    background: var(--light-bg);
}

.size-option.active {
    background: var(--accent-color);
    color: var(--white);
    border-color: var(--accent-color);
}

/* Product Grid */
.products-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.products-title {
    font-size: 24px;
    font-weight: 600;
}

.products-count {
    color: var(--text-secondary);
    font-size: 14px;
}

.sort-select {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--white);
    cursor: pointer;
    min-width: 180px;
}

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

/* Product Card */
.product-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--light-bg);
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    background: var(--danger-color);
    color: var(--white);
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
}

.product-actions {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--transition-normal);
}

.product-card:hover .product-actions {
    opacity: 1;
    transform: translateY(0);
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--white);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: var(--accent-color);
    color: var(--white);
}

.product-info {
    padding: 20px;
}

.product-category {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-name a:hover {
    color: var(--accent-color);
}

.product-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.current-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

.original-price {
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: line-through;
}

.product-btn {
    width: 100%;
    padding: 12px 24px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.product-btn:hover {
    background: var(--accent-color);
}

/* Detail Page Styles */
.detail-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
}

.detail-gallery {
    position: sticky;
    top: 100px;
}

.gallery-main {
    aspect-ratio: 1;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--light-bg);
    margin-bottom: 16px;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Gallery Counter */
.gallery-counter {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.gallery-thumbs {
    display: flex;
    gap: 12px;
    overflow-x: auto;
}

.thumb-item {
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.thumb-item.active {
    border-color: var(--accent-color);
}

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-info {
    padding: 16px 0;
}

.detail-breadcrumb {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.detail-breadcrumb a:hover {
    color: var(--accent-color);
}

.detail-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.3;
}

.detail-price {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 24px;
}

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

.detail-price .original {
    font-size: 18px;
    color: var(--text-secondary);
    text-decoration: line-through;
}

.detail-price .discount {
    padding: 4px 12px;
    background: var(--danger-color);
    color: var(--white);
    font-size: 14px;
    font-weight: 600;
    border-radius: 20px;
}

/* Color Selection */
.color-section {
    margin-bottom: 24px;
}

.section-label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.color-options {
    display: flex;
    gap: 12px;
}

.color-btn {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--white);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.color-btn.active {
    border-color: var(--accent-color);
    background: rgba(52, 152, 219, 0.1);
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
}

/* Size Selection */
.size-section {
    margin-bottom: 24px;
}

.size-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.size-btn {
    min-width: 60px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--white);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.size-btn:hover {
    border-color: var(--accent-color);
}

.size-btn.active {
    border-color: var(--accent-color);
    background: var(--accent-color);
    color: var(--white);
}

.size-btn.out-of-stock {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Quantity Selector */
.quantity-section {
    margin-bottom: 24px;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    width: fit-content;
}

.qty-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-bg);
    font-size: 18px;
    transition: all var(--transition-fast);
}

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

.qty-input {
    width: 60px;
    height: 44px;
    border: none;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
}

/* Action Buttons */
.detail-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
}

.btn-primary {
    flex: 1;
    padding: 16px 32px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    transition: all var(--transition-fast);
}

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

.btn-secondary {
    padding: 16px 32px;
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    transition: all var(--transition-fast);
}

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

/* Tabs */
.detail-tabs {
    border-top: 1px solid var(--border-color);
    padding-top: 32px;
}

.tabs-nav {
    display: flex;
    gap: 32px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.tab-btn {
    padding: 16px 0;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: color var(--transition-fast);
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-color);
}

.tab-content {
    display: none;
}

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

.tab-content p {
    margin-bottom: 16px;
    line-height: 1.8;
}

.specs-table {
    width: 100%;
    border-collapse: collapse;
}

.specs-table tr {
    border-bottom: 1px solid var(--border-color);
}

.specs-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 500;
    color: var(--text-secondary);
    width: 40%;
}

.specs-table td {
    padding: 12px 16px;
    font-weight: 500;
}

/* Reviews */
.review-summary {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
    background: var(--light-bg);
    border-radius: var(--border-radius);
    margin-bottom: 24px;
}

.rating-big {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary-color);
}

.rating-stars {
    color: #f1c40f;
    font-size: 20px;
}

.rating-count {
    color: var(--text-secondary);
    font-size: 14px;
}

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

.review-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.reviewer-name {
    font-weight: 600;
}

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

.review-stars {
    color: #f1c40f;
}

.review-title {
    font-weight: 600;
    margin-bottom: 8px;
}

.review-content {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Q&A */
.qa-item {
    padding: 20px;
    background: var(--light-bg);
    border-radius: var(--border-radius);
    margin-bottom: 16px;
}

.qa-question {
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    gap: 8px;
}

.qa-question::before {
    content: 'Q';
    color: var(--accent-color);
    font-weight: 700;
}

.qa-answer {
    color: var(--text-secondary);
    padding-left: 24px;
}

.qa-answer::before {
    content: 'A';
    color: var(--success-color);
    font-weight: 700;
    margin-right: 8px;
}

/* Related Products */
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

/* Live Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}

.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-color);
    color: var(--white);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all var(--transition-fast);
}

.chat-toggle:hover {
    transform: scale(1.1);
    background: var(--primary-color);
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chat-window.active {
    display: flex;
}

.chat-header {
    padding: 16px 20px;
    background: var(--primary-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.chat-status {
    font-size: 12px;
    opacity: 0.8;
}

.chat-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 20px;
    cursor: pointer;
}

.chat-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: var(--light-bg);
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.chat-message.user {
    align-self: flex-end;
    background: var(--accent-color);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.chat-message.admin {
    align-self: flex-start;
    background: var(--white);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.chat-message .time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

.chat-input-area {
    padding: 16px;
    background: var(--white);
    border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 14px;
}

.chat-input:focus {
    border-color: var(--accent-color);
}

.chat-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.chat-send:hover {
    background: var(--primary-color);
}

.chat-login-prompt {
    padding: 32px;
    text-align: center;
}

.chat-login-prompt p {
    margin-bottom: 16px;
    color: var(--text-secondary);
}

/* Footer */
.footer {
    background: var(--primary-color);
    color: var(--white);
    padding: 48px 0 24px;
    margin-top: 48px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
    margin-bottom: 32px;
}

.footer-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.footer-section ul {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-section a {
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    transition: color var(--transition-fast);
}

.footer-section a:hover {
    color: var(--white);
}

.footer-bottom {
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    font-size: 14px;
    color: rgba(255,255,255,0.6);
}

/* Admin Panel Styles */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    background: var(--primary-color);
    color: var(--white);
    flex-shrink: 0;
}

.admin-sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.admin-logo {
    font-size: 20px;
    font-weight: 700;
}

.admin-nav {
    padding: 16px 0;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: rgba(255,255,255,0.7);
    transition: all var(--transition-fast);
}

.admin-nav-item:hover,
.admin-nav-item.active {
    background: rgba(255,255,255,0.1);
    color: var(--white);
}

.admin-nav-item svg {
    width: 20px;
    height: 20px;
}

.admin-main {
    flex: 1;
    background: var(--light-bg);
}

.admin-header {
    background: var(--white);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.admin-title {
    font-size: 20px;
    font-weight: 600;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-content {
    padding: 32px;
}

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    padding: 24px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 24px;
}

.stat-icon.blue {
    background: rgba(52, 152, 219, 0.1);
    color: var(--accent-color);
}

.stat-icon.green {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success-color);
}

.stat-icon.orange {
    background: rgba(243, 156, 18, 0.1);
    color: var(--warning-color);
}

.stat-icon.red {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger-color);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

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

/* Data Tables */
.data-table {
    width: 100%;
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--light-bg);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.table-actions {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 4px;
}

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

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

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

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

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: border-color var(--transition-fast);
}

.form-input:focus {
    border-color: var(--accent-color);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237f8c8d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all var(--transition-fast);
}

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

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

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

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

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-bg);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--white);
    padding: 48px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

.login-logo p {
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Responsive */
@media (max-width: 1024px) {
    .detail-wrapper {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 24px;
    }
    
    .sidebar {
        display: none;
    }
    
    .detail-gallery {
        position: static;
    }
}

@media (max-width: 768px) {
    /* Header Mobile */
    .header-content {
        flex-wrap: wrap;
        gap: 12px;
        padding: 12px 0;
    }
    
    .nav-links {
        display: none;
    }
    
    .logo {
        height: 40px;
    }
    
    /* Container Mobile */
    .container {
        padding: 0 16px;
    }
    
    /* Detail Page Mobile - Critical Fixes */
    .detail-wrapper {
        display: flex;
        flex-direction: column;
        padding: 16px;
        margin: 0;
        border-radius: 0;
        gap: 20px;
    }
    
    .detail-gallery {
        width: 100%;
        order: -1;
    }
    
    .gallery-main {
        aspect-ratio: 1;
        height: auto;
        max-height: 350px;
        border-radius: 12px;
        background: var(--light-bg);
    }
    
    .gallery-main img {
        object-fit: cover;
        width: 100%;
        height: 100%;
    }
    
    .gallery-thumbs {
        padding: 12px 0;
        gap: 8px;
        justify-content: flex-start;
    }
    
    .thumb-item {
        width: 60px;
        height: 60px;
        flex-shrink: 0;
    }
    
    .gallery-counter {
        bottom: 8px;
        font-size: 12px;
        padding: 4px 10px;
    }
    
    .detail-info {
        width: 100%;
        padding: 0;
    }
    
    .detail-title {
        font-size: 22px;
        font-weight: 700;
        margin-bottom: 12px;
        line-height: 1.3;
    }
    
    .detail-price {
        flex-direction: row;
        align-items: baseline;
        gap: 12px;
        margin-bottom: 20px;
    }
    
    .detail-price .current {
        font-size: 24px;
        font-weight: 700;
        color: var(--primary-color);
    }
    
    .detail-price .original {
        font-size: 16px;
    }
    
    .detail-price .discount {
        font-size: 13px;
        padding: 4px 10px;
    }
    
    /* Color Selection Mobile */
    .color-section, .size-section, .quantity-section {
        margin-bottom: 20px;
    }
    
    .section-label {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 10px;
    }
    
    .color-options {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .color-btn {
        padding: 8px 14px;
        border: 2px solid var(--border-color);
        border-radius: 8px;
        background: var(--white);
        font-size: 13px;
        font-weight: 500;
    }
    
    .color-btn.active {
        border-color: var(--accent-color);
        background: rgba(52, 152, 219, 0.1);
    }
    
    .color-swatch {
        width: 20px;
        height: 20px;
    }
    
    /* Size Selection Mobile - Fixed */
    .size-options {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        background: var(--light-bg);
        padding: 12px;
        border-radius: 8px;
    }
    
    .size-btn {
        min-width: 50px;
        padding: 10px 12px;
        border: 1px solid var(--border-color);
        border-radius: 6px;
        background: var(--white);
        font-size: 13px;
        font-weight: 500;
        text-align: center;
    }
    
    .size-btn.active {
        border-color: var(--accent-color);
        background: var(--accent-color);
        color: var(--white);
    }
    
    .size-btn.out-of-stock {
        opacity: 0.5;
        background: var(--light-bg);
    }
    
    /* Quantity Mobile */
    .quantity-selector {
        width: 100%;
        max-width: 200px;
    }
    
    .qty-btn {
        width: 44px;
        height: 44px;
        background: var(--white);
    }
    
    .qty-input {
        width: 60px;
        height: 44px;
        font-size: 16px;
        font-weight: 500;
    }
    
    /* Action Buttons Mobile */
    .detail-actions {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 24px;
    }
    
    .detail-actions .btn-primary {
        width: 100%;
        padding: 16px 24px;
        font-size: 16px;
        font-weight: 600;
        border-radius: 8px;
        background: var(--primary-color);
    }
    
    .detail-actions .btn-primary:hover {
        background: var(--accent-color);
    }
    
    /* Tabs Mobile */
    .detail-tabs {
        border-top: 1px solid var(--border-color);
        padding-top: 24px;
        margin-top: 24px;
    }
    
    .tabs-nav {
        display: flex;
        gap: 0;
        border-bottom: 2px solid var(--border-color);
        margin-bottom: 20px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0;
    }
    
    .tabs-nav::-webkit-scrollbar {
        display: none;
    }
    
    .tab-btn {
        padding: 12px 16px;
        font-size: 14px;
        font-weight: 500;
        color: var(--text-secondary);
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .tab-btn.active {
        color: var(--primary-color);
        background: var(--white);
    }
    
    .tab-content {
        padding: 0;
    }
    
    /* Specs Table Mobile */
    .specs-table {
        font-size: 14px;
    }
    
    .specs-table th, 
    .specs-table td {
        padding: 12px;
    }
    
    /* Related Products Mobile */
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .related-grid .product-image {
        height: 100px;
    }
    
    .related-grid .product-name {
        font-size: 13px;
    }
    
    /* Product Grid Mobile */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .product-card {
        border-radius: 8px;
    }
    
    .product-image {
        aspect-ratio: 1;
    }
    
    .product-info {
        padding: 12px;
    }
    
    .product-name {
        font-size: 13px;
        margin-bottom: 4px;
    }
    
    .product-description {
        font-size: 12px;
        display: none;
    }
    
    .current-price {
        font-size: 16px;
    }
    
    /* Chat Widget Mobile */
    .chat-widget {
        bottom: 16px;
        right: 16px;
    }
    
    .chat-toggle {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
    
    .chat-window {
        position: fixed;
        bottom: 80px;
        right: 16px;
        left: 16px;
        width: auto;
        max-width: calc(100% - 32px);
        height: 400px;
        border-radius: 12px;
    }
    
    /* Footer Mobile */
    .footer {
        padding: 32px 0 20px;
        margin-top: 32px;
    }
    
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .footer-section h4 {
        font-size: 14px;
        margin-bottom: 12px;
    }
    
    .footer-section ul {
        gap: 6px;
    }
    
    .footer-section a {
        font-size: 13px;
    }
    
    .footer-bottom {
        padding-top: 16px;
        font-size: 12px;
    }
    
    /* Main Wrapper Mobile */
    .main-wrapper {
        flex-direction: column;
        min-height: auto;
    }
    
    .sidebar {
        display: none;
    }
    
    .content-area {
        padding: 16px;
        background: var(--white);
    }
    
    .products-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 16px;
    }
    
    .products-title {
        font-size: 20px;
    }
    
    .sort-select {
        width: 100%;
        padding: 10px 12px;
        font-size: 14px;
        min-width: auto;
    }
    
    /* Filter Section Mobile */
    .filter-section {
        margin-bottom: 16px;
    }
    
    .filter-title {
        font-size: 13px;
        margin-bottom: 8px;
        padding-bottom: 6px;
    }
    
    .tag-header {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .tag-children {
        padding: 4px 0 4px 16px;
    }
    
    .child-tag {
        padding: 6px 12px;
    }
    
    .child-tag input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    /* Modal Mobile */
    .modal {
        margin: 16px;
        max-width: calc(100% - 32px);
    }
    
    .modal-header {
        padding: 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .modal-title {
        font-size: 18px;
    }
    
    /* Admin Sidebar Mobile */
    .admin-sidebar {
        display: none;
    }
    
    .admin-content {
        padding: 16px;
    }
    
    /* Login Page Mobile */
    .login-card {
        padding: 32px 24px;
        margin: 16px;
    }
}

@media (max-width: 480px) {
    /* Extra Small Mobile */
    .detail-title {
        font-size: 20px;
    }
    
    .detail-price .current {
        font-size: 22px;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .related-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-section ul {
        align-items: center;
    }
    
    /* Size buttons - ensure they fit */
    .size-btn {
        min-width: 45px;
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.mt-24 { margin-top: 24px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.hidden { display: none; }

