/* ===============================================
   meShop - Main Stylesheet
   A Shopify-inspired E-Commerce Theme
   =============================================== */

/* -----------------------------------------------
   Root Variables
   ----------------------------------------------- */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --dark: #1e293b;
    --light: #f8fafc;
    --border: #e2e8f0;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

/* -----------------------------------------------
   Base
   ----------------------------------------------- */
body {
    font-family: var(--font-family);
    color: var(--dark);
    background-color: #f9fafb;
    line-height: 1.6;
}

a {
    color: var(--primary);
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* -----------------------------------------------
   Top Bar
   ----------------------------------------------- */
.top-bar {
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
}

/* -----------------------------------------------
   Navbar
   ----------------------------------------------- */
.navbar-brand {
    color: var(--primary) !important;
    letter-spacing: -0.02em;
}

.navbar .nav-link {
    font-weight: 500;
    color: var(--dark);
    padding: 0.5rem 0.75rem !important;
}

.navbar .nav-link:hover {
    color: var(--primary);
}

.cart-icon {
    position: relative;
}

.cart-badge {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 0.65rem;
    transform: translate(25%, -25%);
}

.cart-badge:empty,
.cart-badge[data-count="0"] {
    display: none;
}

/* Search bar */
.search-form {
    position: relative;
}

.search-form .form-control {
    border-radius: var(--radius) 0 0 var(--radius);
    border-right: none;
}

.search-form .btn {
    border-radius: 0 var(--radius) var(--radius) 0;
}

.search-results-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1050;
    max-height: 400px;
    overflow-y: auto;
}

.search-results-dropdown.show {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    text-decoration: none;
    color: var(--dark);
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.search-result-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 0.75rem;
}

/* Category Nav */
.category-nav .nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.category-nav .nav-link:hover {
    color: var(--primary) !important;
    background: var(--primary-light);
    border-radius: var(--radius);
}

/* -----------------------------------------------
   Hero Section
   ----------------------------------------------- */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    overflow: hidden;
    position: relative;
}

.hero-section::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 60%;
    height: 200%;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    transform: rotate(-15deg);
}

.hero-section h1 {
    font-size: 2.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.hero-section p {
    font-size: 1.15rem;
    opacity: 0.9;
}

/* -----------------------------------------------
   Section Headers
   ----------------------------------------------- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-weight: 700;
    font-size: 1.5rem;
    margin: 0;
}

.section-header a {
    font-weight: 500;
    text-decoration: none;
}

/* -----------------------------------------------
   Product Cards
   ----------------------------------------------- */
.product-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.product-card .product-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
    background: #f1f5f9;
}

.product-card .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-card .product-badges {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 2;
}

.product-card .badge-sale {
    background: var(--danger);
    color: white;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.product-card .badge-new {
    background: var(--success);
    color: white;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.product-card .product-actions {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0;
    transform: translateX(10px);
    transition: var(--transition);
    z-index: 2;
}

.product-card:hover .product-actions {
    opacity: 1;
    transform: translateX(0);
}

.product-card .product-actions .btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: white;
    border: 1px solid var(--border);
    color: var(--dark);
    box-shadow: var(--shadow-sm);
}

.product-card .product-actions .btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.product-card .product-info {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card .product-category {
    font-size: 0.75rem;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.product-card .product-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .product-name:hover {
    color: var(--primary);
}

.product-card .product-rating {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.product-card .product-rating .text-muted {
    font-size: 0.75rem;
}

.product-card .product-price {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.product-card .price-current {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}

.product-card .price-old {
    font-size: 0.85rem;
    color: var(--secondary);
    text-decoration: line-through;
}

.product-card .product-footer {
    padding: 0 1rem 1rem;
}

.product-card .btn-add-cart {
    width: 100%;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem;
    border-radius: var(--radius);
}

/* -----------------------------------------------
   Category Cards
   ----------------------------------------------- */
.category-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
    text-decoration: none;
    color: var(--dark);
    display: block;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
    color: var(--primary);
}

.category-card .category-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 0.75rem;
    transition: var(--transition);
}

.category-card:hover .category-icon {
    background: var(--primary);
    color: white;
}

.category-card h6 {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.category-card .item-count {
    font-size: 0.8rem;
    color: var(--secondary);
}

/* -----------------------------------------------
   Product Detail Page
   ----------------------------------------------- */
.product-gallery {
    position: sticky;
    top: 100px;
}

.product-gallery .main-image {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background: #f1f5f9;
    aspect-ratio: 1;
}

.product-gallery .main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-gallery .thumbnails {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.product-gallery .thumb {
    width: 70px;
    height: 70px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.product-gallery .thumb.active,
.product-gallery .thumb:hover {
    border-color: var(--primary);
}

.product-gallery .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-detail .price-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
}

.product-detail .price-current {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.product-detail .price-old {
    font-size: 1.1rem;
    color: var(--secondary);
    text-decoration: line-through;
}

.product-detail .price-badge {
    background: #fef2f2;
    color: var(--danger);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.quantity-selector {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    width: fit-content;
}

.quantity-selector button {
    background: #f1f5f9;
    border: none;
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
}

.quantity-selector button:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.quantity-selector input {
    width: 60px;
    height: 40px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    font-weight: 600;
    -moz-appearance: textfield;
}

.quantity-selector input::-webkit-inner-spin-button,
.quantity-selector input::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

/* -----------------------------------------------
   Cart Page
   ----------------------------------------------- */
.cart-table {
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

.cart-table .cart-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

.cart-table .cart-item:last-child {
    border-bottom: none;
}

.cart-table .cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    overflow: hidden;
    flex-shrink: 0;
}

.cart-table .cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-table .cart-item-info {
    flex: 1;
}

.cart-table .cart-item-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.cart-summary {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: sticky;
    top: 100px;
}

.cart-summary h4 {
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.cart-summary .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.cart-summary .summary-total {
    font-weight: 700;
    font-size: 1.2rem;
    border-top: 2px solid var(--dark);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

/* -----------------------------------------------
   Checkout
   ----------------------------------------------- */
.checkout-section {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.checkout-section h5 {
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

/* -----------------------------------------------
   Account Pages
   ----------------------------------------------- */
.account-sidebar {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.account-sidebar .list-group-item {
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    transition: var(--transition);
}

.account-sidebar .list-group-item:last-child {
    border-bottom: none;
}

.account-sidebar .list-group-item.active,
.account-sidebar .list-group-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.account-content {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

/* -----------------------------------------------
   Auth Pages
   ----------------------------------------------- */
.auth-container {
    max-width: 480px;
    margin: 2rem auto;
}

.auth-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.auth-card h2 {
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-card .auth-subtitle {
    text-align: center;
    color: var(--secondary);
    margin-bottom: 1.5rem;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.auth-divider span {
    padding: 0 1rem;
    color: var(--secondary);
    font-size: 0.875rem;
}

/* -----------------------------------------------
   Newsletter
   ----------------------------------------------- */
.newsletter-section {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%) !important;
}

.newsletter-section .form-control {
    border: none;
    border-radius: var(--radius) !important;
}

.newsletter-section .btn-light {
    border-radius: var(--radius) !important;
    color: var(--primary);
}

/* -----------------------------------------------
   Features Section
   ----------------------------------------------- */
.features-section {
    margin: 2rem 0;
}

.feature-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.feature-box:hover {
    box-shadow: var(--shadow-md);
}

.feature-box .feature-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.feature-box h6 {
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.feature-box p {
    font-size: 0.8rem;
    color: var(--secondary);
    margin: 0;
}

/* -----------------------------------------------
   Breadcrumb
   ----------------------------------------------- */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.breadcrumb-item a {
    color: var(--secondary);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--primary);
}

/* -----------------------------------------------
   Stars Rating
   ----------------------------------------------- */
.stars {
    display: inline-flex;
    gap: 1px;
}

.stars i {
    font-size: 0.85rem;
}

/* -----------------------------------------------
   Filters Sidebar
   ----------------------------------------------- */
.filter-section {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.filter-section h6 {
    font-weight: 700;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.price-range-inputs {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.price-range-inputs input {
    width: 100%;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
}

/* -----------------------------------------------
   Order Status Badges
   ----------------------------------------------- */
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-processing { background: #dbeafe; color: #1e40af; }
.badge-shipped { background: #e0e7ff; color: #3730a3; }
.badge-delivered { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-refunded { background: #f3e8ff; color: #6b21a8; }
.badge-paid { background: #dcfce7; color: #166534; }
.badge-failed { background: #fee2e2; color: #991b1b; }

/* -----------------------------------------------
   Miscellaneous
   ----------------------------------------------- */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

.empty-state {
    text-align: center;
    padding: 3rem;
}

.empty-state i {
    font-size: 3rem;
    color: var(--secondary);
    margin-bottom: 1rem;
    display: block;
}

.empty-state p {
    color: var(--secondary);
    margin-bottom: 1rem;
}

.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(0,0,0,0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Placeholder image */
.placeholder-img {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 2rem;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
}

/* -----------------------------------------------
   Responsive
   ----------------------------------------------- */
@media (max-width: 991.98px) {
    .hero-section {
        padding: 2.5rem 0;
        text-align: center;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .product-card .product-actions {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 767.98px) {
    .hero-section h1 {
        font-size: 1.75rem;
    }
    
    .cart-table .cart-item {
        flex-wrap: wrap;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 575.98px) {
    .product-detail .price-current {
        font-size: 1.5rem;
    }
    
    .auth-card {
        padding: 1.5rem;
    }
}

/* -----------------------------------------------
   Admin Panel Overrides
   ----------------------------------------------- */
.admin-sidebar {
    background: var(--dark);
    height: 100vh;
    width: 260px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}
.admin-sidebar::-webkit-scrollbar {
    width: 6px;
}
.admin-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.admin-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}
.admin-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

.admin-sidebar .sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-sidebar .nav-section {
    padding: 0.75rem 1.5rem 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.4);
}

.admin-sidebar .nav-link {
    color: rgba(255,255,255,0.7);
    padding: 0.6rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    color: white;
    background: rgba(255,255,255,0.05);
    border-left-color: var(--primary);
}

.admin-sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

.admin-content {
    margin-left: 260px;
    padding: 1.5rem 2rem;
    min-height: 100vh;
    background: #f1f5f9;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.admin-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    color: var(--secondary);
    font-size: 0.85rem;
}

.admin-table {
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

.admin-table table {
    margin: 0;
}

.admin-table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid var(--border);
}

@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    
    .admin-sidebar.show {
        transform: translateX(0);
    }
    
    .admin-content {
        margin-left: 0;
    }
}
