/* ========================================
   MODAL STYLES - CEK STOK
   Professional & Clean Design
   ======================================== */

/* ========================================
   BASE MODAL STRUCTURE
   ======================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: #fff;
    margin: 5% auto;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: slideDown 0.3s ease;
}

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

.modal-content.modal-detail {
    max-width: 700px;
}

/* ========================================
   MODAL HEADER
   ======================================== */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    font-size: 20px;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ========================================
   MODAL BODY
   ======================================== */
.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ========================================
   MODAL FOOTER
   ======================================== */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 12px 12px;
}

/* ========================================
   DETAIL GRID (Modal Detail Stok)
   ======================================== */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.detail-item {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    border-left: 3px solid #e5e7eb;
    transition: all 0.2s ease;
}

.detail-item:hover {
    background: #f1f3f5;
    border-left-color: #667eea;
    transform: translateX(2px);
}

.detail-item label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.detail-value {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.detail-value-large {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
}

.detail-highlight {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-left-color: #667eea;
    text-align: center;
    padding: 24px;
}

/* Color helpers */
.text-red { color: #ef4444 !important; }
.text-green { color: #10b981 !important; }
.text-blue { color: #3b82f6 !important; }
.text-orange { color: #f59e0b !important; }

/* ========================================
   FORM GRID (Modal Tambah Barang)
   ======================================== */
.modal-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.modal-form-full {
    grid-column: 1 / -1;
}

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

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-group input,
.form-group select {
    padding: 10px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder {
    color: #9ca3af;
}

/* ========================================
   JENIS AUTOCOMPLETE
   ======================================== */
.jenis-input-wrapper {
    position: relative;
}

.jenis-input {
    width: 100%;
}

.jenis-input-hint {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: #9ca3af;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.jenis-input:focus + .jenis-input-hint {
    opacity: 0;
}

.jenis-suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 4px;
}

.jenis-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f3f4f6;
}

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

.jenis-suggestion-item:hover,
.jenis-suggestion-item.active {
    background: #f3f4f6;
}

.jenis-suggestion-item strong {
    color: #1f2937;
    font-size: 14px;
}

.jenis-count {
    background: #e5e7eb;
    color: #6b7280;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.jenis-suggestion-item.empty {
    color: #9ca3af;
    font-size: 13px;
    text-align: center;
    cursor: default;
}

.jenis-suggestion-item.empty:hover {
    background: transparent;
}

/* ========================================
   TAB NAVIGATION (Import Excel)
   Modern Pills Design with Specificity
   ======================================== */
#modalImportExcel .tab-navigation,
.modal-import-excel .tab-navigation {
    display: flex !important;
    gap: 12px !important;
    margin-bottom: 24px !important;
    padding: 6px !important;
    background: #f3f4f6 !important;
    border-radius: 12px !important;
    position: relative !important;
    border-bottom: none !important;
}

#modalImportExcel .tab-btn,
.modal-import-excel .tab-btn {
    flex: 1 !important;
    padding: 14px 24px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 8px !important;
    color: #6b7280 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    position: relative !important;
    z-index: 1 !important;
    overflow: hidden !important;
    border-bottom: none !important;
}

#modalImportExcel .tab-btn::before,
.modal-import-excel .tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 8px;
    z-index: -1;
}

#modalImportExcel .tab-btn:hover::before,
.modal-import-excel .tab-btn:hover::before {
    opacity: 1;
}

/* Click effect */
#modalImportExcel .tab-btn:active,
.modal-import-excel .tab-btn:active {
    transform: translateY(0) scale(0.96) !important;
}

#modalImportExcel .tab-btn:hover,
.modal-import-excel .tab-btn:hover {
    color: #667eea !important;
    transform: translateY(-2px) !important;
}

#modalImportExcel .tab-btn.active,
.modal-import-excel .tab-btn.active {
    background: #fff !important;
    color: #667eea !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15),
                0 2px 4px rgba(0, 0, 0, 0.05) !important;
    transform: translateY(-2px) !important;
}

#modalImportExcel .tab-btn.active::before,
.modal-import-excel .tab-btn.active::before {
    opacity: 0;
}

#modalImportExcel .tab-btn i,
.modal-import-excel .tab-btn i {
    font-size: 18px !important;
    transition: transform 0.3s ease;
}

#modalImportExcel .tab-btn:hover i,
.modal-import-excel .tab-btn:hover i {
    transform: scale(1.1);
}

#modalImportExcel .tab-btn.active i,
.modal-import-excel .tab-btn.active i {
    transform: scale(1.15);
    color: #667eea !important;
}

#modalImportExcel .tab-btn .tab-text,
.modal-import-excel .tab-btn .tab-text {
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.tab-content {
    display: none;
    animation: tabFadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

/* Tab Badge/Indicator */
#modalImportExcel .tab-btn .tab-badge,
.modal-import-excel .tab-btn .tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    margin-left: 6px;
}

#modalImportExcel .tab-btn.active .tab-badge,
.modal-import-excel .tab-btn.active .tab-badge {
    background: #667eea;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

/* Mobile Tooltip for Tab */
@media (max-width: 768px) {
    #modalImportExcel .tab-btn,
    .modal-import-excel .tab-btn {
        position: relative;
    }
    
    #modalImportExcel .tab-btn::after,
    .modal-import-excel .tab-btn::after {
        content: attr(data-tooltip);
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%) translateY(-8px);
        background: rgba(0, 0, 0, 0.85);
        color: #fff;
        padding: 6px 12px;
        border-radius: 6px;
        font-size: 11px;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease, transform 0.2s ease;
        z-index: 1000;
    }
    
    #modalImportExcel .tab-btn:active::after,
    .modal-import-excel .tab-btn:active::after {
        opacity: 1;
        transform: translateX(-50%) translateY(-4px);
    }
}

/* ========================================
   IMPORT SECTION
   ======================================== */
.import-section {
    margin-bottom: 20px;
}

.import-section h4 {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 16px;
}

/* Upload Area */
.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: #f9fafb;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f3f4f6;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #eef2ff;
    transform: scale(1.02);
}

.upload-content i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 16px;
}

.upload-content h4 {
    font-size: 16px;
    color: #374151;
    margin-bottom: 8px;
}

.upload-content p {
    color: #6b7280;
    margin: 12px 0;
    font-size: 14px;
}

.upload-content small {
    color: #9ca3af;
    font-size: 12px;
}

.btn-outline-primary {
    background: transparent;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline-primary:hover {
    background: #667eea;
    color: #fff;
}

/* File Info */
.file-info {
    margin-top: 16px;
    padding: 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-details i {
    font-size: 32px;
    color: #10b981;
}

.file-text {
    flex: 1;
}

.file-text strong {
    display: block;
    color: #1f2937;
    font-size: 14px;
    margin-bottom: 4px;
}

.file-text span {
    color: #6b7280;
    font-size: 12px;
}

/* No File Message */
.no-file-message {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.no-file-message i {
    font-size: 64px;
    color: #d1d5db;
    margin-bottom: 16px;
}

.no-file-message p {
    margin: 8px 0;
    font-size: 14px;
}

/* Import Progress */
.import-section .fa-spinner {
    color: #667eea;
    margin-bottom: 16px;
}

.import-section h4 {
    text-align: center;
}

.import-section p {
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 16px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Import Result */
.import-result {
    padding: 32px;
    border-radius: 12px;
    text-align: center;
}

.import-result.success {
    background: #f0fdf4;
    border: 2px solid #bbf7d0;
}

.import-result.error {
    background: #fef2f2;
    border: 2px solid #fecaca;
}

.import-result i {
    font-size: 48px;
    margin-bottom: 16px;
}

.import-result.success i {
    color: #10b981;
}

.import-result.error i {
    color: #ef4444;
}

.import-result h4 {
    color: #1f2937;
    font-size: 18px;
    margin-bottom: 12px;
}

.import-result p {
    color: #6b7280;
    font-size: 14px;
    margin: 8px 0;
}

/* Import Errors */
.import-errors {
    margin-top: 16px;
    padding: 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.error-title {
    font-weight: 600;
    color: #dc2626;
    margin-bottom: 8px;
    font-size: 14px;
}

.error-item {
    color: #991b1b;
    font-size: 13px;
    padding: 4px 0;
}

/* Button Group */
.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-group .btn {
    flex: 1;
}

/* ========================================
   NOTIFICATION TOAST
   ======================================== */
.notification-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff;
    padding: 16px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    min-width: 300px;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.notification-toast.show {
    transform: translateX(0);
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification-content i {
    font-size: 24px;
}

.notification-success {
    border-left: 4px solid #10b981;
}

.notification-success i {
    color: #10b981;
}

.notification-error {
    border-left: 4px solid #ef4444;
}

.notification-error i {
    color: #ef4444;
}

.notification-content span {
    flex: 1;
    color: #1f2937;
    font-size: 14px;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
    .modal-content {
        margin: 0;
        max-width: 100%;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-header {
        border-radius: 0;
    }

    .modal-footer {
        border-radius: 0;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .modal-form-grid {
        grid-template-columns: 1fr;
    }

    .notification-toast {
        right: 10px;
        left: 10px;
        min-width: auto;
    }

    #modalImportExcel .tab-navigation,
    .modal-import-excel .tab-navigation {
        gap: 8px !important;
        padding: 5px !important;
    }

    #modalImportExcel .tab-btn,
    .modal-import-excel .tab-btn {
        font-size: 12px !important;
        padding: 12px 16px !important;
        gap: 6px !important;
    }

    #modalImportExcel .tab-btn .tab-text,
    .modal-import-excel .tab-btn .tab-text {
        display: none !important;
    }

    #modalImportExcel .tab-btn i,
    .modal-import-excel .tab-btn i {
        font-size: 20px !important;
    }
    
    #modalImportExcel .tab-btn.active,
    .modal-import-excel .tab-btn.active {
        transform: translateY(-1px) !important;
    }
    
    #modalImportExcel .tab-btn:hover,
    .modal-import-excel .tab-btn:hover {
        transform: translateY(-1px) !important;
    }
}

@media (max-width: 480px) {
    .modal-header {
        padding: 16px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 12px 16px;
        flex-direction: column;
    }

    .btn-group {
        flex-direction: column;
    }

    .detail-value {
        font-size: 14px;
    }

    .detail-value-large {
        font-size: 22px;
    }
    
    #modalImportExcel .tab-navigation,
    .modal-import-excel .tab-navigation {
        gap: 6px !important;
        padding: 4px !important;
        margin-bottom: 20px !important;
    }
    
    #modalImportExcel .tab-btn,
    .modal-import-excel .tab-btn {
        padding: 10px 12px !important;
        border-radius: 6px !important;
    }
    
    #modalImportExcel .tab-btn i,
    .modal-import-excel .tab-btn i {
        font-size: 18px !important;
    }
    
    #modalImportExcel .tab-btn.active,
    .modal-import-excel .tab-btn.active {
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2),
                    0 1px 2px rgba(0, 0, 0, 0.05) !important;
    }
}

/* ========================================
   PREVIEW TABLE STYLES
   ======================================== */
.table-container {
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 16px;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.table-container thead tr {
    background: #f3f4f6;
}

.table-container th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #d1d5db;
    white-space: nowrap;
}

.table-container td {
    padding: 8px 12px;
    border-bottom: 1px solid #e5e7eb;
    color: #1f2937;
}

.table-container tbody tr:hover {
    background: #f9fafb;
}

.table-container .header-row {
    background: #dbeafe !important;
    font-weight: 600;
}

.table-container .header-row td {
    color: #1e40af;
    border-bottom: 2px solid #93c5fd;
}

/* ========================================
   LOADING BUTTON STATE
   ======================================== */
button.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

button.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}
