/* 
========================================
ADAPTIVE RESPONSIVE DESIGN SYSTEM
========================================
Enhanced responsive design framework for all devices
*/

/* ===== RESPONSIVE BREAKPOINTS ===== */
:root {
    /* Responsive breakpoints */
    --breakpoint-xs: 320px;   /* Small phones */
    --breakpoint-sm: 576px;   /* Large phones */
    --breakpoint-md: 768px;   /* Tablets */
    --breakpoint-lg: 992px;   /* Small laptops */
    --breakpoint-xl: 1200px;  /* Large laptops */
    --breakpoint-xxl: 1400px; /* Desktop */
    
    /* Container max-widths */
    --container-sm: 540px;
    --container-md: 720px;
    --container-lg: 960px;
    --container-xl: 1140px;
    --container-xxl: 1320px;
    
    /* Adaptive spacing system */
    --spacing-xxs: clamp(0.125rem, 0.25vw, 0.25rem);
    --spacing-xs: clamp(0.25rem, 0.5vw, 0.5rem);
    --spacing-sm: clamp(0.5rem, 1vw, 0.75rem);
    --spacing-md: clamp(0.75rem, 1.5vw, 1rem);
    --spacing-lg: clamp(1rem, 2vw, 1.5rem);
    --spacing-xl: clamp(1.5rem, 3vw, 2rem);
    --spacing-xxl: clamp(2rem, 4vw, 3rem);
    
    /* Adaptive font sizes */
    --text-xxs: clamp(0.625rem, 1.2vw, 0.75rem);
    --text-xs: clamp(0.75rem, 1.5vw, 0.875rem);
    --text-sm: clamp(0.875rem, 2vw, 1rem);
    --text-base: clamp(1rem, 2.5vw, 1.125rem);
    --text-lg: clamp(1.125rem, 3vw, 1.25rem);
    --text-xl: clamp(1.25rem, 3.5vw, 1.5rem);
    --text-2xl: clamp(1.5rem, 4vw, 2rem);
    --text-3xl: clamp(2rem, 5vw, 2.5rem);
    --text-4xl: clamp(2.5rem, 6vw, 3rem);
    
    /* Adaptive border radius */
    --radius-xs: clamp(3px, 0.5vw, 6px);
    --radius-sm: clamp(6px, 1vw, 8px);
    --radius-md: clamp(8px, 1.5vw, 12px);
    --radius-lg: clamp(12px, 2vw, 16px);
    --radius-xl: clamp(16px, 2.5vw, 20px);
    
    /* Adaptive shadows */
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.10);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.15);
}

/* ===== RESPONSIVE CONTAINER SYSTEM ===== */
.container {
    width: 100%;
    margin: 0 auto;
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
}

.container-fluid {
    width: 100%;
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
}

/* Container responsive sizes */
@media (min-width: 576px) {
    .container {
        max-width: var(--container-sm);
        padding-left: var(--spacing-lg);
        padding-right: var(--spacing-lg);
    }
}

@media (min-width: 768px) {
    .container {
        max-width: var(--container-md);
        padding-left: var(--spacing-xl);
        padding-right: var(--spacing-xl);
    }
}

@media (min-width: 992px) {
    .container {
        max-width: var(--container-lg);
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: var(--container-xl);
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: var(--container-xxl);
    }
}

/* ===== RESPONSIVE GRID SYSTEM ===== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: calc(var(--spacing-md) * -0.5);
    margin-right: calc(var(--spacing-md) * -0.5);
}

.col {
    flex: 1 0 0%;
    padding-left: calc(var(--spacing-md) * 0.5);
    padding-right: calc(var(--spacing-md) * 0.5);
}

/* Responsive columns */
.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-11 { flex: 0 0 91.66667%; max-width: 91.66667%; }
.col-10 { flex: 0 0 83.33333%; max-width: 83.33333%; }
.col-9 { flex: 0 0 75%; max-width: 75%; }
.col-8 { flex: 0 0 66.66667%; max-width: 66.66667%; }
.col-7 { flex: 0 0 58.33333%; max-width: 58.33333%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-5 { flex: 0 0 41.66667%; max-width: 41.66667%; }
.col-4 { flex: 0 0 33.33333%; max-width: 33.33333%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-2 { flex: 0 0 16.66667%; max-width: 16.66667%; }
.col-1 { flex: 0 0 8.33333%; max-width: 8.33333%; }

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .col-sm-12 { flex: 0 0 100%; max-width: 100%; }
    .col-sm-11 { flex: 0 0 91.66667%; max-width: 91.66667%; }
    .col-sm-10 { flex: 0 0 83.33333%; max-width: 83.33333%; }
    .col-sm-9 { flex: 0 0 75%; max-width: 75%; }
    .col-sm-8 { flex: 0 0 66.66667%; max-width: 66.66667%; }
    .col-sm-7 { flex: 0 0 58.33333%; max-width: 58.33333%; }
    .col-sm-6 { flex: 0 0 50%; max-width: 50%; }
    .col-sm-5 { flex: 0 0 41.66667%; max-width: 41.66667%; }
    .col-sm-4 { flex: 0 0 33.33333%; max-width: 33.33333%; }
    .col-sm-3 { flex: 0 0 25%; max-width: 25%; }
    .col-sm-2 { flex: 0 0 16.66667%; max-width: 16.66667%; }
    .col-sm-1 { flex: 0 0 8.33333%; max-width: 8.33333%; }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .col-md-12 { flex: 0 0 100%; max-width: 100%; }
    .col-md-11 { flex: 0 0 91.66667%; max-width: 91.66667%; }
    .col-md-10 { flex: 0 0 83.33333%; max-width: 83.33333%; }
    .col-md-9 { flex: 0 0 75%; max-width: 75%; }
    .col-md-8 { flex: 0 0 66.66667%; max-width: 66.66667%; }
    .col-md-7 { flex: 0 0 58.33333%; max-width: 58.33333%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-5 { flex: 0 0 41.66667%; max-width: 41.66667%; }
    .col-md-4 { flex: 0 0 33.33333%; max-width: 33.33333%; }
    .col-md-3 { flex: 0 0 25%; max-width: 25%; }
    .col-md-2 { flex: 0 0 16.66667%; max-width: 16.66667%; }
    .col-md-1 { flex: 0 0 8.33333%; max-width: 8.33333%; }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .col-lg-12 { flex: 0 0 100%; max-width: 100%; }
    .col-lg-11 { flex: 0 0 91.66667%; max-width: 91.66667%; }
    .col-lg-10 { flex: 0 0 83.33333%; max-width: 83.33333%; }
    .col-lg-9 { flex: 0 0 75%; max-width: 75%; }
    .col-lg-8 { flex: 0 0 66.66667%; max-width: 66.66667%; }
    .col-lg-7 { flex: 0 0 58.33333%; max-width: 58.33333%; }
    .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
    .col-lg-5 { flex: 0 0 41.66667%; max-width: 41.66667%; }
    .col-lg-4 { flex: 0 0 33.33333%; max-width: 33.33333%; }
    .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
    .col-lg-2 { flex: 0 0 16.66667%; max-width: 16.66667%; }
    .col-lg-1 { flex: 0 0 8.33333%; max-width: 8.33333%; }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .col-xl-12 { flex: 0 0 100%; max-width: 100%; }
    .col-xl-11 { flex: 0 0 91.66667%; max-width: 91.66667%; }
    .col-xl-10 { flex: 0 0 83.33333%; max-width: 83.33333%; }
    .col-xl-9 { flex: 0 0 75%; max-width: 75%; }
    .col-xl-8 { flex: 0 0 66.66667%; max-width: 66.66667%; }
    .col-xl-7 { flex: 0 0 58.33333%; max-width: 58.33333%; }
    .col-xl-6 { flex: 0 0 50%; max-width: 50%; }
    .col-xl-5 { flex: 0 0 41.66667%; max-width: 41.66667%; }
    .col-xl-4 { flex: 0 0 33.33333%; max-width: 33.33333%; }
    .col-xl-3 { flex: 0 0 25%; max-width: 25%; }
    .col-xl-2 { flex: 0 0 16.66667%; max-width: 16.66667%; }
    .col-xl-1 { flex: 0 0 8.33333%; max-width: 8.33333%; }
}

/* ===== ADAPTIVE NAVIGATION ===== */
.navbar {
    background: var(--card-bg);
    box-shadow: var(--shadow-md);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: var(--spacing-sm) 0;
    transition: var(--transition);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--container-xl);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--text-lg);
    font-weight: 700;
}

.nav-menu {
    display: flex;
    gap: var(--spacing-lg);
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-size: var(--text-sm);
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

/* Mobile Navigation */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: var(--text-xl);
    color: var(--text-color);
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

.mobile-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    box-shadow: var(--shadow-lg);
    border-top: 1px solid var(--border-color);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-menu.active {
    max-height: 500px;
}

.mobile-menu .nav-menu {
    flex-direction: column;
    gap: 0;
    padding: var(--spacing-md);
}

.mobile-menu .nav-link {
    width: 100%;
    text-align: center;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    margin: 0;
}

/* Compact Mobile Navigation (Small Phones) */
@media (max-width: 430px) {
    .navbar {
        padding: var(--spacing-xs) 0;
    }
    
    .nav-container {
        min-height: 48px;
        padding: 0 var(--spacing-xs);
    }
    
    .nav-logo {
        gap: var(--spacing-xs);
        font-size: var(--text-base);
    }
    
    .nav-toggle {
        padding: var(--spacing-xs);
        font-size: var(--text-lg);
    }
    
    .mobile-menu .nav-link {
        padding: var(--spacing-sm);
        font-size: var(--text-sm);
    }
}

/* ===== RESPONSIVE GRID LAYOUTS ===== */
.grid {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Products Grid - Adaptive */
.products-grid {
    display: grid;
    gap: var(--spacing-lg);
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.sales-grid {
    display: grid;
    gap: var(--spacing-lg);
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* ===== RESPONSIVE CARDS ===== */
.card,
.product-card,
.sale-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card:hover,
.product-card:hover,
.sale-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

/* Mobile Card Optimizations */
@media (max-width: 430px) {
    .card,
    .product-card,
    .sale-card {
        border-radius: var(--radius-sm);
        box-shadow: var(--shadow-xs);
        margin-bottom: var(--spacing-xs);
        min-height: auto;
    }
    
    .card-header,
    .product-card-header,
    .sale-card-header {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: var(--text-xs);
    }
    
    .card-body,
    .product-card-body,
    .sale-card-body {
        padding: var(--spacing-sm);
        gap: var(--spacing-xs);
    }
    
    .card-title,
    .product-card-title,
    .sale-card-title {
        font-size: var(--text-sm);
        margin-bottom: var(--spacing-xs);
        line-height: 1.2;
        font-weight: 600;
    }
    
    .card-subtitle,
    .product-card-subtitle,
    .sale-card-subtitle {
        font-size: var(--text-xs);
        margin-bottom: var(--spacing-xs);
        opacity: 0.8;
    }
    
    .card-text,
    .product-card-text,
    .sale-card-text {
        font-size: var(--text-xs);
        line-height: 1.3;
        margin-bottom: var(--spacing-xs);
    }
    
    .card-image,
    .product-card-image,
    .sale-card-image {
        height: clamp(100px, 20vw, 140px);
        object-fit: cover;
        border-radius: 0;
    }
    
    .card-footer,
    .product-card-footer,
    .sale-card-footer {
        padding: var(--spacing-xs) var(--spacing-sm);
        border-top: 1px solid var(--border-color);
    }
    
    .card-price,
    .product-card-price,
    .sale-card-price {
        font-size: var(--text-sm);
        font-weight: 700;
    }
    
    .card-actions,
    .product-card-actions,
    .sale-card-actions {
        gap: var(--spacing-xs);
        flex-wrap: wrap;
    }
    
    .card-btn,
    .product-card-btn,
    .sale-card-btn {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: var(--text-xs);
        min-height: 32px;
        flex: 1;
        min-width: 80px;
    }
}

/* Tablet Card Optimizations */
@media (min-width: 431px) and (max-width: 767px) {
    .card,
    .product-card,
    .sale-card {
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
    }
    
    .card-body,
    .product-card-body,
    .sale-card-body {
        padding: var(--spacing-md);
    }
    
    .card-image,
    .product-card-image,
    .sale-card-image {
        height: clamp(140px, 25vw, 170px);
    }
}

/* ===== RESPONSIVE FORMS ===== */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-control,
input,
textarea,
select {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: var(--text-base);
    transition: var(--transition);
    box-sizing: border-box;
}

.form-control:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

/* ===== RESPONSIVE BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    min-height: 44px; /* Touch-friendly minimum */
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.btn-secondary {
    background: var(--light-accent);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-sm {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--text-sm);
    min-height: 36px;
}

.btn-lg {
    padding: var(--spacing-lg) var(--spacing-xl);
    font-size: var(--text-lg);
    min-height: 52px;
}

/* ===== RESPONSIVE TYPOGRAPHY ===== */
h1, .h1 { font-size: var(--text-4xl); }
h2, .h2 { font-size: var(--text-3xl); }
h3, .h3 { font-size: var(--text-2xl); }
h4, .h4 { font-size: var(--text-xl); }
h5, .h5 { font-size: var(--text-lg); }
h6, .h6 { font-size: var(--text-base); }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }

/* ===== RESPONSIVE BREAKPOINT UTILITIES ===== */

/* Hide/Show at different breakpoints */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }

@media (max-width: 575px) {
    .d-xs-none { display: none !important; }
    .d-xs-block { display: block !important; }
    .d-xs-flex { display: flex !important; }
}

@media (min-width: 576px) {
    .d-sm-none { display: none !important; }
    .d-sm-block { display: block !important; }
    .d-sm-flex { display: flex !important; }
}

@media (min-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
    .d-md-flex { display: flex !important; }
}

@media (min-width: 992px) {
    .d-lg-none { display: none !important; }
    .d-lg-block { display: block !important; }
    .d-lg-flex { display: flex !important; }
}

@media (min-width: 1200px) {
    .d-xl-none { display: none !important; }
    .d-xl-block { display: block !important; }
    .d-xl-flex { display: flex !important; }
}

/* ===== DEVICE SPECIFIC OPTIMIZATIONS ===== */

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575px) {
    /* Minimize Navigation Bar */
    .navbar {
        padding: var(--spacing-xs) 0;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .nav-container {
        padding: 0 var(--spacing-sm);
        min-height: 50px;
    }
    
    .nav-logo {
        gap: var(--spacing-xs);
    }
    
    .nav-logo-text {
        font-size: clamp(1rem, 4vw, 1.2rem);
    }
    
    .nav-menu {
        display: none;
    }
    
    .nav-toggle {
        display: block;
        padding: var(--spacing-xs);
        font-size: clamp(1.2rem, 5vw, 1.5rem);
    }
    
    /* Minimize Cards */
    .card,
    .product-card,
    .sale-card {
        margin-bottom: var(--spacing-sm);
        border-radius: var(--radius-sm);
        box-shadow: var(--shadow-sm);
    }
    
    .card-body,
    .product-card-body,
    .sale-card-body {
        padding: var(--spacing-sm);
    }
    
    .card-title,
    .product-card-title,
    .sale-card-title {
        font-size: var(--text-sm);
        margin-bottom: var(--spacing-xs);
        line-height: 1.3;
    }
    
    .card-text,
    .product-card-text,
    .sale-card-text {
        font-size: var(--text-xs);
        line-height: 1.4;
    }
    
    .card-image,
    .product-card-image,
    .sale-card-image {
        height: clamp(120px, 25vw, 160px);
        object-fit: cover;
    }
    
    /* Grid Optimizations */
    .products-grid,
    .sales-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    /* Content Spacing */
    .container {
        padding-left: var(--spacing-sm);
        padding-right: var(--spacing-sm);
    }
    
    .row {
        margin-left: calc(var(--spacing-sm) * -0.5);
        margin-right: calc(var(--spacing-sm) * -0.5);
    }
    
    .col {
        padding-left: calc(var(--spacing-sm) * 0.5);
        padding-right: calc(var(--spacing-sm) * 0.5);
    }
    
    /* Button Optimizations */
    .btn {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: var(--text-sm);
        min-height: 42px;
    }
    
    .btn-sm {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: var(--text-xs);
        min-height: 36px;
    }
    
    /* Text Size Optimizations */
    h1, .h1 { font-size: clamp(1.5rem, 6vw, 2rem); }
    h2, .h2 { font-size: clamp(1.3rem, 5vw, 1.75rem); }
    h3, .h3 { font-size: clamp(1.1rem, 4vw, 1.5rem); }
    h4, .h4 { font-size: clamp(1rem, 3.5vw, 1.25rem); }
    h5, .h5 { font-size: var(--text-sm); }
    h6, .h6 { font-size: var(--text-xs); }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767px) {
    /* Navigation Optimizations */
    .navbar {
        padding: var(--spacing-sm) 0;
    }
    
    .nav-container {
        padding: 0 var(--spacing-md);
        min-height: 55px;
    }
    
    .nav-logo-text {
        font-size: clamp(1.1rem, 3.5vw, 1.3rem);
    }
    
    .nav-link {
        font-size: var(--text-xs);
        padding: var(--spacing-xs) var(--spacing-sm);
    }
    
    /* Card Optimizations for Large Phones */
    .card,
    .product-card,
    .sale-card {
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
    }
    
    .card-body,
    .product-card-body,
    .sale-card-body {
        padding: var(--spacing-md);
    }
    
    .card-title,
    .product-card-title,
    .sale-card-title {
        font-size: var(--text-base);
        margin-bottom: var(--spacing-sm);
    }
    
    .card-image,
    .product-card-image,
    .sale-card-image {
        height: clamp(140px, 30vw, 180px);
    }
    
    /* Grid Layout for Large Phones */
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: var(--spacing-md);
    }
    
    .sales-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: var(--spacing-md);
    }
    
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }
    
    /* Typography for Large Phones */
    h1, .h1 { font-size: clamp(1.7rem, 5vw, 2.2rem); }
    h2, .h2 { font-size: clamp(1.5rem, 4.5vw, 1.9rem); }
    h3, .h3 { font-size: clamp(1.3rem, 4vw, 1.6rem); }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .sales-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .nav-menu {
        gap: var(--spacing-md);
    }
    
    .nav-link {
        font-size: var(--text-xs);
        padding: var(--spacing-xs) var(--spacing-sm);
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .sales-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

/* ===== TOUCH AND INTERACTION OPTIMIZATIONS ===== */

/* Touch-friendly sizes */
@media (pointer: coarse) {
    .btn {
        min-height: 48px;
        padding: var(--spacing-md) var(--spacing-lg);
    }
    
    .nav-link {
        min-height: 44px;
        padding: var(--spacing-md);
    }
    
    .form-control,
    input,
    textarea,
    select {
        min-height: 44px;
        padding: var(--spacing-md);
    }
    
    /* Mobile-specific touch targets */
    .card,
    .product-card,
    .sale-card {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    .nav-toggle {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Enhanced mobile touch optimizations */
@media (max-width: 575px) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: var(--text-sm);
    }
    
    .btn-sm {
        min-height: 36px;
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: var(--text-xs);
    }
    
    .nav-link {
        min-height: 48px;
        padding: var(--spacing-md) var(--spacing-lg);
        font-size: var(--text-base);
    }
    
    .card-btn,
    .product-card-btn,
    .sale-card-btn {
        min-height: 40px;
        padding: var(--spacing-sm);
        font-size: var(--text-sm);
        touch-action: manipulation;
    }
}

/* Hover effects only for devices that support hover */
@media (hover: hover) {
    .card:hover,
    .product-card:hover,
    .sale-card:hover {
        transform: translateY(-4px);
    }
    
    .btn:hover {
        transform: translateY(-2px);
    }
    
    .nav-link:hover {
        transform: translateY(-1px);
    }
}

/* Mobile-first grid improvements */
@media (max-width: 575px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
        padding: var(--spacing-sm);
    }
    
    .sales-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
        padding: var(--spacing-sm);
    }
    
    /* Two-column layout for slightly larger content on mobile */
    .products-grid.mobile-two-col {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-xs);
    }
    
    .sales-grid.mobile-two-col {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-xs);
    }
    
    .mobile-two-col .card,
    .mobile-two-col .product-card,
    .mobile-two-col .sale-card {
        min-height: auto;
    }
    
    .mobile-two-col .card-title,
    .mobile-two-col .product-card-title,
    .mobile-two-col .sale-card-title {
        font-size: var(--text-xs);
        line-height: 1.1;
    }
    
    .mobile-two-col .card-text,
    .mobile-two-col .product-card-text,
    .mobile-two-col .sale-card-text {
        font-size: var(--text-xxs);
        line-height: 1.2;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .navbar,
    .nav-menu,
    .btn,
    .mobile-menu {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .card,
    .product-card {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        break-inside: avoid;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */

/* Focus indicators */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast support */
@media (prefers-contrast: high) {
    .card,
    .product-card,
    .sale-card {
        border: 2px solid var(--text-color);
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* ===== UTILITY CLASSES ===== */

/* Spacing utilities */
.m-0 { margin: 0 !important; }
.m-1 { margin: var(--spacing-xs) !important; }
.m-2 { margin: var(--spacing-sm) !important; }
.m-3 { margin: var(--spacing-md) !important; }
.m-4 { margin: var(--spacing-lg) !important; }
.m-5 { margin: var(--spacing-xl) !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: var(--spacing-xs) !important; }
.p-2 { padding: var(--spacing-sm) !important; }
.p-3 { padding: var(--spacing-md) !important; }
.p-4 { padding: var(--spacing-lg) !important; }
.p-5 { padding: var(--spacing-xl) !important; }

/* Text alignment */
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

/* Ultra-compact styles for very small phones (under 375px) */
@media (max-width: 374px) {
    /* Ultra-compact navigation */
    .navbar {
        padding: var(--spacing-xxs) 0;
    }
    
    .nav-container {
        min-height: 44px;
        padding: 0 var(--spacing-xxs);
    }
    
    .nav-logo {
        font-size: var(--text-sm);
        gap: var(--spacing-xxs);
    }
    
    .nav-toggle {
        padding: var(--spacing-xxs);
        font-size: var(--text-base);
    }
    
    /* Ultra-compact cards */
    .card,
    .product-card,
    .sale-card {
        border-radius: var(--radius-xs);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        margin-bottom: var(--spacing-xxs);
    }
    
    .card-body,
    .product-card-body,
    .sale-card-body {
        padding: var(--spacing-xs);
    }
    
    .card-title,
    .product-card-title,
    .sale-card-title {
        font-size: var(--text-xs);
        margin-bottom: var(--spacing-xxs);
        line-height: 1.1;
    }
    
    .card-text,
    .product-card-text,
    .sale-card-text {
        font-size: var(--text-xxs);
        line-height: 1.2;
        margin-bottom: var(--spacing-xxs);
    }
    
    .card-image,
    .product-card-image,
    .sale-card-image {
        height: clamp(80px, 18vw, 120px);
    }
    
    .card-btn,
    .product-card-btn,
    .sale-card-btn {
        padding: var(--spacing-xxs) var(--spacing-xs);
        font-size: var(--text-xxs);
        min-height: 28px;
    }
    
    /* Ultra-compact grid */
    .products-grid,
    .sales-grid {
        gap: var(--spacing-xxs);
    }
    
    /* Ultra-compact spacing */
    .container {
        padding-left: var(--spacing-xxs);
        padding-right: var(--spacing-xxs);
    }
    
    /* Ultra-compact typography */
    h1, .h1 { font-size: clamp(1.2rem, 5vw, 1.5rem); }
    h2, .h2 { font-size: clamp(1.1rem, 4.5vw, 1.3rem); }
    h3, .h3 { font-size: clamp(1rem, 4vw, 1.2rem); }
    h4, .h4 { font-size: var(--text-sm); }
    h5, .h5 { font-size: var(--text-xs); }
    h6, .h6 { font-size: var(--text-xxs); }
}

/* Text utilities */
.text-xxs { font-size: var(--text-xxs); }

/* Flexbox utilities */
.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.justify-content-start { justify-content: flex-start !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-center { align-items: center !important; }
.align-items-end { align-items: flex-end !important; }

/* Width utilities */
.w-25 { width: 25% !important; }
.w-50 { width: 50% !important; }
.w-75 { width: 75% !important; }
.w-100 { width: 100% !important; }
.w-auto { width: auto !important; }
