/* ============================================================
   MODAL STYLES - THEME CHUNG CHO TẤT CẢ MODAL/POPUP
   ============================================================ */

:root {
    /* Primary Colors - Theme xanh đồng nhất */
    --primary-700: #2859a4;
    --primary-600: #336ac1;
    --primary-500: #3b82f6;
    --primary-400: #60a5fa;

    /* Surface Colors */
    --surface: #ffffff;
    --surface-muted: #f6f9ff;

    /* Border & Text */
    --border: #e2e8f0;
    --text: #262626;
    --text-muted: #6b7280;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(2, 8, 23, 0.08);
    --shadow-md: 0 6px 16px rgba(2, 8, 23, 0.10);
    --shadow-lg: 0 10px 25px rgba(2, 8, 23, 0.15);
}

/* ============================================================
   MODAL CONTENT STYLING
   ============================================================ */
.modal-dialog-scrollable .modal-content {
        max-height: calc(100vh - 3.5rem);
        border-radius: 30px;
    }

/* Backdrop mờ khi modal hiển thị */
.modal.show {
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-standard .modal-content {
    background: var(--surface);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    border: none;
    overflow: hidden;
}

.modal-standard .modal-header {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: #fff;
    border-bottom: none;
    padding: 16px 20px;
    border-radius: 20px 20px 0 0;
}

.modal-standard .modal-title {
    font-size: 18px;
    color: #fff;
    margin: 0;
}

.modal-standard .close {
    color: #fff;
    opacity: 0.9;
    font-size: 28px;
    font-weight: 300;
    transition: opacity 0.2s ease;
}

.modal-standard .close:hover {
    opacity: 1;
    color: #fff;
}

.modal-standard .modal-body {
    padding: 24px;
}

.modal-standard .modal-footer {
    border-top: 1px solid var(--border);
    padding: 16px 20px;
    border-radius: 0 0 20px 20px;
    background: #fff;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}



/* ============================================================
   FORM ELEMENTS STYLING
   ============================================================ */

.modal-standard .form-label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 8px;
    display: block;
}

.modal-standard .form-control,
.modal-standard .form-select,
.modal-standard .form-range {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: #fff;
    color: var(--text);
}

.modal-standard .form-control:focus,
.modal-standard .form-select:focus {
    outline: none;
    border-color: var(--primary-600);
    box-shadow: 0 0 0 3px rgba(51, 106, 193, 0.1);
}

.modal-standard .form-check-input {
    border-color: var(--border);
    cursor: pointer;
}

.modal-standard .form-check-input:checked {
    background-color: var(--primary-600);
    border-color: var(--primary-600);
}

.modal-standard .form-check-input:focus {
    border-color: var(--primary-600);
    box-shadow: 0 0 0 3px rgba(51, 106, 193, 0.1);
}

.modal-standard .form-check-label {
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 0;
    user-select: none;
}

 /* --- Timeline Logic (Phần quan trọng nhất) --- */
.timeline-wrapper {
    padding: 20px 10px;
    position: relative;
    font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

.timeline-item {
    position: relative;
    padding-left: 50px; /* Chừa chỗ cho icon và đường kẻ */
    padding-bottom: 15px;
}

/* Đường kẻ dọc */
.timeline-item::before {
    content: '';
    position: absolute;
    left: 20px; /* Căn giữa theo chiều dọc icon */
    top: 5px;
    bottom: 0;
    width: 2px;
    background-color: var(--line-color);
}

    /* Ẩn đường kẻ ở item cuối cùng */
.timeline-item:last-child::before {
    display: none;
}
.timeline-item:last-child {
    padding-bottom: 0;
}

    /* Dấu chấm tròn (Icon) */
.timeline-icon {
    position: absolute;
    left: 11px; /* (20px line + 1px) - (20px width / 2) */
    top: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #fff;
    border: 3px solid var(--line-color);
    z-index: 2; /* Nằm đè lên đường kẻ */
    box-shadow: 0 0 0 3px #fff; /* Tạo viền trắng tách biệt với đường kẻ */
}

/* Màu sắc trạng thái */
.timeline-icon.status-created { border-color: #6c757d; } /* Xám */
.timeline-icon.status-sent { border-color: #17a2b8; } /* Xanh dương */
.timeline-icon.status-payment { border-color: #ffc107; } /* Vàng */
.timeline-icon.status-received {
    border-color: var(--success-color);
    background-color: var(--success-color); /* Fill màu xanh khi hoàn thành */
}
.timeline-icon.status-rejected {
    border-color: #e74c3c;
    background-color: #e74c3c; /* Fill màu đỏ khi từ chối */
}

/* Nội dung Text */
.timeline-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.timeline-label {
    font-size: inherit;
    font-weight: 700;
    color: var(--text);
    display: inline-block;
    white-space: nowrap;
    flex-shrink: 0;
}

.timeline-label.is-success {
    color: var(--success-color);
}

.timeline-label.is-danger {
    color: #e74c3c;
}

.timeline-label.is-note {
    color: #6c757d;
}

.timeline-date {
    font-size: inherit;
    font-weight: 600;
    color: var(--text);
    text-align: right;
    flex: 1;
}

.timeline-user {
    font-size: inherit;
    color: var(--text);
    background: var(--bg-light);
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    width: fit-content;
}
.timeline-user i {
    margin-right: 4px;
}

/* ============================================================
   BUTTON STYLING
   ============================================================ */

.btn-modal {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s ease;
    font-size: 14px;
    box-shadow: var(--shadow-sm);
}

.btn-modal:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-modal:active {
    transform: translateY(0);
}

.btn-modal-primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    border-radius: 999px;
    color: #fff;
}

.btn-modal-primary:hover {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-800, #1e3f6f));
    color: #fff;
}

.btn-modal-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-modal-secondary {
    background: var(--surface-muted);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.btn-modal-secondary:hover {
    background: #eef4ff;
    border-color: var(--primary-400);
}

.btn-modal-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-modal-danger {
    background: #dc2626;
    color: #fff;
}

.btn-modal-danger:hover {
    background: #b91c1c;
}

.btn-modal-success {
    background: #16a34a;
    color: #fff;
}

.btn-modal-success:hover {
    background: #15803d;
}

.btn-modal-warning {
    background: #ea580c;
    color: #fff;
}

.btn-modal-warning:hover {
    background: #c2410c;
}

/* ============================================================
   VALIDATION MESSAGES
   ============================================================ */

.modal-standard .invalid-feedback,
.modal-standard .valid-feedback {
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.modal-standard .invalid-feedback {
    color: #dc2626;
}

.modal-standard .valid-feedback {
    color: #16a34a;
}

/* ============================================================
   IMAGE UPLOAD AVATAR STYLING
   ============================================================ */

.product-avatar-container {
        position: relative;
        display: inline-block;
        margin-bottom: 16px;
    }

.product-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.product-avatar-upload {
    position: absolute;
    bottom: 0;
    right: 0;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease;
}

.product-avatar-upload:hover {
    transform: scale(1.1);
}

/* ============================================================
   TEXT AREA STYLING
   ============================================================ */

.modal-standard textarea.form-control {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

/* ============================================================
   MODAL SIZES
   ============================================================ */

/* Small Modal */
.modal-dialog.modal-sm {
    max-width: 400px;
}

/* Medium Modal (Default) */
.modal-dialog {
    max-width: 600px;
}

/* Large Modal */
.modal-dialog.modal-lg {
    max-width: 800px;
}

/* Extra Large Modal */
.modal-dialog.modal-xl {
    max-width: 1000px;
}

/* ============================================================
   FORM GROUPS & SPACING
   ============================================================ */

.modal-standard .form-group {
    margin-bottom: 16px;
}

.modal-standard .form-group:last-child {
    margin-bottom: 0;
}

.modal-standard .row [class*="col-"] {
    padding-left: 8px;
    padding-right: 8px;
}

/* ============================================================
   UTILITIES
   ============================================================ */

.text-danger {
    color: #dc2626;
}

.text-success {
    color: #16a34a;
}

.text-warning {
    color: #ea580c;
}

.text-info {
    color: var(--primary-600);
}

.text-muted {
    color: var(--text-muted);
}

.fw-bold {
    font-weight: 700;
}

.fw-semibold {
    font-weight: 600;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 576px) {
    .modal-dialog {
        max-width: 100%;
        margin: 10px;
    }

    .modal-standard .modal-body {
        padding: 16px;
    }

    .modal-standard .modal-footer {
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn-modal {
        width: 100%;
    }
}

/* ============================================================
   WarehouseProductDetailPopup STYLES
   ============================================================ */

/* Modal và container chính */
.product-detail-container {
    padding: 0;
}

/* Left Column - Product Image Card */
.product-image-card {
    background: linear-gradient(135deg, var(--surface-muted) 0%, #eef4ff 100%);
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.product-image-container {
    margin-bottom: 2rem;
}

.product-image {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 16px;
    border: 3px solid #fff;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-basic-info {
    text-align: left;
}

.product-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.3;
    word-break: break-word;
}

.product-basic-info > div {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
}

.product-basic-info > div:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.price-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.inventory-value {
    font-weight: 600;
}

/* Right Column - Details Section */
.product-details-section {
    padding-left: 1rem;
}

.info-section {
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.info-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    display: flex;
    align-items: center;
}

/* Attributes Table */
.attributes-table-container {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.attributes-table {
    margin-bottom: 0;
    background: #fff;
}

.attribute-row {
    transition: background-color 0.2s ease;
}


.attribute-label-cell {
    background: linear-gradient(180deg, var(--surface-muted), #eef4ff);
    font-weight: 700;
    color: var(--primary-700); 
    width: 35%;
    vertical-align: middle;
    padding: 1rem;
    border-right: 2px solid var(--primary-600); 
}

.attribute-value-cell {
    background-color: #fff; 
    color: #2c3e50; 
    padding: 1rem;
    vertical-align: middle;
}

.attribute-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.attribute-image-thumb {
    max-width: 80px;
    max-height: 80px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.color-preview {
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    display: inline-block;
}

/* No Attributes Message */
.no-attributes-message {
    background: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 8px;
    margin: 0;
}

.no-attributes-message .text-center {
    color: #6c757d;
}

/* Description Content */
.description-content {
    background: var(--surface-muted);
    padding: 1.25rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-600);
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text);
    max-height: 250px;
    overflow-y: auto;
}

/* Loading spinner */
.spinner-border {
    border-width: 0.3em;
}

/* Custom scrollbar for description */
.description-content::-webkit-scrollbar {
    width: 6px;
}

.description-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.description-content::-webkit-scrollbar-thumb {
    background: var(--primary-600);
    border-radius: 3px;
}

.description-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-700);
}

