﻿/* Custom styles for Röchling Part Transfer System  site.css */

/* Fixed Layout Styles */
.navbar.fixed-top {
    z-index: 1030;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.fixed-bottom {
    z-index: 1020;
    box-shadow: 0 -0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Main content scrollable area */
main.overflow-auto {
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: auto; /* For Firefox */
    scrollbar-color: #6c757d #e9ecef; /* For Firefox */
}

    /* Custom scrollbar for webkit browsers (Chrome, Safari, Edge) */
    main.overflow-auto::-webkit-scrollbar {
        width: 12px;
        background-color: #f8f9fa;
    }

    main.overflow-auto::-webkit-scrollbar-track {
        background: #e9ecef;
        border-radius: 6px;
        margin: 5px;
    }

    main.overflow-auto::-webkit-scrollbar-thumb {
        background: linear-gradient(180deg, #6c757d 0%, #495057 100%);
        border-radius: 6px;
        border: 2px solid #e9ecef;
        min-height: 30px;
    }

        main.overflow-auto::-webkit-scrollbar-thumb:hover {
            background: linear-gradient(180deg, #495057 0%, #343a40 100%);
        }

        main.overflow-auto::-webkit-scrollbar-thumb:active {
            background: linear-gradient(180deg, #343a40 0%, #212529 100%);
        }

/* Alternative method - Force scrollbar to always show */
.always-show-scrollbar {
    overflow-y: scroll !important;
}

/* For testing - add temporary content to force scrollbar */
.force-scroll-test {
    min-height: 150vh;
    background: linear-gradient( to bottom, #f8f9fa 0%, #e9ecef 25%, #dee2e6 50%, #ced4da 75%, #adb5bd 100% );
}

/* Responsive adjustments for fixed layout */
@media (max-width: 992px) {
    main.overflow-auto {
        padding-top: 70px !important;
        padding-bottom: 75px !important;
    }
}

@media (max-width: 768px) {
    main.overflow-auto {
        padding-top: 65px !important;
        padding-bottom: 70px !important;
    }

    .navbar-brand span {
        font-size: 0.9rem;
    }

    .fixed-bottom .container-fluid {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
}

/* Modal and dialog positioning fixes */
.modal {
    z-index: 1050;
}

.modal-backdrop {
    z-index: 1040;
}

/* Ensure modals appear correctly with fixed layout */
.modal.show {
    padding-right: 0 !important;
}

.modal-dialog-centered {
    min-height: calc(100vh - 3rem);
}

/* Toast positioning to avoid footer overlap */
.toast-container {
    z-index: 1060;
    right: 1rem !important;
    position: fixed !important;
    margin-bottom: 80px; /* Space for fixed footer */
}
#notificationToast {
    right: 1rem !important;
    position: fixed !important;
}

/* Better modal spacing on mobile */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-dialog-centered {
        min-height: calc(100vh - 1rem);
    }
}

@media (max-width: 768px) {
    main.overflow-auto::-webkit-scrollbar {
        width: 10px;
    }

    main.overflow-auto::-webkit-scrollbar-thumb {
        border: 1px solid #e9ecef;
    }
}

@media (max-width: 576px) {
    main.overflow-auto::-webkit-scrollbar {
        width: 8px;
    }

    main.overflow-auto {
        padding-top: 60px !important;
        padding-bottom: 65px !important;
    }

    .navbar-brand {
        font-size: 0.8rem;
    }

        .navbar-brand img {
            height: 25px !important;
        }
}

/* Navigation enhancements */
.navbar-brand {
    transition: transform 0.2s ease-in-out;
}

    .navbar-brand:hover {
        transform: scale(1.05);
    }

.nav-link {
    transition: all 0.2s ease-in-out;
    border-radius: 0.375rem;
    margin: 0 0.25rem;
}

    .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.1);
        transform: translateY(-1px);
    }

/* Dropdown enhancements */
.dropdown-menu {
    text-align:left;
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    min-width: 250px; /* หรือค่าอื่นที่กว้างพอสำหรับเมนูที่ยาวที่สุด */
}

.dropdown-item {
    transition: all 0.2s ease-in-out;
    border-radius: 0.375rem;
    margin: 0.125rem 0.5rem;
}

    .dropdown-item:hover {
        background-color: var(--bs-primary);
        color: white;
        transform: translateX(-8px);
    }


/* Card enhancements */
.card {
    transition: all 0.3s ease-in-out;
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

    .card:hover {
        transform: translateY(-2px);
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    }

/* Button enhancements */
.btn {
    transition: all 0.2s ease-in-out;
    border-radius: 0.5rem;
}

    .btn:hover {
        transform: translateY(-1px);
    }

/* Form enhancements */
.form-control, .form-select {
    border-radius: 0.5rem;
    transition: all 0.2s ease-in-out;
}

    .form-control:focus, .form-select:focus {
        transform: scale(1.02);
        box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
    }

/* Table enhancements */
.table {
    border-radius: 0.5rem;
    overflow: hidden;
}

    .table thead th {
        background-color: var(--bs-primary);
        color: white;
        font-weight: 600;
        border: none;
    }

    .table tbody tr {
        transition: all 0.2s ease-in-out;
    }

        .table tbody tr:hover {
            background-color: rgba(var(--bs-primary-rgb), 0.1);
            transform: scale(1.01);
        }

/* Alert enhancements */
.alert {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Loading spinner */
.spinner-custom {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: -0.125em;
    border: 0.125em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

/* Breadcrumb enhancements */
.breadcrumb {
    background-color: rgba(var(--bs-light-rgb), 0.5);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.breadcrumb-item a {
    color: var(--bs-primary);
    text-decoration: none;
    transition: all 0.2s ease-in-out;
}

    .breadcrumb-item a:hover {
        color: var(--bs-primary);
        text-decoration: underline;
    }

/* Footer enhancements */
footer {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* Responsive utilities */
@media (max-width: 768px) {
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .table-responsive {
        font-size: 0.875rem;
    }

    /* Ensure tables don't break fixed layout */
    .table-responsive {
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }
}

/* Custom animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

/* Toast enhancements */
.toast {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Status indicators */
.status-active {
    color: var(--bs-success);
}

.status-inactive {
    color: var(--bs-danger);
}

.status-pending {
    color: var(--bs-warning);
}


/* Custom styles for Part Transfer System */
.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

.badge {
    font-size: 0.85em;
}

.btn-group-sm > .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.alert {
    border: none;
    border-radius: 0.5rem;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-danger {
    background-color: #f8d7da;
    color: #842029;
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.table th {
    border-top: none;
    font-weight: 600;
    vertical-align: middle;
}

.table td {
    vertical-align: middle;
}

.text-muted {
    color: #6c757d !important;
}

.btn-outline-primary:hover {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-outline-danger:hover {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-outline-success:hover {
    color: #fff;
    background-color: #198754;
    border-color: #198754;
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Custom scrollbar */
.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

    .table-responsive::-webkit-scrollbar-thumb:hover {
        background: #555;
    }

/* Responsive design */
@media (max-width: 768px) {
    .btn-group {
        flex-direction: column;
    }

        .btn-group .btn {
            margin-bottom: 0.25rem;
        }

    .table-responsive {
        font-size: 0.875rem;
    }
}

/* Print styles */
@media print {
    .btn, .modal, .alert {
        display: none !important;
    }

    .table {
        border-collapse: collapse !important;
    }

        .table td, .table th {
            border: 1px solid #000 !important;
        }
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}



/* --- Preloader Styles --- */

 #preloader {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: #ffffff;
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 9999;
        transition: opacity 0.5s ease-out, visibility 0s 0.5s;
    }

    .loader-text {
        font-size: 2rem;
        font-weight: bold;
        color: #007bff;
        animation: fadeInOut 1.5s infinite;
    }

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}
.table-overlay {
    position: absolute; /* ทำให้ลอยอยู่เหนือ Parent (ที่มี position-relative) */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(200, 200, 200, 0.45); /* สีเทาอ่อนๆ แบบโปร่งแสง 50% */
    z-index: 2; /* ทำให้มั่นใจว่า div นี้จะอยู่ทับตาราง */
    pointer-events: none; /* ทำให้สามารถคลิกทะลุ div นี้ไปได้ (เผื่อในอนาคต) */
}