/* RefurbShop - Custom Styles */

/* ==========================================================================
   CSS Variables
   ========================================================================== */
:root {
    --primary-color: #332D82;
    --primary-hover: #2a2570;
    --primary-light: #F5EBFF;
    --secondary-color: #DCC1F9;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-gray: #f8f9fa;
    --dark-gray: #343a40;
    --border-color: #dee2e6;
    --shadow-sm: 0 .125rem .25rem rgba(0,0,0,.075);
    --shadow: 0 .5rem 1rem rgba(0,0,0,.15);
    --shadow-lg: 0 1rem 3rem rgba(0,0,0,.175);
    --transition: all 0.3s ease;
}

/* ==========================================================================
   Global Styles
   ========================================================================== */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #333;
    background-color: #f5f5f5;
}

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

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

/* ==========================================================================
   Bootstrap Overrides
   ========================================================================== */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover,
.btn-primary:focus {
    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);
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.top-bar {
    font-size: 0.85rem;
}

.navbar {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.navbar-brand {
    font-size: 1.5rem;
}

.nav-link {
    color: #333;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
}

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

.cart-badge {
    font-size: 0.65rem;
    padding: 0.25rem 0.4rem;
}

/* Category Navigation */
.category-nav {
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.category-link {
    font-size: 0.9rem;
    transition: var(--transition);
    opacity: 0.9;
}

.category-link:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Product Cards
   ========================================================================== */
.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    height: 100%;
}

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

.product-card .card-img-top {
    height: 200px;
    object-fit: contain;
    padding: 1rem;
    background-color: #f8f9fa;
}

.product-card .card-body {
    padding: 1.25rem;
}

.product-card .product-brand {
    font-size: 0.8rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-card .product-name {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.product-card .original-price {
    font-size: 0.9rem;
    color: #999;
    text-decoration: line-through;
    margin-left: 0.5rem;
}

.product-card .discount-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #dc3545;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.product-card .condition-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: #e9ecef;
    color: #495057;
}

.product-card .condition-badge.new {
    background-color: #d4edda;
    color: #155724;
}

.product-card .condition-badge.refurbished {
    background-color: #fff3cd;
    color: #856404;
}

/* Product Rating */
.product-rating {
    color: #ffc107;
    font-size: 0.9rem;
}

.product-rating .text-muted {
    color: #6c757d !important;
    font-size: 0.8rem;
}

/* ==========================================================================
   Product Detail Page
   ========================================================================== */
.product-gallery {
    position: sticky;
    top: 100px;
}

.product-gallery .main-image {
    width: 100%;
    height: 400px;
    object-fit: contain;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 2rem;
}

.product-gallery .thumbnail-list {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.product-gallery .thumbnail {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.product-gallery .thumbnail:hover,
.product-gallery .thumbnail.active {
    border-color: var(--primary-color);
}

.product-info h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #333;
}

.product-info .price-section {
    margin: 1.5rem 0;
}

.product-info .current-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.product-info .original-price {
    font-size: 1.25rem;
    color: #999;
    text-decoration: line-through;
}

.product-info .savings {
    background: #d4edda;
    color: #155724;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
}

/* Variant Selectors */
.variant-selector {
    margin-bottom: 1.5rem;
}

.variant-selector label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.variant-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.variant-option {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.variant-option:hover {
    border-color: var(--primary-color);
}

.variant-option.selected {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
    color: var(--primary-color);
}

/* Specifications Table */
.specs-table {
    width: 100%;
}

.specs-table th,
.specs-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.specs-table th {
    width: 40%;
    font-weight: 500;
    color: #6c757d;
    background-color: #f8f9fa;
}

.specs-table td {
    font-weight: 500;
}

.spec-group-header {
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    border-radius: 6px;
}

/* ==========================================================================
   Shopping Cart
   ========================================================================== */
.cart-item {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

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

.cart-item .item-name {
    font-weight: 600;
    color: #333;
}

.cart-item .item-price {
    font-weight: 700;
    color: var(--primary-color);
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-selector button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.quantity-selector button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.quantity-selector input {
    width: 50px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
}

/* Cart Summary */
.cart-summary {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    position: sticky;
    top: 100px;
}

.cart-summary h4 {
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.cart-summary .summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.cart-summary .summary-total {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
    margin-top: 1rem;
}

/* ==========================================================================
   Checkout
   ========================================================================== */
.checkout-steps {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.checkout-step {
    display: flex;
    align-items: center;
    color: #6c757d;
}

.checkout-step .step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 0.5rem;
}

.checkout-step.active {
    color: var(--primary-color);
}

.checkout-step.active .step-number {
    background: var(--primary-color);
    color: white;
}

.checkout-step.completed .step-number {
    background: var(--success-color);
    color: white;
}

.checkout-step-divider {
    width: 60px;
    height: 2px;
    background: #e9ecef;
    margin: 0 1rem;
}

/* ==========================================================================
   Forms
   ========================================================================== */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(51, 45, 130, 0.25);
}

.form-label {
    font-weight: 500;
    color: #333;
}

/* ==========================================================================
   Filters Sidebar
   ========================================================================== */
.filter-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.filter-section h6 {
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-option {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
    margin-right: 0.5rem;
}

/* Price Range Slider */
.price-range {
    padding: 0 0.5rem;
}

.price-range input[type="range"] {
    width: 100%;
    accent-color: var(--primary-color);
}

/* ==========================================================================
   Chat Widget
   ========================================================================== */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
}

.chat-toggle {
    width: 56px;
    height: 56px;
    font-size: 1.25rem;
}

.chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    border-radius: 12px;
    overflow: hidden;
}

.chat-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    font-size: 0.7rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.chat-message {
    margin-bottom: 12px;
    display: flex;
}

.chat-message-customer {
    justify-content: flex-end;
}

.chat-message-admin {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-message-customer .chat-bubble {
    border-bottom-right-radius: 4px;
}

.chat-message-admin .chat-bubble {
    border-bottom-left-radius: 4px;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, #4a3db8 100%);
    color: white;
    padding: 4rem 0;
    margin-bottom: 3rem;
}

.hero-section h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-section p {
    font-size: 1.25rem;
    opacity: 0.9;
}

/* ==========================================================================
   Section Headers
   ========================================================================== */
.section-header {
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #333;
}

.section-header .view-all {
    color: var(--primary-color);
    font-weight: 500;
}

/* ==========================================================================
   Trust Badges
   ========================================================================== */
.trust-badges {
    background: white;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.trust-badge {
    text-align: center;
    padding: 1rem;
}

.trust-badge i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.trust-badge h6 {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.trust-badge p {
    font-size: 0.9rem;
    color: #6c757d;
    margin: 0;
}

/* ==========================================================================
   Admin Panel
   ========================================================================== */
.admin-sidebar {
    background: var(--primary-color);
    min-height: 100vh;
    padding-top: 1rem;
}

.admin-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 1.5rem;
    border-radius: 0;
}

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

.admin-sidebar .nav-link i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

.admin-content {
    padding: 2rem;
    background: #f5f5f5;
    min-height: 100vh;
}

.admin-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: none;
    box-shadow: var(--shadow-sm);
}

.admin-card h5 {
    font-weight: 600;
    margin-bottom: 1rem;
}

.stat-card {
    text-align: center;
}

.stat-card .stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
}

.stat-card .stat-label {
    color: #6c757d;
    font-size: 0.9rem;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */
@media (max-width: 991.98px) {
    .hero-section {
        padding: 2rem 0;
    }

    .hero-section h1 {
        font-size: 1.75rem;
    }

    .product-gallery .main-image {
        height: 300px;
    }
}

@media (max-width: 767.98px) {
    .product-card .card-img-top {
        height: 150px;
    }

    .chat-window {
        width: calc(100vw - 40px);
        right: -10px;
    }

    .cart-item {
        padding: 1rem;
    }

    .cart-item img {
        width: 80px;
        height: 80px;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.hover-lift {
    transition: var(--transition);
}

.hover-lift:hover {
    transform: translateY(-3px);
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #4a3db8 100%);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   Footer
   ========================================================================== */
.footer-link {
    transition: opacity 0.2s ease;
}

.footer-link:hover {
    opacity: 1 !important;
    color: white !important;
}

/* ==========================================================================
   Product Variations
   ========================================================================== */
.variation-group {
    margin-bottom: 1.5rem;
}

.variation-group label {
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: block;
    color: #333;
}

.variation-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.variation-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.9rem;
}

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

.variation-btn.active {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.variation-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    text-decoration: line-through;
}

.variation-btn.unavailable,
.color-swatch.unavailable {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    position: relative;
    background-color: #f5f5f5 !important;
    border-color: #ddd !important;
    color: #999 !important;
}

.variation-btn.unavailable:hover {
    transform: none !important;
    box-shadow: none !important;
}

.variation-btn.unavailable::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 2px;
    background-color: #bbb;
    transform: rotate(-10deg);
}

.color-swatch.unavailable::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background-color: rgba(0,0,0,0.5);
    transform: rotate(-45deg);
}

/* Tooltip for unavailable options */
.variation-btn.unavailable[title],
.color-swatch.unavailable[title] {
    pointer-events: auto;
    cursor: help;
}

.variation-btn .price-diff {
    font-size: 0.8rem;
    color: #666;
    margin-left: 0.25rem;
}

.variation-btn.active .price-diff {
    color: var(--primary-color);
}

/* Color swatches */
.color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.color-swatch:hover {
    border-color: var(--primary-color);
}

.color-swatch.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary-color);
}

.color-swatch.active::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    text-shadow: 0 0 2px rgba(0,0,0,0.5);
}

/* Stock indicator */
.stock-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.stock-indicator.in-stock {
    color: var(--success-color);
}

.stock-indicator.low-stock {
    color: var(--warning-color);
}

.stock-indicator.out-of-stock {
    color: var(--danger-color);
}

/* Shipping & Guarantee badges */
.product-badges {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.product-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #333;
}

.product-badge i {
    color: var(--success-color);
    font-size: 1.1rem;
}

/* Warranty selector - compact horizontal style */
.warranty-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.warranty-option {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
}

.warranty-option:hover {
    border-color: var(--primary-color);
}

.warranty-option.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

.warranty-option input[type="radio"] {
    accent-color: var(--primary-color);
    margin: 0;
}

.warranty-option .warranty-details {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.warranty-option .warranty-title {
    font-weight: 500;
    font-size: 0.9rem;
    color: #333;
}

.warranty-option .warranty-price {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary-color);
}

/* ==========================================================================
   Wishlist Button
   ========================================================================== */
.wishlist-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #999;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.wishlist-btn:hover {
    color: #dc3545;
    background: white;
    transform: scale(1.1);
}

.wishlist-btn.active {
    color: #dc3545;
    background: white;
}

.wishlist-btn.active i {
    animation: heartBeat 0.3s ease-in-out;
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Wishlist Badge */
.wishlist-badge {
    font-size: 0.65rem;
    padding: 0.25rem 0.4rem;
}
