/**
 * ERP Items Display Styles
 */

:root {
    --erp-theme-color: #007bff;
    --erp-theme-color-dark: #0056b3;
}

.erp-items-container {
    display: flex;
    gap: 30px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    align-items: flex-start;
    min-height: 500px;
    box-sizing: border-box;
}

/* Sidebar Styles */
.erp-items-sidebar {
    flex: 0 0 280px;
    flex-shrink: 0;
    width: 280px;
    max-width: 100%;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    max-height: 800px;
    overflow-y: auto;
    position: sticky;
    top: 20px;
    box-sizing: border-box;
}

.erp-items-sidebar-title {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.erp-items-categories {
    min-height: 100px;
}

.erp-items-category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.erp-items-category-item {
    margin-bottom: 5px;
}

.erp-items-category-link {
    display: block;
    padding: 12px 15px;
    color: #555;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 15px;
    border-left: 3px solid transparent;
}

.erp-items-category-link:hover {
    background: #e9ecef;
    color: var(--erp-theme-color);
    border-left-color: var(--erp-theme-color);
}

.erp-items-category-link.active {
    background: var(--erp-theme-color);
    color: #fff;
    border-left-color: var(--erp-theme-color-dark);
    font-weight: 500;
}

.erp-items-subcategory-list {
    list-style: none;
    margin: 5px 0 0 0;
    padding-left: 20px;
}

.erp-items-subcategory-list .erp-items-category-link {
    font-size: 14px;
    padding: 10px 15px;
}

/* Content Area Styles */
.erp-items-content {
    flex: 1;
    min-width: 850px; /* Width for 3 items (3 × 250px) + 2 gaps (2 × 25px) + padding */
    width: 100%;
    min-height: 400px;
    max-width: 100%;
}

.erp-items-header {
    margin-bottom: 25px;
}

.erp-items-title {
    margin: 0 0 20px 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.erp-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
    margin-top: 20px;
    min-height: 200px;
    width: 100%;
    min-width: 100%;
}

/* Ensure grid maintains 3-column layout minimum */
.erp-items-grid:empty::before {
    content: '';
    display: block;
    width: 100%;
    min-height: 200px;
}

/* Maintain grid structure when showing messages */
.erp-items-grid:has(.erp-items-message),
.erp-items-grid:has(.erp-items-error),
.erp-items-grid:has(.erp-items-loading) {
    grid-template-columns: 1fr;
}

/* Item Card Styles */
.erp-items-item-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.erp-items-item-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.erp-items-item-image {
    width: 100%;
    height: 200px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.erp-items-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.erp-items-item-placeholder {
    color: #999;
    font-size: 14px;
}

.erp-items-item-content {
    padding: 20px;
}

.erp-items-item-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

.erp-items-item-description {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.erp-items-item-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--erp-theme-color);
    margin-bottom: 10px;
}

.erp-items-item-code {
    font-size: 12px;
    color: #999;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

/* Loading and Message Styles */
.erp-items-loading,
.erp-items-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
    width: 100%;
    grid-column: 1 / -1;
}

.erp-items-error {
    text-align: center;
    padding: 40px 20px;
    color: #dc3545;
    font-size: 16px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    width: 100%;
    grid-column: 1 / -1;
}

/* Pagination Styles */
.erp-items-pagination {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.erp-items-pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.erp-items-pagination-btn {
    padding: 10px 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: #555;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.erp-items-pagination-btn:hover:not(:disabled) {
    background: var(--erp-theme-color);
    color: #fff;
    border-color: var(--erp-theme-color);
}

.erp-items-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.erp-items-pagination-numbers {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.erp-items-pagination-number {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: #555;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.erp-items-pagination-number:hover {
    background: #f8f9fa;
    border-color: var(--erp-theme-color);
    color: var(--erp-theme-color);
}

.erp-items-pagination-number.active {
    background: var(--erp-theme-color);
    color: #fff;
    border-color: var(--erp-theme-color);
    font-weight: 600;
    cursor: default;
}

.erp-items-pagination-number.active:hover {
    background: var(--erp-theme-color);
    color: #fff;
}

.erp-items-pagination-dots {
    padding: 0 5px;
    color: #999;
    font-size: 14px;
}

.erp-items-pagination-info {
    width: 100%;
    text-align: center;
    margin-top: 15px;
    color: #666;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .erp-items-content {
        min-width: 600px; /* 2-3 items on smaller desktops */
    }
    
    .erp-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width: 1024px) {
    .erp-items-container {
        gap: 20px;
        padding: 15px;
    }
    
    .erp-items-sidebar {
        flex: 0 0 240px;
        width: 240px;
    }
    
    .erp-items-content {
        min-width: 500px; /* 2 items on tablets */
    }
    
    .erp-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 900px) {
    .erp-items-content {
        min-width: 400px; /* Allow 2 items */
    }
}

@media (max-width: 768px) {
    .erp-items-container {
        flex-direction: column;
        padding: 15px;
        gap: 20px;
    }
    
    .erp-items-sidebar {
        flex: 1;
        width: 100%;
        max-width: 100%;
        max-height: 300px;
        position: relative;
        top: 0;
        flex-shrink: 1;
    }
    
    .erp-items-content {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }
    
    .erp-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .erp-items-title {
        font-size: 20px;
    }
}

@media (max-width: 640px) {
    .erp-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .erp-items-item-image {
        height: 180px;
    }
    
    .erp-items-title {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .erp-items-container {
        padding: 10px;
        gap: 15px;
    }
    
    .erp-items-sidebar {
        padding: 15px;
        max-height: 250px;
    }
    
    .erp-items-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .erp-items-item-image {
        height: 180px;
    }
    
    .erp-items-item-content {
        padding: 15px;
    }
    
    .erp-items-pagination-wrapper {
        flex-direction: column;
        gap: 8px;
    }
    
    .erp-items-pagination-numbers {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .erp-items-pagination-number {
        min-width: 35px;
        height: 35px;
        padding: 0 8px;
        font-size: 13px;
    }
    
    .erp-items-pagination-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .erp-items-title {
        font-size: 18px;
        margin-bottom: 15px;
    }
}

/* Scrollbar Styling for Sidebar */
.erp-items-sidebar::-webkit-scrollbar {
    width: 8px;
}

.erp-items-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.erp-items-sidebar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.erp-items-sidebar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Item Card Clickable Styles */
.erp-items-item-card {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.erp-items-item-card:hover {
    transform: translateY(-4px);
}

.erp-items-view-details {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    color: var(--erp-theme-color);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.erp-items-item-card:hover .erp-items-view-details {
    color: var(--erp-theme-color-dark);
}

/* Modal Styles */
.erp-items-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.erp-items-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.erp-items-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.erp-items-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    z-index: 10001;
}

.erp-items-modal.active .erp-items-modal-content {
    transform: scale(1);
}

.erp-items-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10002;
}

.erp-items-modal-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

.erp-items-modal-body {
    padding: 30px;
}

.erp-items-modal-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.erp-items-modal-details {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.erp-items-modal-image {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
}

.erp-items-modal-image img {
    width: 100%;
    height: auto;
    display: block;
}

.erp-items-modal-info {
    flex: 1;
}

.erp-items-modal-title {
    margin: 0 0 15px 0;
    font-size: 28px;
    font-weight: 700;
    color: #333;
    line-height: 1.3;
}

.erp-items-modal-code {
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.erp-items-modal-code strong {
    color: #333;
    margin-right: 5px;
}

.erp-items-modal-price {
    font-size: 32px;
    font-weight: 700;
    color: var(--erp-theme-color);
    margin-bottom: 15px;
}

.erp-items-modal-category {
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    display: inline-block;
}

.erp-items-modal-category strong {
    color: #333;
    margin-right: 5px;
}

.erp-items-modal-description {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid #e0e0e0;
}

.erp-items-modal-description h3 {
    margin: 0 0 15px 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.erp-items-modal-description-content {
    font-size: 16px;
    line-height: 1.8;
    color: #555;
}

.erp-items-modal-description-content p {
    margin-bottom: 15px;
}

.erp-items-modal-description-content p:last-child {
    margin-bottom: 0;
}

.erp-items-modal-description-content ol,
.erp-items-modal-description-content ul {
    margin: 15px 0;
    padding-left: 30px;
}

.erp-items-modal-description-content li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.erp-items-modal-description-content li:last-child {
    margin-bottom: 0;
}

.erp-items-modal-description-content strong {
    font-weight: 600;
    color: #333;
}

.erp-items-modal-description-content div {
    margin-bottom: 15px;
}

.erp-items-modal-description-content div:last-child {
    margin-bottom: 0;
}

.erp-items-modal-description-content br {
    line-height: 1.8;
}

/* Responsive Modal */
@media (max-width: 768px) {
    .erp-items-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .erp-items-modal-body {
        padding: 20px;
    }
    
    .erp-items-modal-title {
        font-size: 24px;
    }
    
    .erp-items-modal-price {
        font-size: 28px;
    }
    
    .erp-items-modal-details {
        gap: 20px;
    }
}

