/* 
 * Premium Saudi E-commerce UI/UX Overlay
 * Adds modern aesthetics, glassmorphism, soft shadows, and Tajawal font.
 * 
 */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

/* Typography Override */
body, h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, p, span, a, div, button, input {
    font-family: 'Tajawal', sans-serif !important;
}
p, span, div, li {
    line-height: 1.6 !important; /* مسافات أسطر مريحة للغة العربية */
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    line-height: 1.4 !important;
}

/* Base Variable Overrides for Premium Look */
:root {
    --soft-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    --hover-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: 1px solid rgba(255, 255, 255, 0.18);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --primary-gradient: linear-gradient(135deg, var(--primary) 0%, var(--hov-primary) 100%);
}

/* ========================================================
   1. Product Card Enhancements (.aiz-card-box)
======================================================== */
.aiz-card-box {
    border-radius: var(--radius-lg);
    border: 1px solid #f0f0f0 !important;
    box-shadow: var(--soft-shadow);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    overflow: hidden;
    background-color: #ffffff;
    padding-bottom: 8px; /* تحسين المساحات البيضاء السفلية للبطاقة */
}

.aiz-card-box:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
    border-color: transparent !important;
}

/* Image wrapper radius */
.aiz-card-box .img-fit {
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}

/* Discount & Labels Badges */
.aiz-card-box span.absolute-top-left {
    border-radius: 8px !important;
    font-weight: 700;
    padding: 4px 8px !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    backdrop-filter: blur(4px);
}

/* Action Icons (Wishlist, Compare) Hover effect */
.aiz-p-hov-icon a, .aiz-p-hov-icon-mobile a {
    background: var(--glass-bg);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    backdrop-filter: blur(8px);
    transition: all 0.2s ease-in-out;
}

.aiz-p-hov-icon a:hover, .aiz-p-hov-icon-mobile a:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.aiz-p-hov-icon a:hover svg path, .aiz-p-hov-icon-mobile a:hover svg path {
    fill: #ffffff !important;
}

/* Add to Cart Desktop Button */
.aiz-card-box .cart-btn {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
    background: var(--primary-gradient) !important;
    border: none;
    height: 44px !important; /* Touch target minimum */
    transition: opacity 0.3s ease;
}

/* ========================================================
   2. Buttons & Inputs
======================================================== */
.btn-primary {
    background: var(--primary-gradient) !important;
    border: none !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 4px 15px var(--soft-primary) !important;
    transition: all 0.3s ease !important;
    font-weight: 700 !important;
    padding: 10px 24px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--soft-primary) !important;
    filter: brightness(1.1);
}

.form-control {
    border-radius: var(--radius-sm) !important;
    border: 1px solid #e0e0e0 !important;
    padding: 12px 16px !important;
    transition: all 0.2s ease !important;
}

.form-control:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px var(--soft-primary) !important;
}

/* ========================================================
   3. Modals & Glassmorphism
======================================================== */
.modal-content {
    border-radius: var(--radius-lg) !important;
    border: none !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
}

/* Cart / Side Menus */
.aiz-custom-alert, .aiz-cookie-alert {
    border-radius: var(--radius-md) !important;
    overflow: hidden;
}

/* ========================================================
   4. Mobile Optimizations (The Saudi Context)
======================================================== */
@media (max-width: 768px) {
    /* Make product cards smaller on mobile to fit 2 per row nicely */
    .aiz-card-box {
        border-radius: var(--radius-md);
    }
    
    .aiz-card-box .img-fit {
        border-top-left-radius: var(--radius-md);
        border-top-right-radius: var(--radius-md);
    }

    /* Sticky Add to Cart Bar on Product Detail Page */
    .sticky-mobile-cart {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--glass-bg);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        padding: 12px 16px;
        box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
        z-index: 1040; /* Above regular content, below modals */
        border-top: var(--glass-border);
        display: flex;
        align-items: center;
        gap: 12px;
    }
    
    .sticky-mobile-cart .btn-primary {
        flex: 1;
        margin: 0 !important;
    }
    
    /* Ensure body has padding at bottom so sticky cart doesn't overlap content */
    .product-details-mobile-padding {
        padding-bottom: 90px !important;
    }
}

/* ========================================================
   5. Cart & Checkout Restyling (Clean & Spacious)
======================================================== */
#cart-details .bg-white, #cart_summary .bg-white, .checkout-section .bg-white {
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--soft-shadow) !important;
    border: 1px solid #f5f5f5 !important;
    padding: 24px !important;
}

/* Cart Item Rows */
#cart-details .list-group-item {
    border: none !important;
    border-bottom: 1px solid #f0f0f0 !important;
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
}
#cart-details .list-group-item:last-child {
    border-bottom: none !important;
}

/* Make image in cart slightly rounded */
#cart-details .img-fit {
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

/* Summary Box Sticky */
@media (min-width: 992px) {
    #cart_summary {
        position: sticky;
        top: 90px;
    }
}

/* Form controls in Checkout */
.checkout-section .form-control {
    background-color: #f9f9fb !important;
    border: 1px solid #eaeaea !important;
    border-radius: var(--radius-md) !important;
}

.checkout-section .form-control:focus {
    background-color: #ffffff !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px var(--soft-primary) !important;
}

/* Custom Checkbox/Radio styling for Checkout */
.aiz-radio .aiz-rounded-check {
    border-radius: 50% !important;
    border: 2px solid #ccc;
    transition: all 0.2s ease;
}
.aiz-radio input:checked ~ .aiz-rounded-check {
    border-color: var(--primary);
    background-color: var(--primary);
}

/* ========================================================
   6. Dashboards (User & Seller) Restyling
======================================================== */
.aiz-user-panel .card, .aiz-main-content .card {
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--soft-shadow) !important;
    border: 1px solid #f9f9f9 !important;
    overflow: hidden;
    margin-bottom: 24px;
}

.aiz-user-panel .card-header, .aiz-main-content .card-header {
    background-color: transparent !important;
    border-bottom: 1px solid #f0f0f0 !important;
    padding-top: 20px !important;
    padding-bottom: 20px !important;
}

/* Sidebar Styling */
.aiz-user-sidenav {
    background: #ffffff !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--soft-shadow) !important;
    border: 1px solid #f5f5f5 !important;
}

.aiz-side-nav-link {
    border-radius: var(--radius-sm) !important;
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

.aiz-side-nav-link:hover, .aiz-side-nav-link.active {
    background-color: #f8f9fc !important;
    color: var(--primary) !important;
    padding-inline-start: 20px !important;
}

/* Table Styling for Purchase History etc */
.aiz-user-panel .table, .aiz-main-content .table {
    border-collapse: separate;
    border-spacing: 0 10px;
    background: transparent !important;
}

.aiz-user-panel .table tr, .aiz-main-content .table tr {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    border-radius: var(--radius-sm);
    transition: transform 0.2s ease;
}

.aiz-user-panel .table tr:hover, .aiz-main-content .table tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.aiz-user-panel .table th, .aiz-user-panel .table td,
.aiz-main-content .table th, .aiz-main-content .table td {
    border: none !important;
    padding: 16px 20px !important;
    vertical-align: middle;
}

/* Stat Cards in Dashboard */
.aiz-user-panel .bg-grad-1, .aiz-user-panel .bg-grad-2, .aiz-user-panel .bg-grad-3, .aiz-user-panel .bg-grad-4 {
    border-radius: var(--radius-lg) !important;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1) !important;
    border: none !important;
    transition: transform 0.3s ease;
}

.aiz-user-panel .bg-grad-1:hover, .aiz-user-panel .bg-grad-2:hover, .aiz-user-panel .bg-grad-3:hover, .aiz-user-panel .bg-grad-4:hover {
    transform: translateY(-5px);
}

/* ========================================================
   7. PWA Install Prompt
======================================================== */
.pwa-prompt {
    position: fixed;
    bottom: -150px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.5);
    padding: 20px;
    z-index: 1050;
    transition: bottom 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.pwa-prompt.show-prompt {
    bottom: 20px;
}

.pwa-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
