/**
 * Main Stylesheet - Enhanced Professional Design
 * Multi-Vendor E-commerce Platform
 */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

/* Enhanced Root Variables */
:root {
    /* Primary Colors */
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --primary-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);

    /* Secondary Colors */
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;

    /* Background Colors */
    --light-color: #f8fafc;
    --white-color: #ffffff;
    --dark-color: #1e293b;
    --black-color: #000000;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* Typography */
    --font-family-primary: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-secondary: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    /* Spacing & Layout */
    --border-radius-sm: 6px;
    --border-radius: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;
    --border-radius-2xl: 24px;

    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

    /* Transitions */
    --transition-fast: all 0.15s ease;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-index */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--dark-color);
    background-color: var(--white-color);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

/* Text Clarity Improvements */
body, .btn, .nav-link, .dropdown-item {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Header Text Clarity */
.main-header .btn,
.main-header .btn span,
.main-header .btn i {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-display: swap;
}

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

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

a:hover {
    color: #0056b3;
}

/* Buttons */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.85rem;
    line-height: 1.3;
}

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

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
    transform: translateY(-1px);
}

.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);
    transform: translateY(-1px);
}

/* Cards */
.card {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.125);
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Forms */
.form-control {
    border-radius: var(--border-radius);
    border: 1px solid #ced4da;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Header Styles */
.top-bar {
    font-size: 0.875rem;
}

.main-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    background-color: var(--white-color) !important;
}

/* Header Button Improvements */
.main-header .btn {
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    border-width: 1px;
    min-height: 38px;
    transition: all 0.2s ease;
    border-radius: 0.375rem;
}

.main-header .btn span {
    font-size: 0.9rem !important;
    font-weight: 500 !important;
}

.main-header .btn i {
    font-size: 0.85rem !important;
}

.main-header .btn-outline-primary {
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    background-color: transparent !important;
}

.main-header .btn-outline-primary:hover {
    background-color: var(--primary-color) !important;
    color: white !important;
}

.main-header .btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
}

.main-header .btn-outline-success {
    color: #198754 !important;
    border-color: #198754 !important;
    background-color: transparent !important;
}

.main-header .btn-outline-success:hover {
    background-color: #198754 !important;
    color: white !important;
}

/* Logo Improvements */
.logo-icon {
    flex-shrink: 0;
}

.logo-text h4,
.logo-text h6 {
    line-height: 1.2;
    margin: 0;
}

/* Cart Badge */
.main-header .badge {
    font-size: 0.65rem !important;
    min-width: 18px;
    height: 18px;
    line-height: 16px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* User Actions Container */
.user-actions {
    gap: 0.5rem;
}

.user-actions .btn {
    white-space: nowrap;
    text-decoration: none;
}

/* Responsive Text Display */
@media (max-width: 991px) {
    .main-header .d-none.d-lg-inline {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .main-header .btn span {
        display: inline !important;
    }
}

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

.search-form .form-control {
    border-right: none;
}

.search-form .btn {
    border-left: none;
    border-color: #ced4da;
}

/* Navigation */
.navbar {
    padding: 0.5rem 0;
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: var(--transition);
    font-size: 0.95rem;
    color: #495057;
}

.navbar-nav .nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.1);
    border-radius: 4px;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Product Card Enhancements */
.product-card {
    position: relative;
    overflow: hidden;
}

.product-card .card-img-top {
    transition: transform 0.3s ease;
}

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

.product-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 10;
}

/* Category Cards */
.category-card {
    text-align: center;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    transition: var(--transition);
    background-color: var(--white-color);
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.category-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--light-color);
    font-size: 1.5rem;
    color: var(--primary-color);
}

/* Vendor Cards */
.vendor-card {
    transition: var(--transition);
}

.vendor-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.vendor-logo {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--light-color);
}

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

.rating-stars .fa-star,
.rating-stars .fa-star-half-alt {
    color: #ffc107;
}

.rating-stars .fa-star.text-muted {
    color: #e9ecef !important;
}

/* Price Display */
.price-current {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.price-original {
    font-size: 1rem;
    color: var(--secondary-color);
    text-decoration: line-through;
}

.price-discount {
    font-size: 0.875rem;
    color: var(--success-color);
    font-weight: 600;
}

/* Badges */
.badge {
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-featured {
    background-color: var(--warning-color);
    color: var(--dark-color);
}

.badge-sale {
    background-color: var(--danger-color);
}

.badge-new {
    background-color: var(--success-color);
}

/* Pagination */
.pagination .page-link {
    color: var(--primary-color);
    border-color: #dee2e6;
    transition: var(--transition);
}

.pagination .page-link:hover {
    color: #0056b3;
    background-color: var(--light-color);
    border-color: #dee2e6;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Breadcrumb */
.breadcrumb {
    background-color: transparent;
    padding: 0.75rem 0;
    margin-bottom: 1rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    color: var(--secondary-color);
}

/* Alerts */
.alert {
    border-radius: var(--border-radius);
    border: none;
    font-weight: 500;
}

/* Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Utilities */
.hover-shadow {
    transition: box-shadow 0.3s ease;
}

.hover-shadow:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

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

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

/* Enhanced Responsive Design */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding-left: 20px;
        padding-right: 20px;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1.25rem;
    }
}

@media (max-width: 992px) {
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }

    .sidebar {
        margin-bottom: 2rem;
    }

    .table-responsive {
        border-radius: var(--border-radius);
        box-shadow: var(--box-shadow);
    }

    /* Tablet optimizations */
    .main-header .container .row {
        flex-direction: column;
        text-align: center;
    }

    .main-header .col-6,
    .main-header .col-md-3,
    .main-header .col-md-6 {
        width: 100%;
        max-width: 100%;
        margin-bottom: 1rem;
    }

    .search-form {
        max-width: 500px;
        margin: 0 auto;
    }

    .user-actions {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    /* Layout adjustments */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .category-card {
        padding: 0.75rem;
        text-align: center;
    }

    .category-icon {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    /* Header improvements */
    .top-bar {
        display: none !important;
    }

    .main-header {
        padding: 0.5rem 0;
    }

    .main-header .container {
        padding: 0 15px;
    }

    .main-header .row {
        margin: 0;
        align-items: center;
    }

    .main-header .col-6,
    .main-header .col-md-3,
    .main-header .col-md-6 {
        padding: 0.25rem;
    }

    .main-header .py-2,
    .main-header .py-md-3 {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }

    .logo {
        max-height: 35px;
    }

    .search-form {
        margin: 0.75rem 0;
    }

    /* Ensure buttons stay in same row */
    .main-header .col-6:last-child {
        display: flex;
        align-items: center;
    }

    .search-form .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }

    .user-actions {
        justify-content: flex-end;
        gap: 0.25rem;
        flex-wrap: nowrap;
    }

    .main-header .btn {
        font-size: 0.8rem !important;
        font-weight: 500 !important;
        min-height: 36px;
        padding: 0.4rem 0.6rem !important;
        white-space: nowrap;
    }

    .main-header .btn span {
        font-size: 0.8rem !important;
        font-weight: 500 !important;
        display: inline !important;
    }

    .main-header .btn i {
        font-size: 0.75rem !important;
    }

    /* Logo adjustments for mobile */
    .logo-icon {
        width: 35px !important;
        height: 35px !important;
        font-size: 1rem !important;
    }

    .logo-text h6 {
        font-size: 0.85rem !important;
    }

    .user-actions {
        gap: 0.5rem !important;
    }

    .user-actions .dropdown-toggle::after {
        display: none;
    }

    /* Mobile Navigation */
    .navbar {
        padding: 0.5rem 0;
    }

    .navbar-toggler {
        border: none;
        padding: 0.25rem 0.5rem;
    }

    .navbar-collapse {
        background: white;
        padding: 1rem;
        border-radius: var(--border-radius);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        margin-top: 0.5rem;
        border: 1px solid #e9ecef;
    }

    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #f8f9fa;
        font-weight: 500;
        font-size: 0.95rem;
        color: #495057 !important;
    }

    .navbar-nav .nav-link:last-child {
        border-bottom: none;
    }

    .navbar-nav .nav-link:hover {
        background-color: #f8f9fa;
        color: var(--primary-color) !important;
    }

    /* Mobile Cards */
    .card {
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    .card-header {
        padding: 0.75rem;
        font-size: 0.9rem;
        font-weight: 600;
    }

    .card-body {
        padding: 0.75rem;
    }

    /* Mobile Tables */
    .table-responsive {
        font-size: 0.8rem;
        border-radius: 8px;
        overflow: hidden;
    }

    .table td, .table th {
        padding: 0.5rem 0.25rem;
        vertical-align: middle;
        font-size: 0.8rem;
    }

    .table th {
        background-color: #f8f9fa;
        font-weight: 600;
    }

    /* Mobile Buttons */
    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
        gap: 0.25rem;
    }

    .btn-group .btn {
        border-radius: var(--border-radius) !important;
        margin: 0;
    }

    /* Mobile Forms */
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }

    .form-floating {
        margin-bottom: 1rem;
    }

    .form-floating .form-control {
        padding: 1rem 0.75rem;
    }

    .input-group {
        flex-wrap: nowrap;
    }

    .input-group .form-control {
        border-radius: var(--border-radius) 0 0 var(--border-radius) !important;
    }

    .input-group .btn {
        border-radius: 0 var(--border-radius) var(--border-radius) 0 !important;
        padding: 0.75rem 1rem;
    }

    /* Mobile specific utilities */
    .d-mobile-block {
        display: block !important;
    }

    .d-mobile-none {
        display: none !important;
    }
}

@media (max-width: 576px) {
    /* Extra Small Mobile Layout */
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .row {
        margin-left: -5px;
        margin-right: -5px;
    }

    .col, [class*="col-"] {
        padding-left: 5px;
        padding-right: 5px;
    }

    /* Product Grid for Small Screens */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    /* Header improvements for small screens */
    .main-header .container {
        padding: 0 10px;
    }

    .main-header .btn {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.85rem !important;
        min-height: 36px;
        font-weight: 500 !important;
    }

    .main-header .btn span {
        font-size: 0.85rem !important;
        display: inline !important;
    }

    .main-header .btn i {
        font-size: 0.8rem !important;
    }

    .logo {
        max-height: 30px;
    }

    .search-form .form-control {
        font-size: 16px;
        padding: 0.6rem;
    }

    .navbar-nav .nav-link {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }

    /* Ensure all header text is visible on small screens */
    .main-header .btn span {
        display: inline !important;
    }

    .main-header .d-none.d-lg-inline {
        display: inline !important;
    }

    /* Typography adjustments */
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    /* Button optimizations */
    .btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
        min-height: 44px; /* Touch target size */
    }

    .btn-lg {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }

    .btn-sm {
        font-size: 0.75rem;
        padding: 0.375rem 0.5rem;
        min-height: 36px;
    }

    /* Card optimizations */
    .card {
        border-radius: 8px;
    }

    .card-body {
        padding: 0.5rem;
    }

    .card-header {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    /* Header for small screens */
    .main-header {
        padding: 0.5rem 0;
    }

    .main-header .container {
        padding: 0 8px;
    }

    .logo {
        max-height: 32px;
    }

    .navbar-brand h4 {
        font-size: 1rem;
    }

    /* Search optimizations */
    .search-form .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem 0.5rem;
    }

    .search-form .btn {
        padding: 0.75rem;
        min-width: 50px;
    }

    /* User actions for small screens */
    .user-actions {
        gap: 0.25rem;
    }

    .user-actions .btn {
        padding: 0.5rem;
        min-width: 44px;
    }

    .user-actions .dropdown-menu {
        font-size: 0.85rem;
        min-width: 200px;
    }

    /* Navigation for small screens */
    .navbar-nav .nav-link {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    /* Product Cards for small screens */
    .product-card .card-img-top {
        height: 140px;
        object-fit: cover;
    }

    .product-card .card-title {
        font-size: 0.85rem;
        line-height: 1.3;
        margin-bottom: 0.25rem;
    }

    .product-card .card-text {
        font-size: 0.75rem;
    }

    .price-current {
        font-size: 1rem;
        font-weight: 700;
    }

    .price-original {
        font-size: 0.8rem;
    }

    /* Category cards for small screens */
    .category-card {
        padding: 0.5rem;
    }

    .category-icon {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }

    .category-card h6 {
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
    }

    /* Table optimizations */
    .table-responsive {
        font-size: 0.75rem;
    }

    .table td, .table th {
        padding: 0.375rem 0.25rem;
        font-size: 0.75rem;
    }

    /* Form optimizations */
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem 0.5rem;
    }

    .form-label {
        font-size: 0.85rem;
        font-weight: 600;
    }

    .form-text {
        font-size: 0.75rem;
    }

    /* Modal optimizations */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-header {
        padding: 0.75rem;
    }

    .modal-body {
        padding: 0.75rem;
    }

    .modal-footer {
        padding: 0.5rem 0.75rem;
    }

    /* Alert optimizations */
    .alert {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }

    /* Badge optimizations */
    .badge {
        font-size: 0.65rem;
        padding: 0.25rem 0.5rem;
    }

    /* Pagination for small screens */
    .pagination {
        font-size: 0.8rem;
    }

    .page-link {
        padding: 0.375rem 0.5rem;
    }

    /* Breadcrumb for small screens */
    .breadcrumb {
        font-size: 0.8rem;
        padding: 0.5rem 0;
    }
}

    .product-card .card-title {
        font-size: 0.9rem;
        line-height: 1.3;
    }

    .product-card .card-text {
        font-size: 0.8rem;
    }

    /* Mobile Vendor Cards */
    .vendor-card .vendor-logo {
        width: 60px;
        height: 60px;
    }

    /* Mobile Category Cards */
    .category-card {
        padding: 0.75rem;
    }

    .category-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    /* Mobile Typography */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    h5 { font-size: 1rem; }
    h6 { font-size: 0.9rem; }

    /* Mobile Spacing */
    .py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
    .py-5 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
    .mb-4 { margin-bottom: 1.5rem !important; }
    .mb-5 { margin-bottom: 2rem !important; }

    /* Mobile Modals */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        border-radius: var(--border-radius);
    }

    /* Mobile Alerts */
    .alert {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    /* Mobile Badges */
    .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }

    /* Mobile Pagination */
    .pagination {
        justify-content: center;
    }

    .pagination .page-link {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }

    /* Mobile Breadcrumb */
    .breadcrumb {
        font-size: 0.875rem;
        padding: 0.5rem 0;
    }

    /* Mobile Dropdown */
    .dropdown-menu {
        font-size: 0.9rem;
        border-radius: var(--border-radius);
        box-shadow: var(--box-shadow);
    }

    /* Mobile User Actions */
    .user-actions .btn {
        margin: 0.25rem;
        min-width: 120px;
    }

    /* Mobile Footer */
    .footer {
        padding: 1.5rem 0;
    }

    .footer .col-md-3 {
        margin-bottom: 1.5rem;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Enhanced UI Components */

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

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1055;
}

.toast {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: none;
}

/* Enhanced Buttons */
.btn-gradient {
    background: linear-gradient(45deg, var(--primary-color), #0056b3);
    border: none;
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-gradient:hover::before {
    left: 100%;
}

.btn-floating {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    transition: var(--transition);
}

.btn-floating:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

/* Enhanced Cards */
.card-hover {
    transition: var(--transition);
    cursor: pointer;
}

.card-hover:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

.card-glass {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Enhanced Forms */
.form-floating-enhanced .form-control {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #e9ecef;
    transition: var(--transition);
}

.form-floating-enhanced .form-control:focus {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.1);
    transform: translateY(-2px);
}

/* Enhanced Tables */
.table-enhanced {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.table-enhanced thead th {
    background: linear-gradient(45deg, var(--primary-color), #0056b3);
    color: white;
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.875rem;
}

.table-enhanced tbody tr {
    transition: var(--transition);
}

.table-enhanced tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
    transform: scale(1.01);
}

/* Enhanced Sidebar */
.sidebar-enhanced {
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 0;
    overflow: hidden;
}

.sidebar-enhanced .list-group-item {
    border: none;
    background: transparent;
    transition: var(--transition);
    position: relative;
}

.sidebar-enhanced .list-group-item:hover {
    background: rgba(0, 123, 255, 0.1);
    transform: translateX(5px);
}

.sidebar-enhanced .list-group-item.active {
    background: var(--primary-color);
    color: white;
}

.sidebar-enhanced .list-group-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: white;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
    transition: var(--transition);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --white-color: #1a1a1a;
        --light-color: #2d2d2d;
        --dark-color: #ffffff;
        --secondary-color: #b0b0b0;
    }

    body {
        background-color: var(--white-color);
        color: var(--dark-color);
    }

    .card {
        background-color: var(--light-color);
        border-color: #404040;
    }

    .form-control {
        background-color: var(--light-color);
        border-color: #404040;
        color: var(--dark-color);
    }

    .table {
        color: var(--dark-color);
    }

    .table-striped > tbody > tr:nth-of-type(odd) > td,
    .table-striped > tbody > tr:nth-of-type(odd) > th {
        background-color: rgba(255, 255, 255, 0.05);
    }
}

/* Additional Mobile Optimizations */
@media (max-width: 480px) {
    /* Ultra small screens */
    .container {
        padding-left: 5px;
        padding-right: 5px;
    }

    .product-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.375rem;
    }

    .product-card .card-img-top {
        height: 120px;
    }

    .btn {
        font-size: 0.75rem;
        padding: 0.5rem;
    }

    .main-header {
        padding: 0.375rem 0;
    }

    .logo {
        max-height: 28px;
    }

    .search-form .form-control {
        padding: 0.5rem;
    }

    .main-header .btn {
        padding: 0.3rem 0.4rem !important;
        min-width: 36px;
        font-size: 0.75rem !important;
    }

    .main-header .btn span {
        font-size: 0.75rem !important;
        display: inline !important;
    }

    .main-header .btn i {
        font-size: 0.7rem !important;
    }

    .user-actions {
        gap: 0.2rem !important;
    }

    /* Logo for very small screens */
    .logo-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.9rem !important;
    }

    .logo-text h6 {
        font-size: 0.8rem !important;
    }

    /* Cart badge for small screens */
    .main-header .badge {
        font-size: 0.6rem !important;
        min-width: 16px !important;
        height: 16px !important;
        line-height: 14px !important;
    }

    .btn-floating {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Touch devices */
    .btn, .nav-link, .dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .product-card:hover {
        transform: none;
    }

    .product-card:active {
        transform: scale(0.98);
    }

    .btn:hover {
        transform: none;
    }

    .btn:active {
        transform: scale(0.95);
    }

    .card-hover:hover {
        transform: none;
    }

    .card-hover:active {
        transform: scale(0.98);
    }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .main-header {
        padding: 0.25rem 0;
    }

    .logo {
        max-height: 30px;
    }

    .search-form {
        margin: 0.5rem 0;
    }

    .navbar-collapse {
        max-height: 60vh;
        overflow-y: auto;
    }

    .hero-section {
        min-height: 40vh;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .product-card:hover,
    .btn:hover,
    .card-hover:hover {
        transform: none;
    }
}

/* Print styles */
@media print {
    .navbar,
    .footer,
    .btn-floating,
    .user-actions {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }

    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* English Language Optimizations */
html[dir="ltr"] {
    text-align: left;
}

html[dir="ltr"] .text-end {
    text-align: right !important;
}

html[dir="ltr"] .text-start {
    text-align: left !important;
}

html[dir="ltr"] .me-auto {
    margin-left: auto !important;
    margin-right: 0 !important;
}

html[dir="ltr"] .ms-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

/* Badge positioning for LTR */
html[dir="ltr"] .product-badge {
    right: 15px;
    left: auto;
}

/* Dropdown menu positioning */
html[dir="ltr"] .dropdown-menu-end {
    right: 0;
    left: auto;
}

/* Navigation improvements for English */
html[dir="ltr"] .navbar-nav .nav-link {
    padding-left: 1rem;
    padding-right: 1rem;
}

html[dir="ltr"] .navbar-toggler {
    margin-left: auto;
}

/* Search form improvements */
html[dir="ltr"] .search-form .form-control {
    border-radius: 0.375rem 0 0 0.375rem;
}

html[dir="ltr"] .search-form .btn {
    border-radius: 0 0.375rem 0.375rem 0;
}

/* Product card improvements for English */
html[dir="ltr"] .product-card .card-title {
    text-align: left;
}

html[dir="ltr"] .product-card .price-section {
    text-align: left;
}

/* User actions alignment */
html[dir="ltr"] .user-actions {
    justify-content: flex-end;
}

html[dir="ltr"] .user-actions .dropdown-menu {
    right: 0;
    left: auto;
}

/* Typography improvements for English */
html[dir="ltr"] body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: -0.01em;
}

html[dir="ltr"] h1,
html[dir="ltr"] h2,
html[dir="ltr"] h3,
html[dir="ltr"] h4,
html[dir="ltr"] h5,
html[dir="ltr"] h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

html[dir="ltr"] .display-4 {
    font-weight: 700;
    letter-spacing: -0.03em;
}

/* Button improvements for English */
html[dir="ltr"] .btn {
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* Card improvements */
html[dir="ltr"] .card-body {
    text-align: left;
}

html[dir="ltr"] .card-title {
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Enhanced Mobile optimizations */
@media (max-width: 768px) {
    html[dir="ltr"] .navbar-brand h4,
    html[dir="ltr"] .navbar-brand h5 {
        font-size: 1rem;
        font-weight: 600;
    }

    html[dir="ltr"] .hero-section h1 {
        font-size: 2rem;
        line-height: 1.2;
    }

    html[dir="ltr"] .section-title {
        font-size: 1.75rem;
    }

    /* Enhanced mobile-specific styles */
    .mobile-device .main-header {
        backdrop-filter: blur(10px);
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }

    .mobile-device .product-card {
        border-radius: 12px;
        overflow: hidden;
        transition: transform 0.2s ease;
    }

    .mobile-device .product-card:active {
        transform: scale(0.98);
    }

    .mobile-device .btn:active {
        transform: scale(0.95);
    }

    /* Touch-friendly improvements */
    .mobile-device .btn,
    .mobile-device .nav-link,
    .mobile-device .dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Improved text readability on mobile */
    .mobile-device body {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    /* Enhanced form controls for mobile */
    .mobile-device .form-control {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem 1rem;
        border-radius: 8px;
    }

    .mobile-device .form-control:focus {
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
        border-color: #007bff;
    }

    /* Mobile-optimized animations */
    .mobile-device * {
        animation-duration: 0.3s !important;
        transition-duration: 0.3s !important;
    }

    /* Prevent horizontal scroll */
    .mobile-device {
        overflow-x: hidden;
    }

    /* Enhanced mobile typography */
    .mobile-device h1 { font-size: 1.75rem; line-height: 1.2; }
    .mobile-device h2 { font-size: 1.5rem; line-height: 1.3; }
    .mobile-device h3 { font-size: 1.25rem; line-height: 1.3; }
    .mobile-device h4 { font-size: 1.1rem; line-height: 1.4; }
    .mobile-device h5 { font-size: 1rem; line-height: 1.4; }
    .mobile-device h6 { font-size: 0.9rem; line-height: 1.4; }

    /* Mobile spacing optimizations */
    .mobile-device .py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
    .mobile-device .py-5 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
    .mobile-device .mb-4 { margin-bottom: 1.5rem !important; }
    .mobile-device .mb-5 { margin-bottom: 2rem !important; }
}

/* PWA and performance optimizations */
@media (display-mode: standalone) {
    .main-header {
        padding-top: env(safe-area-inset-top);
    }

    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }

    .card {
        border: 2px solid var(--dark-color);
    }
}

/* Force light mode - Override any dark mode preferences */
@media (max-width: 768px) {
    :root {
        --bg-color: #ffffff !important;
        --text-color: #333333 !important;
        --card-bg: #ffffff !important;
    }

    body {
        background-color: #ffffff !important;
        color: #333333 !important;
    }

    .bg-dark {
        background-color: #f8f9fa !important;
        color: #333333 !important;
    }

    .text-white {
        color: #333333 !important;
    }

    .text-light {
        color: #666666 !important;
    }
}

/* Reduced data mode optimizations */
@media (prefers-reduced-data: reduce) {
    .hero-floating-elements {
        display: none;
    }

    .product-card img {
        loading: lazy;
    }
}
