/* Base Styles */
:root {
    --primary-color: #4CAF50;
    --primary-hover: #45a049;
    --secondary-color: #ff9800;
    --dark-color: #333;
    --light-color: #f8f9fa;
    --danger-color: #dc3545;
    --success-color: #28a745;
    --text-color: #333;
    --text-muted: #6c757d;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Dark Mode */
[data-theme="dark"] {
    --dark-color: #f8f9fa;
    --light-color: #212529;
    --text-color: #f8f9fa;
    --text-muted: #adb5bd;
    --box-shadow: 0 2px 10px rgba(255, 255, 255, 0.1);
    background-color: #121212;
    color: #f8f9fa;
}

[data-theme="dark"] .bg-light {
    background-color: #2c2c2c !important;
    color: #f8f9fa;
}

[data-theme="dark"] .card {
    background-color: #2c2c2c;
    border-color: #444;
}

[data-theme="dark"] .text-muted {
    color: #adb5bd !important;
}

/* Global Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    background-color: #f9f9f9;
    padding-top: 76px; /* Height of fixed navbar */
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Navbar */
.navbar {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 0.8rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
}

.navbar-brand img {
    transition: var(--transition);
}

.navbar-brand:hover img {
    transform: scale(1.05);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('../images/hero-bg.jpg') no-repeat center center/cover;
    color: white;
    padding: 6rem 0;
    margin-bottom: 3rem;
    border-radius: var(--border-radius);
    position: relative;
    overflow: hidden;
}

.hero-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 2;
}

.hero-content h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-content p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Product Cards */
.product-card {
    border: none;
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    margin-bottom: 1.5rem;
    box-shadow: var(--box-shadow);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.product-img {
    height: 200px;
    object-fit: cover;
    width: 100%;
}

.product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
}

.product-title {
    font-weight: 600;
    margin: 1rem 0 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 3em;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0.5rem 0;
}

.original-price {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

/* Cart Sidebar */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    transition: var(--transition);
    overflow-y: auto;
}

.cart-sidebar.show {
    right: 0;
}

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
}

.cart-overlay.show {
    display: block;
}

/* Forms */
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(76, 175, 80, 0.25);
}

/* Footer */
footer {
    background-color: #2c3e50;
    color: white;
    padding: 3rem 0 1rem;
}

footer h6 {
    color: white;
    font-weight: 600;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

footer h6::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 50px;
    height: 2px;
    background-color: var(--primary-color);
}

footer ul li {
    margin-bottom: 0.5rem;
}

footer a {
    color: #adb5bd;
    transition: var(--transition);
}

footer a:hover {
    color: white;
    padding-left: 5px;
}

.social-links a {
    display: inline-block;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    text-align: center;
    line-height: 36px;
    margin-right: 10px;
    transition: var(--transition);
}

.social-links a:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-3px);
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Responsive Styles */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: white;
        padding: 1rem;
        border-radius: var(--border-radius);
        box-shadow: var(--box-shadow);
        margin-top: 1rem;
    }
    
    .cart-sidebar {
        width: 100%;
        max-width: 400px;
    }
}

@media (max-width: 767.98px) {
    .hero-content h1 {
        font-size: 2.2rem;
    }
    
    .hero-content p {
        font-size: 1.1rem;
    }
    
    .cart-sidebar {
        width: 100%;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

/* Utility Classes */
.rounded-lg {
    border-radius: var(--border-radius);
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.shadow {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 0.25rem solid rgba(76, 175, 80, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
}

.toast {
    min-width: 300px;
    box-shadow: var(--box-shadow);
    border: none;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.toast-header {
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
    border: none;
}

.toast-body {
    padding: 1rem;
}

/* Custom Checkbox and Radio */
.custom-control-input:checked ~ .custom-control-label::before {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Quantity Selector */
.quantity-selector {
    display: flex;
    align-items: center;
}

.quantity-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
}

.quantity-input {
    width: 50px;
    height: 30px;
    text-align: center;
    border: 1px solid #dee2e6;
    border-left: none;
    border-right: none;
    -moz-appearance: textfield;
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Product Badges */
.badge-sale {
    background-color: var(--danger-color);
}

.badge-new {
    background-color: var(--success-color);
}

.badge-bestseller {
    background-color: var(--secondary-color);
}

/* Testimonial Carousel */
.testimonial-card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    margin: 1rem 0.5rem;
    transition: var(--transition);
}

.testimonial-card:hover {
    transform: translateY(-5px);
}

.testimonial-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1rem;
    border: 3px solid var(--primary-color);
}

.testimonial-text {
    font-style: italic;
    margin-bottom: 1rem;
}

.testimonial-author {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.testimonial-role {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Star Rating */
.star-rating {
    color: #ffc107;
    margin-bottom: 0.5rem;
}

.star-rating .far {
    color: #ddd;
}

/* Pagination */
.pagination .page-link {
    color: var(--primary-color);
    border-color: #dee2e6;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.pagination .page-link:hover {
    background-color: #f1f1f1;
}

/* Breadcrumb */
.breadcrumb {
    background-color: transparent;
    padding: 0.75rem 0;
    margin-bottom: 1.5rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '›';
    padding: 0 0.5rem;
}

/* Alert Messages */
.alert {
    border: none;
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Dark mode scrollbar */
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #2c2c2c;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #555;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Print Styles */
@media print {
    .no-print, .navbar, footer, .back-to-top {
        display: none !important;
    }
    
    body {
        padding: 0;
        background: white;
        color: black;
    }
    
    .container {
        width: 100%;
        max-width: 100%;
    }
}

/* APW Support Chat Widget */
.apw-chat-bubble {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 1100;
}

.apw-chat-bubble:hover {
    background-color: var(--primary-hover);
}

.apw-chat-window {
    position: fixed;
    bottom: 150px;
    right: 20px;
    width: 320px;
    max-height: 420px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1100;
}

[data-theme="dark"] .apw-chat-window {
    background: #2c2c2c;
}

.apw-chat-header {
    padding: 0.75rem 1rem;
    background-color: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.apw-chat-header-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.apw-chat-header-subtitle {
    font-size: 0.75rem;
    opacity: 0.85;
}

.apw-chat-body {
    padding: 0.75rem;
    overflow-y: auto;
    flex: 1 1 auto;
}

.apw-chat-message {
    margin-bottom: 0.5rem;
    display: flex;
}

.apw-chat-message.bot {
    justify-content: flex-start;
}

.apw-chat-message.user {
    justify-content: flex-end;
}

.apw-chat-bubble-text {
    max-width: 80%;
    padding: 0.5rem 0.75rem;
    border-radius: 14px;
    font-size: 0.85rem;
}

.apw-chat-message.bot .apw-chat-bubble-text {
    background-color: #f1f3f5;
    color: var(--text-color);
    border-bottom-left-radius: 4px;
}

[data-theme="dark"] .apw-chat-message.bot .apw-chat-bubble-text {
    background-color: #3a3a3a;
}

.apw-chat-message.user .apw-chat-bubble-text {
    background-color: var(--primary-color);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.apw-chat-footer {
    border-top: 1px solid #dee2e6;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

[data-theme="dark"] .apw-chat-footer {
    border-top-color: #444;
}

.apw-chat-input {
    flex: 1 1 auto;
    border-radius: 999px;
    border: 1px solid #ced4da;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
}

.apw-chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.apw-chat-send-btn {
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
}

.apw-chat-typing {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

@media (max-width: 575.98px) {
    .apw-chat-window {
        right: 10px;
        left: 10px;
        width: auto;
    }

    .apw-chat-bubble {
        right: 10px;
    }
}

