/* HSN Recommendation System Styles */

/* Base Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: none;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #1976d2;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.modal-close:hover {
    background-color: #f0f0f0;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: #1976d2;
    color: white;
}

.btn-primary:hover {
    background-color: #1565c0;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-outline-secondary {
    background-color: transparent;
    color: #6c757d;
    border: 1px solid #6c757d;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    color: white;
}

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

/* Recommendation Modal */
.recommendation-modal .modal-content {
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Editable Fields */
.editable-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.field-group {
    display: flex;
    flex-direction: column;
}

.field-group label {
    font-weight: 500;
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.field-group .form-control {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
    background-color: white;
}

.field-group .form-control:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.field-group select.form-control {
    cursor: pointer;
}

.field-group input[type="date"].form-control {
    cursor: pointer;
}

.field-group input[type="number"].form-control {
    cursor: text;
}

/* Slab Rates Section */
.slab-rates-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
}

.slab-rates-section h5 {
    color: #856404;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.slab-fields {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.slab-config {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.slab-config .field-group {
    margin-bottom: 0;
}

/* Preview Section */
.preview-summary {
    background: #e3f2fd;
    border-radius: 8px;
    padding: 1rem;
    border-left: 4px solid #1976d2;
}

.preview-summary h5 {
    color: #1976d2;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.preview-values {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
}

.preview-item {
    padding: 0.5rem;
    background: white;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.preview-item strong {
    color: #1976d2;
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.recommendation-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.hsn-info {
    font-size: 1.1rem;
    color: #333;
}

.confidence-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.confidence-high {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.confidence-medium {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.confidence-low {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.affected-items {
    margin-bottom: 1.5rem;
}

.affected-items h4 {
    color: #1976d2;
    margin-bottom: 1rem;
}

.items-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 0.5rem;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.item-row:last-child {
    border-bottom: none;
}

.item-name {
    font-weight: 500;
    color: #333;
}

.item-parent {
    color: #666;
    font-size: 0.9rem;
}

.current-gst {
    color: #1976d2;
    font-weight: 500;
}

.more-items {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 0.5rem;
}

.recommended-values {
    margin-bottom: 1.5rem;
}

.recommended-values h4 {
    color: #1976d2;
    margin-bottom: 1rem;
}

.value-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.value-item {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: #e3f2fd;
    border-radius: 8px;
    border-left: 4px solid #1976d2;
}

.value-item label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.value-item .value {
    font-size: 1.1rem;
    font-weight: bold;
    color: #1976d2;
}

.preview-changes {
    margin-bottom: 1.5rem;
}

.preview-changes h4 {
    color: #1976d2;
    margin-bottom: 1rem;
}

.changes-preview {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
}

.change-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.change-item:last-child {
    border-bottom: none;
}

.change-item .item-name {
    flex: 1;
    font-weight: 500;
}

.change-arrow {
    margin: 0 1rem;
    color: #1976d2;
    font-weight: bold;
}

.new-value {
    color: #28a745;
    font-weight: bold;
}

.more-changes {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 0.5rem;
}

/* Correction Modal */
.correction-modal .modal-content {
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.current-data {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #6c757d;
}

.current-data h4 {
    color: #6c757d;
    margin-bottom: 1rem;
}

.data-display p {
    margin: 0.5rem 0;
    color: #333;
}

.suggested-data {
    margin-bottom: 1.5rem;
}

.suggested-data h4 {
    color: #1976d2;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

#slabRatesSection {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
}

/* Recommendation Notification */
.recommendation-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    max-width: 400px;
    animation: slideInRight 0.3s ease-out;
}

.notification-content {
    display: flex;
    align-items: center;
    padding: 1rem;
}

.notification-content i {
    color: #ffc107;
    font-size: 1.5rem;
    margin-right: 1rem;
}

.notification-text {
    flex: 1;
}

.notification-text strong {
    display: block;
    color: #333;
    margin-bottom: 0.25rem;
}

.notification-text p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

.notification-content .btn {
    margin-left: 0.5rem;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Progress Bar */
.progress-bar-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    min-width: 300px;
    padding: 1.5rem;
}

.progress-bar-header {
    text-align: center;
    margin-bottom: 1rem;
}

.progress-bar-header h3 {
    margin: 0;
    color: #1976d2;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #1976d2, #42a5f5);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-bar-text {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

.progress-bar-error {
    background: #dc3545;
}

.progress-bar-success {
    background: #28a745;
}

/* Responsive Design */
@media (max-width: 768px) {
    .recommendation-modal .modal-content,
    .correction-modal .modal-content {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .recommendation-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .editable-fields {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .slab-config {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .preview-values {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .value-grid {
        grid-template-columns: 1fr;
    }
    
    .item-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .change-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .change-arrow {
        display: none;
    }
    
    .recommendation-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .notification-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .notification-content .btn {
        margin-left: 0;
        width: 100%;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin: 0;
    }
}

/* Info Note */
.info-note {
    margin-top: 1rem;
    padding: 1rem;
    background: #e3f2fd;
    border-radius: 8px;
    border-left: 4px solid #1976d2;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.info-note i {
    color: #1976d2;
    font-size: 1.1rem;
    margin-top: 0.1rem;
}

.info-note p {
    margin: 0;
    color: #1976d2;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Smart Date Input */
.smart-date-input {
    font-family: 'Arial';
    letter-spacing: 0.5px;
}

.smart-date-input.error {
    border-color: #dc3545 !important;
    background-color: #fff5f5;
}

.date-help-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #666;
    font-style: italic;
}

/* GST Type Fields */
.gst-type-fields {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.gst-type-fields .field-group {
    margin-bottom: 1rem;
}

.gst-type-fields .field-group:last-child {
    margin-bottom: 0;
}

/* Slab Rate Specific Styles */
#slab-gst-fields .field-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#slab-gst-fields label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

#slab-gst-fields input[type="number"] {
    font-family: 'Courier New', monospace;
    text-align: right;
}

#slab-gst-fields select {
    font-weight: 500;
}

/* Preview Values Enhancement */
.preview-values {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.preview-item {
    padding: 0.5rem;
    background: #e3f2fd;
    border-radius: 4px;
    border-left: 3px solid #1976d2;
}

.preview-item strong {
    color: #1976d2;
    font-size: 0.85rem;
}
