﻿/* FASTEN Standard UI Styles for homologated forms */

/* Layout Container */
.purchase-order-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    background: #f8f9fa; /* Cambiar a $brand-bg en SCSS */
    min-height: 100vh;
}

/* Progress Indicator */
.progress-section {
    margin-bottom: 24px;
}
.progress-card {
    background: white; /* Cambiar a $brand-surface en SCSS */
    border-radius: 0;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); /* Mantener sombra, pero considerar variable si se homologa */
    border: 1px solid #e9ecef; /* Cambiar a $brand-border en SCSS */
}
.progress-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-weight: 600;
    color: #495057; /* Cambiar a $brand-text en SCSS */
}
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef; /* Cambiar a $brand-border en SCSS */
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 8px;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #5865F2, #F7FF00); /* Cambiar a $brand-primary y $brand-secondary en SCSS */
    border-radius: 0;
    transition: width 0.3s ease;
}
.progress-text {
    text-align: center;
    font-size: 0.875rem;
    color: #6c757d; /* Cambiar a $brand-muted en SCSS */
}

/* File Info Section */
.file-info {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 0;
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.file-info-content {
    display: flex;
    align-items: center;
    gap: 12px;
}
.file-info i {
    font-size: 2rem;
    color: #1976d2;
}
.file-details {
    display: flex;
    flex-direction: column;
}
.file-details strong {
    font-size: 1.1rem;
    color: #1565c0;
}
.file-details span {
    font-size: 0.875rem;
    color: #1976d2;
    opacity: 0.8;
}
.file-timestamp {
    font-size: 0.875rem;
    color: #1976d2;
    opacity: 0.8;
}

/* Validation/Error/Success Blocks */
.validation-errors {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: 0;
    padding: 20px;
    margin-bottom: 24px;
}
.error-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    color: #e53e3e;
    flex-wrap: wrap;
    gap: 12px;
}
.error-header > div {
    display: flex;
    align-items: center;
    gap: 12px;
}
.error-header i {
    font-size: 1.5rem;
}
.error-header h4 {
    margin: 0;
    font-weight: 600;
}
.error-export-btn {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
}
.error-export-btn:hover {
    background: #c53030;
    transform: translateY(-1px);
}
.error-list {
    display: grid;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}
.error-item {
    padding: 12px;
    background: #fed7d7;
    border-radius: 0;
    color: #742a2a;
    font-size: 0.875rem;
}
.error-item.more-errors {
    background: #e2e8f0;
    color: #4a5568;
    text-align: center;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.validation-success {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    border-radius: 0;
    padding: 20px;
    margin-bottom: 24px;
    color: #276749;
    font-weight: 500;
}
.validation-success > span {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.validation-success i {
    font-size: 1.5rem;
    color: #38a169;
}
.validation-stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}
.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: #2d3748;
}

/* Custom Spinners */
.custom-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #5865F2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}
.custom-spinner-lg {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #5865F2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}
.custom-spinner-xl {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #5865F2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg);}
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}
.loading-content {
    text-align: center;
    background: white;
    padding: 48px;
    border-radius: 0;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}
.loading-text {
    margin-top: 24px;
    font-size: 1.1rem;
    color: #6c757d;
    font-weight: 500;
}
.loading-status {
    margin-top: 12px;
    font-size: 0.9rem;
    color: #9aa0a6;
}

/* Success Highlight */
.success-highlight {
    background-color: rgba(40, 167, 69, 0.05);
    border-left: 4px solid #28a745;
    animation: fadeIn 0.5s ease-in;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Notification Bar */
.notification-bar {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    padding: 16px;
    border-radius: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    animation: slideInRight 0.3s ease-out;
}
.notification-bar.success {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
    border-left: 4px solid #28a745;
    color: #155724;
}
.notification-bar.error {
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    border-left: 4px solid #dc3545;
    color: #721c24;
}
.notification-bar.warning {
    background: linear-gradient(135deg, #fffdf5 0%, #fff3cd 100%);
    border-left: 4px solid #ffc107;
    color: #856404;
}
.notification-bar.info {
    background: linear-gradient(135deg, #f0f8ff 0%, #d1ecf1 100%);
    border-left: 4px solid #17a2b8;
    color: #0c5460;
}
.notification-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.notification-content i {
    font-size: 1.25rem;
    margin-top: 2px;
    flex-shrink: 0;
}
.notification-text {
    flex-grow: 1;
}
.notification-text strong {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
}
.notification-text span {
    font-size: 0.9rem;
    opacity: 0.9;
}
.notification-close {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.7;
    padding: 2px;
    border-radius: 0;
    transition: all 0.2s ease;
}
.notification-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Generic Page Header */
.page-header {
    background: linear-gradient(135deg, #405189 0%, #7C3AED 50%, #F7FF00 100%);
    border-radius: 0;
    padding: 32px;
    margin-bottom: 24px;
    color: white;
    box-shadow: 0 10px 30px rgba(64, 81, 137, 0.2);
    position: relative;
    overflow: hidden;
}
.page-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #405189 0%, #4F46E5 100%);
    opacity: 0.9;
    z-index: 0;
}
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    position: relative;
    z-index: 1;
}
.page-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: #E2E8F0;
}
.page-title i {
    font-size: 18px;
    opacity: 0.9;
    color: #F7FF00;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}
.page-subtitle {
    margin: 8px 0 0 0;
    font-size: 16px;
    opacity: 0.95;
    color: #E2E8F0;
}
.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.help-btn-header {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(247, 255, 0, 0.15);
    border: 2px solid #F7FF00;
    border-radius: 0;
    color: #F7FF00;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}
.help-btn-header:hover {
    background: #F7FF00;
    color: #5865F2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(247, 255, 0, 0.3);
}
.help-btn-header i {
    font-size: 1.1rem;
}

/* Upload/File/Input Section */
.upload-section {
    margin-bottom: 24px;
}
.upload-card {
    background: white;
    border-radius: 0;
    padding: 32px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}
.upload-header {
    text-align: center;
    margin-bottom: 32px;
}
.upload-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.upload-description {
    color: #6c757d;
    font-size: 1rem;
    margin: 0;
}
.file-input-container {
    position: relative;
    margin-bottom: 24px;
}
.file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.file-label {
    display: block;
    padding: 48px 24px;
    border: 2px dashed #dee2e6;
    border-radius: 0;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}
.file-label:hover:not(.disabled) {
    border-color: #5865F2;
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(88, 101, 242, 0.15);
}
.file-label.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.file-label i {
    font-size: 3rem;
    color: #5865F2;
    margin-bottom: 16px;
    display: block;
}
.file-text {
    display: block;
    font-size: 1.1rem;
    color: #495057;
    margin-bottom: 8px;
}
.file-hint {
    display: block;
    font-size: 0.875rem;
    color: #6c757d;
}
.upload-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.template-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #5865F2;
    text-decoration: none;
    font-weight: 500;
    padding: 12px 24px;
    border: 2px solid #5865F2;
    border-radius: 0;
    transition: all 0.3s ease;
}
.template-link:hover {
    background: #5865F2;
    color: white;
    transform: translateY(-2px);
}

/* Data Section/Grid Section */
.data-section {
    margin-bottom: 24px;
}
.grid-container {
    background: white;
    border-radius: 0;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
}
.grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}
.grid-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}
.grid-toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.grid-header-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}
.grid-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #6c757d;
}
.grid-loading p {
    margin-top: 16px;
    font-size: 1rem;
}
.quantity-display {
    display: flex;
    justify-content: center;
}
.quantity-badge {
    background: #e3f2fd;
    color: #1565c0;
    padding: 4px 12px;
    border-radius: 0;
    font-weight: 600;
    font-size: 0.875rem;
}
.quantity-badge.quantity-error {
    background: #ffebee;
    color: #c62828;
}

/* Empty State */
.empty-state-grid {
    background: white;
    border-radius: 0;
    padding: 60px 32px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    margin-top: 24px;
}
.empty-state-grid .empty-content i {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 20px;
    display: block;
}
.empty-state-grid .empty-content h3 {
    font-size: 1.25rem;
    color: #6c757d;
    margin-bottom: 8px;
}
.empty-state-grid .empty-content p {
    color: #9aa0a6;
    margin-bottom: 0;
    font-size: 1rem;
}

/* Generic Modern Grid (Syncfusion) */
.modern-grid .e-grid .e-gridheader {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}
.modern-grid .e-grid .e-columnheader {
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}
.modern-grid .e-grid .e-row:hover {
    background: #f8f9ff;
}
.modern-grid .e-grid .e-altrow {
    background: #fafbfc;
}

/* Command button styles for grid */
.e-grid .e-unboundcell .btn-edit {
    color: #17a2b8;
    background: transparent;
    border: none;
    padding: 6px;
    border-radius: 0;
}
.e-grid .e-unboundcell .btn-edit:hover {
    background: #e6f7ff;
    color: #0c7b93;
}
.e-grid .e-unboundcell .btn-delete {
    color: #dc3545;
    background: transparent;
    border: none;
    padding: 6px;
    border-radius: 0;
}
.e-grid .e-unboundcell .btn-delete:hover {
    background: #ffebee;
    color: #a71e2a;
}
.e-grid .e-unboundcell .btn-save {
    color: #28a745;
    background: transparent;
    border: none;
    padding: 6px;
    border-radius: 0;
}
.e-grid .e-unboundcell .btn-save:hover {
    background: #e8f5e8;
    color: #1e7e34;
}
.e-grid .e-unboundcell .btn-cancel {
    color: #6c757d;
    background: transparent;
    border: none;
    padding: 6px;
    border-radius: 0;
}
.e-grid .e-unboundcell .btn-cancel:hover {
    background: #f8f9fa;
    color: #495057;
}

/* Button customizations FASTEN */
.e-btn.create-btn {
    background: #5865F2;
    border-color: #5865F2;
    color: white;
    padding: 12px 24px;
    border-radius: 0;
    font-weight: 600;
}
.e-btn.create-btn:hover:not(:disabled) {
    background: #4F46E5;
    border-color: #4F46E5;
    transform: translateY(-1px);
}
.e-btn.btn-secondary {
    background: #6c757d;
    border-color: #6c757d;
    color: white;
    border-radius: 0;
}
.e-btn.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    border-color: #545b62;
}

/* Responsive design */
@media (max-width: 768px) {
    .purchase-order-container {
        padding: 16px;
    }
    .page-header {
        padding: 24px;
    }
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    .header-actions {
        width: 100%;
        justify-content: center;
    }
    .help-btn-header {
        font-size: 0.8rem;
        padding: 10px 16px;
    }
    .upload-card {
        padding: 24px;
    }
    .file-label {
        padding: 32px 16px;
    }
    .upload-actions {
        flex-direction: column;
    }
    .grid-header {
        flex-direction: column;
        align-items: stretch;
    }
    .grid-toolbar {
        width: 100%;
        justify-content: stretch;
    }
    .grid-toolbar .e-btn {
        flex: 1;
    }
    .validation-stats {
        flex-direction: column;
        gap: 12px;
    }
    .file-info {
        flex-direction: column;
        align-items: flex-start;
    }
    .error-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .modal-content {
        width: 95%;
        margin: 16px;
    }
    .modal-header {
        padding: 16px 24px;
    }
    .modal-body {
        padding: 24px;
    }
    .help-steps li {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .notification-bar {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    .confirmation-dialog .e-dialog,
    .notification-dialog .e-dialog {
        width: 95% !important;
        margin: 16px !important;
    }
}

/* Help Modal (custom HTML, identical to purchase) */
.modal-overlay {
    position: fixed;
    z-index: 11000;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}
.modal-content {
    background: #fff;
    border-radius: 0;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    max-width: 600px;
    width: 94vw;
    padding: 0;
    position: relative;
    animation: fadeIn 0.2s;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 28px 32px 14px 32px;
    border-bottom: 1px solid #f1f3f4;
}
.modal-header h3 {
    font-size: 1.4rem;
    font-weight: 800;
    color: #23272e;
    margin: 0;
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: #6c757d;
    cursor: pointer;
    opacity: 0.85;
    padding: 2px 2px;
    border-radius: 0;
    transition: all 0.15s;
}
.modal-close:hover {
    background: #f8f9fa;
    color: #405189;
    opacity: 1;
}
.modal-body {
    padding: 32px;
}
.help-steps {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
}
.help-steps li {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    padding: 18px 0;
    border-bottom: 1px solid #f1f3f4;
}
.help-steps li:last-child {
    border-bottom: none;
}
.help-steps li i {
    font-size: 1.7rem;
    color: #5865F2;
    margin-top: 3px;
    flex-shrink: 0;
}
.help-steps li strong {
    color: #23272e;
    font-size: 1.09rem;
    font-weight: 700;
    display: block;
}
.help-steps li p {
    color: #6c757d;
    margin: 0;
    font-size: 1rem;
    margin-top: 2px;
}
.help-info {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 0;
    color: #495057;
    font-size: 0.97rem;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .modal-content {
        width: 99vw;
    }
    .modal-header {
        padding: 18px 14px 10px 14px;
    }
    .modal-body {
        padding: 14px;
    }
    .help-steps li {
        flex-direction: column;
        gap: 8px;
        padding: 14px 0;
    }
}
