/* ============================================================
   IWS Global Custom Styles
   (Extracted from resources/views/layout/master.blade.php)
   ============================================================ */

.item-note-container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.item-note-text-wrapper {
    flex: 1;
    overflow: hidden;
    word-break: break-word;
    max-height: 80px;
    overflow-y: auto;
}

.item-note-text {
    white-space: pre-line;
}

.edit-note-btn, .view-full-note-btn {
    flex-shrink: 0;
    margin-left: 5px;
}

.note-editor {
    min-height: 100px;
    resize: vertical;
}

.toast-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    position: fixed;
}

.swal-custom-popup {
    width: 600px !important;
    height: auto !important;
    max-width: 1000px !important;
}

.custom-input {
    width: 100% !important;
    padding: 10px !important;
    font-size: 16px !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    margin: 5px !important;
    height: 2em !important;
}

.custom-textarea {
    width: 100% !important;
    padding: 10px !important;
    font-size: 16px !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    height: 4em !important;
    margin: 0px !important;
}

.swal2-label {
    margin-top: 0.5rem;
    display: block;
    text-align: left;
    font-weight: 500;
    color: #181c32;
}

.input-group > .select2-container--bootstrap5 {
    width: auto !important;
    flex: 1 1 auto;
}

.input-group > .select2-container--bootstrap5 .select2-selection--single {
    height: 100%;
    line-height: inherit;
    padding: 0.5rem 1rem;
}

/* Table */
.dataTable thead,
.dataTable tfoot {
    --bs-bg-rgb-color: var(--bs-gray-300-rgb);
    background-color: var(--bs-gray-300) !important;
    font-weight: 700 !important;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
    border-radius: 5px;
    --bs-bg-rgb-color: var(--bs-gray-300-rgb);
    background-color: var(--bs-gray-300) !important;
}

.table-responsive::-webkit-scrollbar-thumb {
    border-radius: 5px;
    --bs-bg-rgb-color: var(--bs-gray-800-rgb);
    background-color: var(--bs-gray-800) !important;
}

.dt-hasChild + tr td {
    padding: 0 !important;
    padding-bottom: 10px !important;
}

.form-switch.form-check-solid .form-check-input:not(:checked) {
    background-color: #4c4c60;
}

/* Capacity Cards */
.capacity-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.capacity-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.65rem;
    border-radius: 0.475rem;
    font-size: 0.85rem;
    gap: 0.5rem;
    background-color: #f9f9f9;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.03);
}

.capacity-tag i {
    font-size: 1rem;
}

.capacity-tag .capacity-value {
    font-weight: 700;
}

.capacity-tag small {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-left: 0.15rem;
}

.capacity-tag button {
    width: 22px;
    height: 22px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.25rem;
}

.capacity-tag button i {
    font-size: 0.85rem;
}

/* Tag colors */
.capacity-tag.daily-capacity {
    border-left: 3px solid #009ef7;
    color: #009ef7;
    background-color: #f1faff;
}

.capacity-tag.recipe-capacity {
    border-left: 3px solid #50cd89;
    color: #50cd89;
    background-color: #e8fff3;
}

.capacity-tag.material-capacity {
    border-left: 3px solid #B84FB0;
    color: #8E3D86;
    background-color: #F7EAF6;
}

/* Capacity Details Popup */
.capacity-details-popup {
    position: absolute;
    width: 400px;
    max-width: 95vw;
    background-color: #ffffff;
    border-radius: 0.85rem;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    z-index: 100;
    right: 20px;
    margin-top: 10px;
    overflow: hidden;
    border: 1px solid #e4e6ef;
}

.capacity-details-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px dashed #e4e6ef;
}

.capacity-details-header h3 {
    font-size: 1rem;
    margin: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.capacity-details-content {
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.capacity-details-info {
    padding: 0.75rem;
    background-color: #f9f9f9;
    border-radius: 0.475rem;
    margin-bottom: 1rem;
}

.capacity-info-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

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

.info-label {
    font-size: 0.85rem;
    color: #7e8299;
    width: 140px;
    flex-shrink: 0;
}

.info-value {
    font-weight: 600;
    font-size: 0.95rem;
}

.info-unit {
    font-size: 0.8rem;
    color: #7e8299;
    margin-left: 0.25rem;
}

.limiting-items-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #181c32;
}

.limiting-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed #e4e6ef;
}

.limiting-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.limiting-item-icon {
    width: 30px;
    height: 30px;
    border-radius: 0.475rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.limiting-item-content {
    flex: 1;
    min-width: 0;
}

.limiting-item-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    color: #181c32;
}

.limiting-item-progress {
    height: 5px;
    border-radius: 0.475rem;
    background-color: #f9f9f9;
    margin-bottom: 0.35rem;
    overflow: hidden;
}

.limiting-item-bar {
    height: 100%;
}

.limiting-item-bar.recipe-bar {
    background-color: #50cd89;
}

.limiting-item-bar.material-bar {
    background-color: #ffc700;
}

.limiting-item-details {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8rem;
    color: #7e8299;
}

.limiting-item-detail-value {
    font-weight: 600;
    color: #181c32;
}

/* Animations */
@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.highlight-value {
    animation: pulse 0.5s ease-in-out;
}

/* Production Order Drawer — Mobile */
@media (max-width: 767.98px) {
    #kt_drawer_production_order_view .card-body {
        padding: 0.75rem !important;
    }

    #kt_drawer_production_order_view .fs-5 {
        font-size: 0.95rem !important;
    }

    #kt_drawer_production_order_view .card-title .fs-4 {
        font-size: 1.1rem !important;
    }

    #kt_drawer_production_order_view .table th,
    #kt_drawer_production_order_view .table td {
        padding: 0.5rem;
        white-space: normal;
    }

    #kt_drawer_production_order_view .table th:nth-child(5),
    #kt_drawer_production_order_view .table td:nth-child(5) {
        display: none;
    }
}

/* Production Order Drawer — Scrollbar */
#kt_drawer_production_order_view .hover-scroll-overlay-y::-webkit-scrollbar {
    width: 5px;
}

#kt_drawer_production_order_view .hover-scroll-overlay-y::-webkit-scrollbar-thumb {
    background-color: #d1d1d1;
    border-radius: 5px;
}

#kt_drawer_production_order_view .hover-scroll-overlay-y::-webkit-scrollbar-track {
    background-color: #f1f1f1;
}

/* Blink Animation */
@keyframes blink-animation {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

.animation-blink {
    animation: blink-animation 1.5s ease infinite;
}

.badge-circle {
    font-size: 0.65rem;
    width: 1.25rem;
    height: 1.25rem;
    min-height: 1.25rem !important;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -0.1rem;
    margin-left: -0.5rem;
}

/* Desktop Scrollbar */
@media (min-width: 992px) {
    div:hover, main:hover, ol:hover, pre:hover, span:hover, ul:hover {
        scrollbar-color: var(--bs-scrollbar-hover-color) transparent;
    }

    .table-responsive {
        scrollbar-width: auto;
        scrollbar-color: #b6b5b5 #f1f1f1;
    }

    .table-responsive::-webkit-scrollbar {
        height: 12px;
    }

    .table-responsive::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .table-responsive::-webkit-scrollbar-thumb {
        background-color: #888;
        border-radius: 6px;
        border: 3px solid #f1f1f1;
    }

    .table-responsive::-webkit-scrollbar-thumb:hover {
        background-color: #555;
    }
}
