/* Products Page Styles - v20251222a */

/* Page Layout */
.products-page {
    padding: 24px 32px;
    max-width: 1400px;
}

/* Page Header */
.products-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.products-header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.products-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--ai-text-dark);
    margin: 0;
    letter-spacing: -0.02em;
}

.products-subtitle {
    font-size: 14px;
    color: var(--ai-text-muted);
    margin: 0;
}

.products-header-right {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    font-family: var(--ai-font);
}

.btn-primary {
    background: var(--ai-primary);
    color: #fff;
}

.btn-primary:hover {
    background: #6b00b3;
}

.btn-secondary {
    background: var(--ai-bg-white);
    color: var(--ai-text-medium);
    border: 1px solid var(--ai-border);
}

.btn-secondary:hover {
    background: var(--ai-bg-main);
}

.btn-danger {
    background: #DC2626;
    color: #fff;
}

.btn-danger:hover {
    background: #B91C1C;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    padding: 8px;
    background: transparent;
    border: 1px solid var(--ai-border);
    border-radius: 6px;
}

.btn-icon:hover {
    background: var(--ai-bg-main);
}

/* Stats Cards */
.products-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.products-stat-card {
    background: var(--ai-bg-white);
    border: 1px solid var(--ai-border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.products-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.products-stat-icon--blue {
    background: var(--ai-blue-light);
    color: var(--ai-blue);
}

.products-stat-icon--green {
    background: var(--ai-green-light);
    color: var(--ai-green);
}

.products-stat-icon--orange {
    background: var(--ai-orange-light);
    color: var(--ai-orange);
}

.products-stat-icon--purple {
    background: var(--ai-purple-light);
    color: var(--ai-purple);
}

.products-stat-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.products-stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--ai-text-dark);
    line-height: 1.2;
}

.products-stat-label {
    font-size: 14px;
    color: var(--ai-text-muted);
}

/* Toolbar */
.products-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 16px;
}

.products-filters {
    display: flex;
    gap: 12px;
}

.products-filter-select {
    padding: 8px 32px 8px 12px;
    font-size: 14px;
    border: 1px solid var(--ai-border);
    border-radius: 8px;
    background: var(--ai-bg-white);
    color: var(--ai-text-medium);
    cursor: pointer;
    font-family: var(--ai-font);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236A7282' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.products-filter-select:focus {
    outline: none;
    border-color: var(--ai-primary);
}

.products-search {
    position: relative;
    flex: 1;
    max-width: 320px;
}

.products-search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    font-size: 14px;
    border: 1px solid var(--ai-border);
    border-radius: 8px;
    background: var(--ai-bg-white);
    font-family: var(--ai-font);
}

.products-search-input:focus {
    outline: none;
    border-color: var(--ai-primary);
}

.products-search-input::placeholder {
    color: var(--ai-text-muted);
}

.products-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ai-text-muted);
    pointer-events: none;
}

/* Table Container */
.products-table-container {
    background: var(--ai-bg-white);
    border: 1px solid var(--ai-border);
    border-radius: 12px;
    overflow: hidden;
}

/* Table */
.products-table {
    width: 100%;
    border-collapse: collapse;
}

.products-table thead {
    background: var(--ai-bg-main);
    border-bottom: 1px solid var(--ai-border);
}

.products-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 500;
    color: var(--ai-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.products-table tbody tr {
    border-bottom: 1px solid var(--ai-border);
    transition: background 0.15s ease;
}

.products-table tbody tr:last-child {
    border-bottom: none;
}

.products-table tbody tr:hover {
    background: var(--ai-bg-main);
}

.products-table td {
    padding: 16px;
    font-size: 14px;
    color: var(--ai-text-medium);
    vertical-align: middle;
}

.products-th-checkbox,
.products-td-checkbox {
    width: 48px;
    text-align: center;
}

.products-th-product {
    min-width: 250px;
}

.products-th-sku {
    width: 140px;
}

.products-th-category {
    width: 120px;
}

.products-th-price {
    width: 100px;
}

.products-th-inventory {
    width: 100px;
}

.products-th-status {
    width: 100px;
}

.products-th-actions {
    width: 100px;
    text-align: right;
}

/* Product Cell */
.product-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.product-image {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--ai-bg-main);
    border: 1px solid var(--ai-border);
}

.product-image-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--ai-bg-main);
    border: 1px solid var(--ai-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ai-text-muted);
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.product-name {
    font-weight: 500;
    color: var(--ai-text-dark);
}

.product-description {
    font-size: 13px;
    color: var(--ai-text-muted);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* SKU Cell */
.product-sku {
    font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;
    font-size: 13px;
    color: var(--ai-text-muted);
}

/* Category Badge */
.category-badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.category-badge--food {
    background: #FEF3C7;
    color: #D97706;
}

.category-badge--drink {
    background: #DBEAFE;
    color: #2563EB;
}

.category-badge--service {
    background: #F3E8FF;
    color: #9333EA;
}

.category-badge--retail {
    background: #DCFCE7;
    color: #16A34A;
}

.category-badge--digital {
    background: #E0E7FF;
    color: #4F46E5;
}

/* Price */
.product-price {
    font-weight: 500;
    color: var(--ai-text-dark);
}

.product-compare-price {
    font-size: 12px;
    color: var(--ai-text-muted);
    text-decoration: line-through;
}

/* Inventory */
.inventory-count {
    font-weight: 500;
}

.inventory-count--low {
    color: var(--ai-orange);
}

.inventory-count--out {
    color: #DC2626;
}

.inventory-unlimited {
    color: var(--ai-text-muted);
    font-style: italic;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge--available {
    background: var(--ai-green-light);
    color: var(--ai-green);
}

.status-badge--unavailable {
    background: #FEE2E2;
    color: #DC2626;
}

.status-badge--low-stock {
    background: var(--ai-orange-light);
    color: var(--ai-orange);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Actions */
.product-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.action-btn {
    padding: 6px;
    background: transparent;
    border: 1px solid var(--ai-border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--ai-text-muted);
    transition: all 0.15s ease;
}

.action-btn:hover {
    background: var(--ai-bg-main);
    color: var(--ai-text-dark);
}

.action-btn--danger:hover {
    background: #FEE2E2;
    color: #DC2626;
    border-color: #FCA5A5;
}

/* Empty State */
.products-empty-state {
    padding: 64px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.products-empty-state svg {
    color: var(--ai-text-muted);
    opacity: 0.5;
}

.products-empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--ai-text-dark);
    margin: 0;
}

.products-empty-state p {
    font-size: 14px;
    color: var(--ai-text-muted);
    margin: 0;
}

/* Loading State */
.products-loading {
    padding: 64px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

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

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

.products-loading p {
    font-size: 14px;
    color: var(--ai-text-muted);
    margin: 0;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--ai-bg-white);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.2s ease;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--ai-border);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--ai-text-dark);
    margin: 0;
}

.modal-close {
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: var(--ai-text-muted);
    transition: all 0.15s ease;
}

.modal-close:hover {
    background: var(--ai-bg-main);
    color: var(--ai-text-dark);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--ai-border);
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--ai-text-dark);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--ai-border);
    border-radius: 8px;
    background: var(--ai-bg-white);
    font-family: var(--ai-font);
    transition: border-color 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--ai-primary);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--ai-text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--ai-text-medium);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 1200px) {
    .products-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .products-page {
        padding: 16px;
    }

    .products-header {
        flex-direction: column;
        gap: 16px;
    }

    .products-stats {
        grid-template-columns: 1fr;
    }

    .products-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .products-search {
        max-width: none;
    }

    .products-table-container {
        overflow-x: auto;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal {
        margin: 16px;
        max-height: calc(100vh - 32px);
    }
}
