/* ===== Parts Manager Frontend Styles ===== */

.pm-frontend-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Header */
.pm-grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
    flex-wrap: wrap;
    gap: 15px;
}

.pm-grid-header h3 {
    margin: 0;
    color: #23282d;
    font-size: 1.5rem;
}

.pm-preview-notice {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.pm-count {
    font-size: 0.9rem;
    color: #666;
}

/* Grid Layout - 3 columns */
.pm-parts-grid {
    display: grid;
    /*grid-template-columns: repeat(3, 1fr);*/
	grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

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

@media (max-width: 640px) {
    .pm-parts-grid {
        grid-template-columns: 1fr;
    }
    
    .pm-grid-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Part Card */
.pm-part-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.pm-part-card:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transform: translateY(-3px);
}

/* Image */
.pm-part-image {
    position: relative;
    aspect-ratio: 1;
    background: #f9f9f9;
    overflow: hidden;
}

.pm-part-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
    transition: transform 0.3s;
}

.pm-part-card:hover .pm-part-image img {
    transform: scale(1.05);
}

/* Overlay para usuarios no logueados */
.pm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.pm-part-card:hover .pm-overlay {
    opacity: 1;
}

.pm-overlay-text {
    font-size: 2rem;
    color: #fff;
}

/* Info Section */
.pm-part-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.pm-part-sku {
    margin: 0 0 8px;
    font-size: 0.95rem;
}

.pm-part-sku code {
    background: #f0f0f1;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 0.85rem;
}

.pm-part-description {
    margin: 0 0 12px;
    color: #444;
    font-size: 0.95rem;
    line-height: 1.4;
    flex-grow: 1;
}

.pm-part-meta {
    margin: 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px 10px;
    font-size: 0.85rem;
    color: #666;
}

.pm-part-meta dt {
    font-weight: 600;
}

.pm-part-meta dd {
    margin: 0;
}

/* Actions */
.pm-part-actions {
    padding: 0 15px 15px;
}

.pm-btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s, transform 0.1s;
    width: 100%;
    box-sizing: border-box;
}

.pm-btn:active {
    transform: scale(0.98);
}

.pm-btn-primary {
    background: #0073aa;
    color: #fff;
}

.pm-btn-primary:hover {
    background: #005a87;
}

.pm-btn-login {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.pm-btn-login:hover {
    background: linear-gradient(135deg, #5568d3 0%, #663a99 100%);
}

.pm-btn-large {
    padding: 15px 30px;
    font-size: 1rem;
}

/* Pagination */
.pm-pagination {
    text-align: center;
    margin: 30px 0;
}

.pm-pagination-nav .page-numbers {
    display: inline-flex;
    gap: 5px;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
    justify-content: center;
}

.pm-pagination-nav .page-numbers li {
    margin: 0;
}

.pm-pagination-nav .page-numbers {
    display: flex;
    gap: 5px;
}

.pm-pagination-nav a.page-numbers,
.pm-pagination-nav span.page-numbers {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.pm-pagination-nav a.page-numbers:hover {
    background: #f0f0f1;
    border-color: #999;
}

.pm-pagination-nav .page-numbers.current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
    font-weight: 600;
}

.pm-pagination-nav .page-numbers.dots {
    border: none;
    padding: 0 5px;
    color: #999;
}

/* Load More Wrapper */
.pm-load-more-wrapper {
    text-align: center;
    padding: 30px 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px dashed #ddd;
}

.pm-login-hint {
    margin: 10px 0 0;
    color: #666;
    font-size: 0.9rem;
}

/* No Results */
.pm-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #666;
    background: #f9f9f9;
    border-radius: 8px;
}

/* Loading State */
.pm-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.pm-loading::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: pm-spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes pm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility */
.pm-part-card:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .pm-part-actions,
    .pm-pagination,
    .pm-load-more-wrapper {
        display: none;
    }
    
    .pm-part-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* ===== Notificaciones de Login ===== */

.pm-login-notice {
    text-align: center;
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
    background: #fff;
    color: #fff;
	border: 2px solid #f1730d;
}

.pm-login-notice.pm-notice-top {
    border-left: 5px solid #fff;
    border-right: 5px solid #fff;
}

.pm-login-notice.pm-login-bottom {
    /*border: 2px dashed #fff;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);*/
	border: 2px solid #f1730d;
    background: #fff;
}

.pm-login-notice p {
    /*margin: 10px 0;
    color: #fff;*/
	padding: 0;
    color: #000;
}

.pm-login-notice strong {
    font-weight: 700;
}

.pm-login-message {
    font-size: 1.1rem;
    margin-bottom: 15px !important;
}

.pm-login-hint {
    margin-top: 15px !important;
    opacity: 0.9;
}

.pm-login-hint small {
    font-size: 0.9rem;
}

/* Botón de login */
.pm-btn-login {
    /*background: #fff;
    color: #667eea;*/
    background: #f1730d;
    color: #fff;
	font-weight: 600;
    font-size: 1.1rem;
    padding: 15px 40px;
    display: inline-block;
    text-decoration: none;
    /*border-radius: 50px;*/
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    margin: 10px 0;
}

.pm-btn-login:hover {
    background: #f0f0f0;
    /*color: #764ba2;*/
    color: #f1730d;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.pm-btn-large {
    padding: 15px 40px;
    font-size: 1.1rem;
}

/* Contadores */
.pm-total-count,
.pm-preview-count {
    margin: 0;
    color: #666;
    font-size: 0.95rem;
}

.pm-total-count strong,
.pm-preview-count strong {
    color: #0073aa;
}

/* Overlay en tarjetas para no logueados */
.pm-part-image {
    position: relative;
    aspect-ratio: 1;
    background: #f9f9f9;
    overflow: hidden;
}

.pm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(102, 126, 234, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pm-part-card:hover .pm-overlay {
    opacity: 1;
}

.pm-overlay-text {
    font-size: 2.5rem;
    color: #fff;
    animation: pm-pulse 2s infinite;
}

@keyframes pm-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* Grid Layout - 3 columns × 6 rows = 18 items */
.pm-parts-grid {
    display: grid;
    /*grid-template-columns: repeat(3, 1fr);*/
	grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

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

@media (max-width: 640px) {
    .pm-parts-grid {
        grid-template-columns: 1fr;
    }
    
    .pm-grid-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .pm-login-notice {
        padding: 15px;
    }
    
    .pm-btn-login {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Part Card - Sin botón de acciones */
.pm-part-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.pm-part-card:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transform: translateY(-3px);
}

/* Info Section - Ajustado sin botón */
.pm-part-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Eliminar estilos de acciones que ya no usamos */
.pm-part-actions {
    display: none;
}

/* Resto de estilos mantienen igual... */
.pm-part-sku {
    margin: 0 0 8px;
    font-size: 0.95rem;
}

.pm-part-sku code {
    background: #f0f0f1;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 0.85rem;
}

.pm-part-description {
    margin: 0 0 12px;
    color: #444;
    font-size: 0.95rem;
    line-height: 1.4;
    flex-grow: 1;
}

.pm-part-meta {
    margin: 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px 10px;
    font-size: 0.85rem;
    color: #666;
}

.pm-part-meta dt {
    font-weight: 600;
}

.pm-part-meta dd {
    margin: 0;
}

/* Pagination */
.pm-pagination {
    text-align: center;
    margin: 30px 0;
}

.pm-pagination-nav .page-numbers {
    display: inline-flex;
    gap: 5px;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
    justify-content: center;
}

.pm-pagination-nav .page-numbers li {
    margin: 0;
}

.pm-pagination-nav a.page-numbers,
.pm-pagination-nav span.page-numbers {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.pm-pagination-nav a.page-numbers:hover {
    background: #f0f0f1;
    border-color: #999;
}

.pm-pagination-nav .page-numbers.current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
    font-weight: 600;
}

.pm-pagination-nav .page-numbers.dots {
    border: none;
    padding: 0 5px;
    color: #999;
}

/* No Results */
.pm-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #666;
    background: #f9f9f9;
    border-radius: 8px;
}

/* Loading State */
.pm-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.pm-loading::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: pm-spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes pm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility */
.pm-part-card:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .pm-login-notice,
    .pm-pagination,
    .pm-overlay {
        display: none;
    }
    
    .pm-part-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* ===== Filtro Avanzado (Una sola fila) ===== */

.pm-admin-filter-bar {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 15px 20px;
    margin-bottom: 25px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.pm-filter-form {
    display: block;
}

.pm-filter-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 15px;
}

form .pm-filter-row
 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.pm-filter-field {
    flex: 1;
    min-width: 150px;
}

.pm-filter-search {
    flex: 2;
    min-width: 250px;
}

.pm-filter-input,
.pm-filter-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.5;
    color: #2c3338;
    background: #fff;
    transition: border-color 0.1s;
    box-sizing: border-box;
}

.pm-filter-input:focus,
.pm-filter-select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.pm-filter-input::placeholder {
    color: #646970;
}

.pm-filter-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.pm-btn-filter,
.pm-btn-reset {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.1s;
    border: 1px solid transparent;
    white-space: nowrap;
}

.pm-btn-filter {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

.pm-btn-filter:hover {
    background: #135e96;
    border-color: #135e96;
    color: #fff;
}

.pm-btn-reset {
    background: #f6f7f7;
    color: #2271b1;
    border-color: #2271b1;
}

.pm-btn-reset:hover {
    background: #f0f0f1;
    color: #135e96;
    border-color: #135e96;
}

.pm-filter-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    font-size: 13px;
}

.pm-filter-active {
    color: #2c3338;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.pm-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f0f0f1;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
    color: #2c3338;
}

.pm-filter-tag strong {
    color: #2271b1;
}

.pm-results-count {
    color: #646970;
    margin-left: auto;
}

.pm-results-count strong {
    color: #2271b1;
}

/* Responsive */
@media (max-width: 1200px) {
    .pm-filter-row {
        flex-wrap: wrap;
    }
    
    .pm-filter-field {
        flex: 1 1 200px;
    }
}

@media (max-width: 768px) {
    .pm-filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .pm-filter-field,
    .pm-filter-search {
        width: 100%;
        min-width: 100%;
    }
    
    .pm-filter-buttons {
        width: 100%;
        justify-content: stretch;
    }
    
    .pm-btn-filter,
    .pm-btn-reset {
        flex: 1;
        justify-content: center;
    }
    
    .pm-filter-info {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .pm-results-count {
        margin-left: 0;
    }
}

/* Resto de estilos (infinite loader, grid, cards, etc.) */


/* ===== Botón "Cargar Más" ===== */

.pm-load-more-wrapper {
    text-align: center;
    margin: 30px 0;
    padding: 20px;
    border-top: 1px solid #e0e0e0;
}

.pm-btn-load-more {
    background: #2271b1;
    color: #fff;
    border: 1px solid #2271b1;
    border-radius: 4px;
    padding: 10px 30px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pm-btn-load-more:hover:not(:disabled) {
    background: #135e96;
    border-color: #135e96;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(34,113,177,0.3);
}

.pm-btn-load-more:disabled {
    background: #f0f0f1;
    color: #646970;
    border-color: #c3c4c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.pm-load-more-info {
    margin-top: 10px;
    color: #646970;
    font-size: 13px;
}

.pm-load-more-info small {
    font-size: 13px;
}

/* Infinite Scroll Loader */
.pm-infinite-loader {
    text-align: center;
    padding: 30px;
    margin: 20px 0;
    color: #646970;
}

.pm-loader-spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f0f0f1;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: pm-spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes pm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.pm-no-more-parts {
    text-align: center;
    padding: 20px;
    color: #00a32a;
    font-weight: 600;
}
