/* Restaurant Products Manager - Frontend Styles */

/* Container and Layout */
.rpm-container {
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Header Styles */
.rpm-header {
    background: #f8f9fa;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.rpm-header h2 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

/* Filters Section */
.rpm-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: end;
}

.rpm-filter-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.rpm-filter-group label {
    font-weight: 500;
    margin-bottom: 5px;
    color: #555;
    font-size: 14px;
}

.rpm-filter-group select,
.rpm-filter-group input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.rpm-filter-group select:focus,
.rpm-filter-group input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.rpm-search-focused {
    border-color: #0073aa !important;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1) !important;
}

/* Loading States */
.rpm-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

.rpm-loading-state {
    opacity: 0.6;
    pointer-events: none;
}

/* Table Styles */
.rpm-table-container {
    overflow-x: auto;
    margin: 0;
}

.rpm-table-container.rpm-scrollable {
    border-left: 3px solid #0073aa;
}

.rpm-products-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: #fff;
    min-width: 800px;
}

.rpm-products-table th {
    background: #f1f1f1;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #ddd;
    white-space: nowrap;
}

.rpm-products-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.rpm-products-table tr:hover {
    background-color: #f9f9f9;
}

/* Product Row Styles */
.rpm-product-row {
    background: #fff;
}

.rpm-variation-row {
    background: #fafafa;
}

.rpm-variation-row td {
    border-left: 4px solid #e0e0e0;
}

.rpm-indent {
    padding-left: 25px;
    position: relative;
}

.rpm-indent::before {
    content: "└─";
    position: absolute;
    left: 8px;
    color: #999;
    font-size: 12px;
}

/* Product Image */
.rpm-products-table img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

/* Product Name and Links */
.rpm-products-table a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.rpm-products-table a:hover {
    text-decoration: underline;
    color: #005177;
}

.rpm-variation-attributes {
    color: #666;
    font-style: italic;
    margin-top: 4px;
    display: block;
}

/* Stock Input Container */
.rpm-stock-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rpm-stock-input {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.rpm-stock-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.rpm-stock-input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.rpm-invalid-input {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.1) !important;
}

/* Status Icons */
.rpm-stock-status {
    display: inline-flex;
    align-items: center;
    min-width: 20px;
    min-height: 20px;
}

.rpm-success-icon,
.rpm-error-icon,
.rpm-loading-icon {
    font-size: 16px;
    display: inline-block;
}

.rpm-success-icon {
    animation: fadeInScale 0.3s ease-out;
}

.rpm-error-icon {
    cursor: help;
    animation: shake 0.5s ease-in-out;
}

.rpm-loading-icon {
    animation: pulse 1s infinite;
}

/* Edit Link */
.rpm-edit-link {
    display: inline-block;
    padding: 4px 8px;
    background: #f0f0f0;
    border-radius: 3px;
    font-size: 12px;
    color: #666 !important;
    text-decoration: none !important;
    transition: background-color 0.2s;
}

.rpm-edit-link:hover {
    background: #e0e0e0;
    color: #333 !important;
}

/* Pagination */
.rpm-pagination {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.rpm-pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.rpm-page-btn {
    padding: 8px 16px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.rpm-page-btn:hover {
    background: #005177;
}

.rpm-page-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.rpm-page-info {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* Notifications */
.rpm-notification {
    padding: 12px 20px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-size: 14px;
    animation: slideDown 0.3s ease-out;
}

.rpm-notification-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.rpm-notification-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.rpm-notification-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Error States */
.rpm-error {
    padding: 20px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
}

.rpm-no-products {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px 20px;
}

/* Tooltip */
.rpm-tooltip {
    position: absolute;
    background: #333;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-top: -35px;
    margin-left: -10px;
    opacity: 0.9;
}

.rpm-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

/* Auto-save Indicator */
.rpm-auto-save-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
}

/* Animations */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .rpm-container {
        margin: 10px 0;
        border-radius: 0;
    }

    .rpm-header {
        padding: 15px;
    }

    .rpm-header h2 {
        font-size: 20px;
    }

    .rpm-filters {
        flex-direction: column;
        gap: 10px;
    }

    .rpm-filter-group {
        min-width: 100%;
    }

    .rpm-products-table {
        font-size: 14px;
    }

    .rpm-products-table th,
    .rpm-products-table td {
        padding: 8px 6px;
    }

    .rpm-products-table img {
        width: 40px;
        height: 40px;
    }

    .rpm-stock-input {
        width: 60px;
        font-size: 12px;
    }

    .rpm-indent {
        padding-left: 15px;
    }

    .rpm-pagination {
        padding: 15px;
    }

    .rpm-pagination-container {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .rpm-products-table th:nth-child(3),
    .rpm-products-table td:nth-child(3),
    .rpm-products-table th:nth-child(4),
    .rpm-products-table td:nth-child(4) {
        display: none;
    }

    .rpm-products-table th,
    .rpm-products-table td {
        padding: 6px 4px;
        font-size: 12px;
    }

    .rpm-auto-save-indicator {
        bottom: 10px;
        right: 10px;
        font-size: 11px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .rpm-products-table {
        border: 2px solid #000;
    }

    .rpm-products-table th {
        background: #000;
        color: #fff;
        border: 1px solid #fff;
    }

    .rpm-products-table td {
        border: 1px solid #000;
    }

    .rpm-stock-input:focus {
        border-color: #000;
        box-shadow: 0 0 0 3px #000;
    }
}

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

/* Print Styles */
@media print {
    .rpm-filters,
    .rpm-pagination,
    .rpm-stock-status,
    .rpm-edit-link {
        display: none !important;
    }

    .rpm-container {
        box-shadow: none;
        border: 1px solid #000;
    }

    .rpm-products-table {
        border-collapse: collapse;
    }

    .rpm-products-table th,
    .rpm-products-table td {
        border: 1px solid #000;
        padding: 8px;
    }
}