/**
 * NecsPOS Store Module - Main Stylesheet
 * Based on Ecomus theme patterns
 */

/* ==========================================================================
   CSS Variables (Customizable per store)
   ========================================================================== */
:root {
    --store-primary: #000000;
    --store-secondary: #ffffff;
    --store-accent: #d4af37;
    --store-text: #333333;
    --store-text-light: #666666;
    --store-border: #e5e5e5;
    --store-bg: #ffffff;
    --store-bg-light: #f8f9fa;
    --store-success: #28a745;
    --store-danger: #dc3545;
    --store-warning: #ffc107;
    --store-info: #17a2b8;
    --store-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --store-font-size: 14px;
    --store-line-height: 1.6;
    --store-border-radius: 4px;
    --store-transition: all 0.3s ease;
    --store-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --store-shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   Base Styles
   ========================================================================== */
body.store-page {
    font-family: var(--store-font-family);
    font-size: var(--store-font-size);
    line-height: var(--store-line-height);
    color: var(--store-text);
    background-color: var(--store-bg);
}

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

.store-header .navbar {
    padding: 15px 0;
}

.store-logo img {
    max-height: 50px;
    width: auto;
}

.store-nav .nav-link {
    color: var(--store-text);
    font-weight: 500;
    padding: 8px 16px;
    transition: var(--store-transition);
}

.store-nav .nav-link:hover {
    color: var(--store-primary);
}

.header-icons .btn {
    color: var(--store-text);
    position: relative;
}

.header-icons .cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--store-primary);
    color: #fff;
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   Product Card
   ========================================================================== */
.product-card {
    background: var(--store-bg);
    border-radius: var(--store-border-radius);
    overflow: hidden;
    transition: var(--store-transition);
    height: 100%;
}

.product-card:hover {
    box-shadow: var(--store-shadow-lg);
}

.product-card .product-image {
    position: relative;
    overflow: hidden;
    padding-top: 125%; /* 4:5 aspect ratio */
}

.product-card .product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

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

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

.product-card .product-actions .btn {
    flex: 1;
    padding: 10px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-card .product-info {
    padding: 15px;
    text-align: center;
}

.product-card .product-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--store-text);
}

.product-card .product-title a {
    color: inherit;
    text-decoration: none;
}

.product-card .product-title a:hover {
    color: var(--store-primary);
}

.product-card .product-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--store-primary);
}

.product-card .product-price .original-price {
    color: var(--store-text-light);
    text-decoration: line-through;
    font-size: 14px;
    font-weight: 400;
    margin-left: 8px;
}

.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
}

.product-badge .badge {
    font-size: 11px;
    padding: 5px 10px;
    font-weight: 600;
    text-transform: uppercase;
}

/* ==========================================================================
   Quick View Modal
   ========================================================================== */
.quick-view-modal .modal-dialog {
    max-width: 900px;
}

.quick-view-modal .product-gallery img {
    width: 100%;
    height: auto;
}

/* ==========================================================================
   Cart Sidebar
   ========================================================================== */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    max-width: 100%;
    height: 100vh;
    background: var(--store-bg);
    box-shadow: var(--store-shadow-lg);
    z-index: 2000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.open {
    right: 0;
}

.cart-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: var(--store-transition);
}

.cart-sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

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

.cart-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--store-border);
    background: var(--store-bg-light);
}

.cart-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--store-border);
}

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

.cart-item-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--store-border-radius);
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 5px;
}

.cart-item-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--store-primary);
}

.cart-item-remove {
    color: var(--store-text-light);
    font-size: 18px;
    cursor: pointer;
    transition: var(--store-transition);
}

.cart-item-remove:hover {
    color: var(--store-danger);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-section {
    position: relative;
    min-height: 500px;
    display: flex;
    align-items: center;
    background-size: cover;
    background-position: center;
    color: #fff;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 20px;
}

.hero-subtitle {
    font-size: 18px;
    margin-bottom: 30px;
    opacity: 0.9;
}

/* ==========================================================================
   Category Cards
   ========================================================================== */
.category-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--store-border-radius);
    height: 250px;
}

.category-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.category-card:hover img {
    transform: scale(1.1);
}

.category-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: #fff;
}

.category-card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 5px;
}

.category-card-count {
    font-size: 14px;
    opacity: 0.8;
}

/* ==========================================================================
   Shop Sidebar
   ========================================================================== */
.shop-sidebar {
    position: sticky;
    top: 100px;
}

.sidebar-widget {
    margin-bottom: 30px;
}

.widget-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--store-primary);
}

.category-list a {
    display: block;
    padding: 8px 0;
    color: var(--store-text);
    text-decoration: none;
    transition: var(--store-transition);
}

.category-list a:hover {
    color: var(--store-primary);
    padding-left: 5px;
}

/* ==========================================================================
   Price Range Slider
   ========================================================================== */
.price-slider {
    margin: 20px 0;
}

.price-slider input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    height: 4px;
    background: var(--store-border);
    border-radius: 2px;
}

.price-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--store-primary);
    border-radius: 50%;
    cursor: pointer;
}

/* ==========================================================================
   Checkout
   ========================================================================== */
.checkout-section .card {
    border: none;
    box-shadow: var(--store-shadow);
}

.checkout-section .card-header {
    background: var(--store-bg-light);
    border-bottom: 1px solid var(--store-border);
    padding: 15px 20px;
}

.order-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 0;
}

.order-item-image {
    width: 60px;
    height: 60px;
    position: relative;
}

.order-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--store-border-radius);
}

.order-item-image .qty-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--store-primary);
    color: #fff;
    font-size: 11px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.store-footer {
    background: var(--store-bg-light);
    padding: 60px 0 30px;
    margin-top: 60px;
}

.store-footer h5 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
}

.store-footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.store-footer ul li {
    margin-bottom: 10px;
}

.store-footer ul li a {
    color: var(--store-text-light);
    text-decoration: none;
    transition: var(--store-transition);
}

.store-footer ul li a:hover {
    color: var(--store-primary);
}

.footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--store-border);
    color: var(--store-text);
    margin-right: 10px;
    transition: var(--store-transition);
}

.footer-social a:hover {
    background: var(--store-primary);
    color: #fff;
}

.footer-bottom {
    border-top: 1px solid var(--store-border);
    padding-top: 20px;
    margin-top: 40px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn-store-primary {
    background: var(--store-primary);
    color: #fff;
    border: none;
    padding: 12px 30px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--store-transition);
}

.btn-store-primary:hover {
    background: var(--store-text);
    color: #fff;
}

.btn-store-outline {
    background: transparent;
    color: var(--store-primary);
    border: 2px solid var(--store-primary);
    padding: 10px 28px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--store-transition);
}

.btn-store-outline:hover {
    background: var(--store-primary);
    color: #fff;
}

/* ==========================================================================
   Quantity Selector
   ========================================================================== */
.quantity-selector .input-group {
    width: 130px;
}

.quantity-selector .btn {
    background: var(--store-bg-light);
    border: 1px solid var(--store-border);
    color: var(--store-text);
    padding: 8px 12px;
}

.quantity-selector .btn:hover {
    background: var(--store-primary);
    color: #fff;
    border-color: var(--store-primary);
}

.quantity-selector input {
    text-align: center;
    border: 1px solid var(--store-border);
    border-left: none;
    border-right: none;
}

/* ==========================================================================
   Account Sidebar
   ========================================================================== */
.account-sidebar .nav-link {
    color: var(--store-text);
    padding: 12px 15px;
    border-radius: var(--store-border-radius);
    transition: var(--store-transition);
}

.account-sidebar .nav-link:hover {
    background: var(--store-bg-light);
}

.account-sidebar .nav-link.active {
    background: var(--store-primary);
    color: #fff;
}

.account-sidebar .nav-link i {
    width: 20px;
}

/* ==========================================================================
   Order Status Badge
   ========================================================================== */
.order-status {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.order-status.pending {
    background: #fff3cd;
    color: #856404;
}

.order-status.processing {
    background: #cce5ff;
    color: #004085;
}

.order-status.shipped {
    background: #d4edda;
    color: #155724;
}

.order-status.delivered {
    background: #28a745;
    color: #fff;
}

.order-status.cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* ==========================================================================
   Order Tracking
   ========================================================================== */
.order-tracking {
    display: flex;
    justify-content: space-between;
    position: relative;
    padding: 20px 0;
}

.tracking-step {
    text-align: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.tracking-step::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    right: -50%;
    height: 2px;
    background: var(--store-border);
    z-index: -1;
}

.tracking-step:last-child::before {
    display: none;
}

.tracking-step.active::before {
    background: var(--store-primary);
}

.step-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--store-bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    color: var(--store-text-light);
    border: 2px solid var(--store-border);
}

.tracking-step.active .step-icon {
    background: var(--store-primary);
    color: #fff;
    border-color: var(--store-primary);
}

.step-label {
    font-size: 12px;
    color: var(--store-text-light);
}

.tracking-step.active .step-label {
    color: var(--store-primary);
    font-weight: 600;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 991px) {
    .hero-title {
        font-size: 36px;
    }

    .cart-sidebar {
        width: 100%;
        right: -100%;
    }
}

@media (max-width: 767px) {
    .hero-section {
        min-height: 400px;
    }

    .hero-title {
        font-size: 28px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

    .product-card .product-actions {
        opacity: 1;
        transform: none;
    }

    .category-card {
        height: 180px;
    }

    .store-footer {
        padding: 40px 0 20px;
    }
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.animate-slide-up {
    animation: slideUp 0.5s ease forwards;
}

/* ==========================================================================
   Loading States
   ========================================================================== */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--store-border);
    border-top-color: var(--store-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.store-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--store-text);
    color: #fff;
    padding: 15px 25px;
    border-radius: var(--store-border-radius);
    box-shadow: var(--store-shadow-lg);
    z-index: 3000;
    transform: translateY(100px);
    opacity: 0;
    transition: var(--store-transition);
}

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

.store-toast.success {
    background: var(--store-success);
}

.store-toast.error {
    background: var(--store-danger);
}

/* ==========================================================================
   Button Icon Fixes
   ========================================================================== */
/* Fix icon size in buttons - icons were appearing too large */
.tf-btn .icon,
.tf-btn i.icon,
.tf-btn i[class^="icon-"],
.tf-btn i[class*=" icon-"],
.btn-icon .icon,
.btn-line .icon,
.animate-hover-btn .icon {
    font-size: 10px !important;
    line-height: 1;
    vertical-align: middle;
    display: inline-block;
}

/* Specific button types */
.tf-btn.btn-sm .icon {
    font-size: 9px !important;
}

.tf-btn.btn-lg .icon {
    font-size: 12px !important;
}

/* Newsletter button icon */
.footer-newsletter .tf-btn .icon,
.subscribe-button .icon {
    font-size: 10px !important;
    margin-left: 6px;
}

/* Contact/CTA button icons */
.tf-btn.btn-fill .icon,
.tf-btn.btn-line .icon {
    font-size: 10px !important;
    margin-left: 5px;
}

/* Override X cursor on shopping cart and confirm modals */
.modal-shopping-cart,
.modal-shopping-cart .modal-dialog,
#confirmModal,
#confirmModal .modal-dialog {
    cursor: default !important;
}
