/**
 * Products Page Responsive Styles
 * Optimized for mobile, tablet, and desktop
 */

/* ── Summary Cards ──────────────────────────────────────────── */
.summary-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.summary-card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.summary-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    flex-shrink: 0;
    stroke-width: 2;
}

.summary-card-icon svg {
    width: 24px;
    height: 24px;
}

/* Color Variants */
.summary-card-primary .summary-card-icon {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.summary-card-success .summary-card-icon {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.summary-card-warning .summary-card-icon {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.summary-card-accent .summary-card-icon {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent);
}

.summary-card-content {
    flex: 1;
    min-width: 0;
}

.summary-card-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-card-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    word-break: break-word;
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .summary-card {
        padding: 1rem;
        gap: 0.75rem;
    }

    .summary-card-icon {
        width: 44px;
        height: 44px;
    }

    .summary-card-icon svg {
        width: 20px;
        height: 20px;
    }

    .summary-card-value {
        font-size: 0.9rem;
    }
}

/* Responsive - Tablet Portrait */
@media (max-width: 768px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .summary-card {
        padding: 1rem;
        gap: 0.75rem;
    }

    .summary-card-icon {
        width: 40px;
        height: 40px;
    }

    .summary-card-icon svg {
        width: 18px;
        height: 18px;
    }

    .summary-card-label {
        font-size: 0.75rem;
    }

    .summary-card-value {
        font-size: 0.85rem;
    }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
    .grid-4 {
        grid-template-columns: 1fr !important;
    }

    .summary-card {
        padding: 0.875rem;
        gap: 0.75rem;
    }

    .summary-card-icon {
        width: 38px;
        height: 38px;
    }

    .summary-card-icon svg {
        width: 16px;
        height: 16px;
    }

    .summary-card-label {
        font-size: 0.7rem;
        margin-bottom: 0.2rem;
    }

    .summary-card-value {
        font-size: 0.85rem;
    }
}

/* ── Table Footer Totals ───────────────────────────────────── */
.table-footer-totals {
    background: linear-gradient(135deg, var(--bg-raised) 0%, var(--bg-hover) 100%);
    border-top: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
    font-weight: 600;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.table-footer-totals td {
    padding: 14px 10px !important;
    vertical-align: middle;
}

.table-footer-label {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.9rem;
    text-align: left;
    display: flex;
    align-items: center;
}

.table-footer-value {
    text-align: left;
}

.footer-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    display: block;
}

.footer-number {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.footer-total .footer-number {
    color: var(--success);
    font-size: 1.05rem;
    font-weight: 800;
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .table-footer-totals {
        border-top: 1px solid var(--primary);
    }

    .table-footer-totals td {
        padding: 12px 8px !important;
    }

    .footer-label {
        font-size: 0.65rem;
    }

    .footer-number {
        font-size: 0.85rem;
    }

    .footer-total .footer-number {
        font-size: 0.95rem;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .table-footer-totals {
        border-top: 1px dashed var(--primary);
    }

    .table-footer-totals td {
        padding: 10px 6px !important;
        font-size: 0.8rem;
    }

    .footer-label {
        font-size: 0.6rem;
    }

    .footer-number {
        font-size: 0.8rem;
    }
}
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .products-table-wrapper table {
        font-size: 0.85rem;
    }
    
    .products-table-wrapper th,
    .products-table-wrapper td {
        padding: 0.5rem;
    }
    
    .products-table-wrapper .badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

@media (max-width: 480px) {
    .products-table-wrapper table {
        font-size: 0.75rem;
    }
    
    .products-table-wrapper th,
    .products-table-wrapper td {
        padding: 0.4rem 0.3rem;
    }
    
    .products-table-wrapper .badge {
        font-size: 0.65rem;
        padding: 0.15rem 0.3rem;
    }
}

/* Products Grid/Card View */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

@media (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 0.875rem;
    }
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
}

/* Product Card */
.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    transition: all 0.2s;
}

@media (max-width: 768px) {
    .product-card {
        padding: 0.75rem;
    }
    
    .product-card h4 {
        font-size: 0.9rem !important;
    }
    
    .product-card > div {
        font-size: 0.8rem !important;
    }
}

@media (max-width: 480px) {
    .product-card {
        padding: 0.5rem;
        border-radius: var(--radius-sm);
    }
    
    .product-card h4 {
        font-size: 0.85rem !important;
        line-height: 1.2;
        max-height: 2.4em;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .product-card > div {
        font-size: 0.75rem !important;
    }
    
    .product-card img {
        max-height: 100px;
    }
}

/* Page Header with Actions */
.products-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .products-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .products-page-header > div:last-child {
        width: 100%;
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .products-page-header .btn {
        flex: 1;
        min-width: 100px;
    }
}

@media (max-width: 480px) {
    .products-page-header h1 {
        font-size: 1.25rem;
    }
    
    .products-page-header .btn {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }
}

/* Search and Filter Bar */
.products-filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .products-filter-bar {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .products-filter-bar input,
    .products-filter-bar select {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .products-filter-bar {
        gap: 0.5rem;
    }
    
    .products-filter-bar input,
    .products-filter-bar select {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

@media (max-width: 768px) {
    .pagination {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .pagination {
        gap: 0.5rem;
    }
    
    .pagination a,
    .pagination span {
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
    }
}

/* Form Layout for Create/Edit */
.product-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 768px) {
    .product-form-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .product-form-grid {
        gap: 0.5rem;
    }
    
    .product-form-grid .form-control {
        font-size: 0.9rem;
        padding: 0.6rem 0.8rem;
    }
    
    .product-form-grid label {
        font-size: 0.85rem;
    }
}

/* Image Upload */
.product-image-upload {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (max-width: 480px) {
    .product-image-upload img {
        max-width: 100%;
        max-height: 150px;
    }
}

/* Stock Badge */
.stock-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

@media (max-width: 480px) {
    .stock-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

/* Compact Table for Mobile */
@media (max-width: 480px) {
    .products-table-wrapper .hide-mobile {
        display: none;
    }
}

/* Action Buttons in Table */
.table-actions {
    display: flex;
    gap: 0.25rem;
}

@media (max-width: 768px) {
    .table-actions {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .table-actions .btn {
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
    }
}

/* Empty State */
.products-empty-state {
    text-align: center;
    padding: 3rem;
}

@media (max-width: 768px) {
    .products-empty-state {
        padding: 2rem;
    }
    
    .products-empty-state svg {
        width: 48px;
        height: 48px;
    }
    
    .products-empty-state h3 {
        font-size: 1rem;
    }
    
    .products-empty-state p {
        font-size: 0.85rem;
    }
}

/* Bulk Actions Bar */
.products-bulk-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

@media (max-width: 768px) {
    .products-bulk-actions {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .products-bulk-actions {
        width: 100%;
    }
    
    .products-bulk-actions .btn {
        width: 100%;
    }
}
