﻿/* =========================================================
   MasterBatchSystem
   Customer Management
   ========================================================= */

.customer-page {
    direction: rtl;
    color: #1f2937;
}


    /* =========================================================
   Page Header
   ========================================================= */

    .customer-page .page-header {
        background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
        border: 1px solid #e5e7eb;
        border-radius: 20px;
        padding: 24px 28px;
        margin-bottom: 24px;
        box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05);
    }

    .customer-page .page-title {
        font-size: 1.55rem;
        font-weight: 800;
        margin: 0;
        color: #111827;
    }

    .customer-page .page-subtitle {
        color: #6b7280;
        margin: 6px 0 0;
        font-size: .9rem;
    }


    /* =========================================================
   New Customer Button
   ========================================================= */

    .customer-page .btn-new-customer {
        border: none;
        border-radius: 12px;
        padding: 11px 20px;
        font-weight: 700;
        box-shadow: 0 6px 15px rgba(13, 110, 253, .20);
        transition: all .2s ease;
    }

        .customer-page .btn-new-customer:hover {
            transform: translateY(-2px);
            box-shadow: 0 9px 20px rgba(13, 110, 253, .28);
        }


    /* =========================================================
   Statistics
   ========================================================= */

    .customer-page .stat-card {
        position: relative;
        overflow: hidden;
       
        border: 1px solid #edf0f3;
        border-radius: 18px;
        padding: 22px;
        height: 100%;
        box-shadow: 0 5px 18px rgba(15, 23, 42, .05);
        transition: all .25s ease;
    }

        .customer-page .stat-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 12px 28px rgba(15, 23, 42, .09);
        }

        .customer-page .stat-card::after {
            content: "";
            position: absolute;
            width: 90px;
            height: 90px;
            border-radius: 50%;
            left: -35px;
            bottom: -35px;
            background: rgba(13, 110, 253, .045);
        }

    .customer-page .stat-icon {
        width: 52px;
        height: 52px;
        border-radius: 15px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.35rem;
    }

        .customer-page .stat-icon.blue {
            background: #eaf2ff;
            color: var(--theme-primary);
        }

        .customer-page .stat-icon.green {
            background: #eaf8f0;
            color: #198754;
        }

        .customer-page .stat-icon.orange {
            background: #fff4df;
            color: #f59e0b;
        }

    .customer-page .stat-title {
        font-size: .82rem;
        color: #6b7280;
        margin-bottom: 6px;
    }

    .customer-page .stat-number {
        font-size: 1.7rem;
        font-weight: 800;
        color: #111827;
    }


    /* =========================================================
   Main Table Card
   ========================================================= */

    .customer-page .customer-card {
        background: #ffffff;
        border: 1px solid #e9edf2;
        border-radius: 20px;
        overflow: hidden;
        box-shadow: 0 7px 25px rgba(15, 23, 42, .055);
    }


    /* =========================================================
   Table Header
   ========================================================= */

    .customer-page .customer-card-header {
        padding: 20px 24px;
        border-bottom: 1px solid #edf0f3;
        background: #ffffff;
    }

    .customer-page .list-title {
        font-weight: 800;
        color: #111827;
        margin: 0;
    }

    .customer-page .list-count {
        color: #8a94a6;
        font-size: .78rem;
    }


    /* =========================================================
   Search
   ========================================================= */

    .customer-page .search-box {
        position: relative;
    }

        .customer-page .search-box .search-icon {
            position: absolute;
            right: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: #9ca3af;
            z-index: 3;
        }

        .customer-page .search-box input {
            height: 46px;
            border: 1px solid #e1e6ec;
            border-radius: 12px;
            padding-right: 43px;
            padding-left: 45px;
            background: #f9fafb;
            transition: all .2s ease;
        }

            .customer-page .search-box input:focus {
                background: #ffffff;
                border-color: #86b7fe;
                box-shadow: 0 0 0 4px rgba(13, 110, 253, .08);
            }

    .customer-page .clear-search {
        position: absolute;
        left: 8px;
        top: 50%;
        transform: translateY(-50%);
        border: none;
        background: transparent;
        color: #9ca3af;
        z-index: 3;
    }

        .customer-page .clear-search:hover {
            color: #dc3545;
        }


    /* =========================================================
   Table
   ========================================================= */

    .customer-page .customer-table {
        margin: 0;
    }

        .customer-page .customer-table thead th {
            background: #f8fafc;
            border-bottom: 1px solid #e5e7eb;
            color: #6b7280;
            font-size: .78rem;
            font-weight: 700;
            padding: 15px 18px;
            white-space: nowrap;
        }

        .customer-page .customer-table tbody td {
            padding: 15px 18px;
            border-bottom: 1px solid #f0f2f5;
            vertical-align: middle;
        }

        .customer-page .customer-table tbody tr {
            transition: background .15s ease;
        }

            .customer-page .customer-table tbody tr:hover {
                background: #f8fbff;
            }

            .customer-page .customer-table tbody tr:last-child td {
                border-bottom: none;
            }


    /* =========================================================
   Customer Avatar
   ========================================================= */

    .customer-page .customer-avatar {
        width: 20px;
        height: 20px;
        min-width: 43px;
        border-radius: 13px;
        background: linear-gradient(135deg, var(--theme-primary-dark), var(--theme-primary));
        color: #ffffff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 800;
        box-shadow: 0 5px 12px rgba(13, 110, 253, .18);
        margin-right:6px;
    }


    /* =========================================================
   Customer Name
   ========================================================= */

    .customer-page .customer-name {
        padding-right:6px;
        font-weight: 700;
        color: #1f2937;
    }

    .customer-page .customer-mobile {
        font-size: .75rem;
        color: #8a94a6;
        margin-top: 3px;
    }


    /* =========================================================
   Customer Code
   ========================================================= */

    .customer-page .customer-code {
        display: inline-flex;
        align-items: center;
        background: #eef5ff;
        color: var(--theme-primary);
        border: 1px solid #d7e7ff;
        border-radius: 9px;
        padding: 6px 11px;
        font-weight: 700;
        font-size: .8rem;
    }


    /* =========================================================
   Company
   ========================================================= */

    .customer-page .company-name {
      
        font-weight: 600;
    }

    .customer-page .muted {
        color: #adb5bd;
    }


    /* =========================================================
   Action Buttons
   ========================================================= */

    .customer-page .action-buttons {
        display: flex;
        justify-content: center;
        gap: 6px;
    }

    .customer-page .action-btn {
        width: 34px;
        height: 34px;
        border-radius: 9px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid #e5e7eb;
        background: #ffffff;
        transition: all .18s ease;
    }

        .customer-page .action-btn.view {
            color: #0dcaf0;
        }

        .customer-page .action-btn.edit {
            color: #f59e0b;
        }

        .customer-page .action-btn.delete {
            color: #dc3545;
        }

        .customer-page .action-btn:hover {
            transform: translateY(-2px);
        }

        .customer-page .action-btn.view:hover {
            background: #e9fbff;
            border-color: #b8eff8;
        }

        .customer-page .action-btn.edit:hover {
            background: #fff8e8;
            border-color: #ffe2a9;
        }

        .customer-page .action-btn.delete:hover {
            background: #fff0f1;
            border-color: #ffc9ce;
        }


    /* =========================================================
   Empty State
   ========================================================= */

    .customer-page .empty-state {
        text-align: center;
        padding: 70px 20px;
    }

    .customer-page .empty-icon {
        width: 90px;
        height: 90px;
        margin: 0 auto 20px;
        border-radius: 25px;
        background: #eef5ff;
        color: var(--theme-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 2.7rem;
    }

    .customer-page .empty-title {
        font-weight: 800;
        color: #1f2937;
    }

    .customer-page .empty-text {
        color: #8a94a6;
        margin-bottom: 22px;
    }


    /* =========================================================
   Footer
   ========================================================= */

    .customer-page .customer-card-footer {
        padding: 15px 22px;
        border-top: 1px solid #edf0f3;
        background: #ffffff;
        color: #8a94a6;
        font-size: .8rem;
    }


    /* =========================================================
   Loading
   ========================================================= */

    .customer-page .loading-state {
        padding: 70px 20px;
        text-align: center;
    }

    .customer-page .loading-spinner {
        width: 42px;
        height: 42px;
    }


    /* =========================================================
   Alert
   ========================================================= */

    .customer-page .error-alert {
        border: none;
        border-radius: 13px;
        box-shadow: 0 5px 15px rgba(220, 53, 69, .08);
    }


/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 768px) {

    .customer-page .page-header {
        padding: 20px;
    }

    .customer-page .page-title {
        font-size: 1.3rem;
    }

    .customer-page .customer-card-header {
        padding: 18px;
    }

    .customer-page .customer-table thead th,
    .customer-page .customer-table tbody td {
        padding: 12px;
    }

    .customer-page .action-buttons {
        gap: 4px;
    }

    .delete-warning-icon {
        width: 52px;
        height: 52px;
        border-radius: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(220, 53, 69, 0.10);
        color: #dc3545;
        font-size: 1.35rem;
    }


    .customer-delete-info {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }


    .delete-info-item {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 16px;
        border: 1px solid #e9ecef;
        border-radius: 14px;
        background: #ffffff;
        transition: all 0.2s ease;
    }


        .delete-info-item:hover {
            border-color: #dee2e6;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
            transform: translateY(-1px);
        }


    .delete-info-icon {
        width: 42px;
        height: 42px;
        flex-shrink: 0;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #f1f3f5;
        color: #495057;
        font-size: 1.05rem;
    }


    .delete-info-label {
        font-size: 0.78rem;
        color: #6c757d;
        margin-bottom: 3px;
    }


    .delete-info-value {
        font-weight: 600;
        color: #212529;
        word-break: break-word;
    }


    @media (max-width: 768px) {

        .customer-delete-info {
            grid-template-columns: 1fr;
        }
    }
}

/* =========================================================
   Order Management
   ========================================================= */

.orders-page {
    color: #1f2937;
}

.orders-page .page-header {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, .05);
}

.orders-page .page-title {
    font-size: 1.55rem;
    font-weight: 800;
    margin: 0;
    color: #111827;
}

.orders-page .page-subtitle {
    color: #6b7280;
    margin-top: 6px;
    font-size: .9rem;
}

.orders-new-button {
    border: none;
    border-radius: 12px;
    padding: 11px 20px;
    font-weight: 700;
    box-shadow: 0 6px 15px rgba(13, 110, 253, .2);
}

.order-stat-card,
.order-detail-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    height: 100%;
    padding: 20px 22px;
    background: #fff;
    border: 1px solid #edf0f3;
    border-radius: 18px;
    box-shadow: 0 5px 18px rgba(15, 23, 42, .05);
}

.order-stat-label,
.order-detail-stat-label {
    color: #6b7280;
    font-size: .82rem;
    margin-bottom: 6px;
}

.order-stat-value,
.order-detail-stat-value {
    
    font-size: 1.35rem;
    font-weight: 800;
}

.order-detail-stat-value {
    font-size: 1rem;
}

.order-stat-icon,
.order-detail-stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    border-radius: 15px;
    font-size: 1.25rem;
}

.order-detail-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
}

.order-stat-icon.blue,
.order-detail-stat-icon.blue {
    color: var(--theme-primary);
    background: #eaf2ff;
}

.order-stat-icon.green,
.order-detail-stat-icon.green {
    color: #198754;
    background: #eaf8f0;
}

.order-stat-icon.orange,
.order-detail-stat-icon.orange {
    color: #f59e0b;
    background: #fff4df;
}

.order-stat-icon.purple,
.order-detail-stat-icon.purple {
    color: #6f42c1;
    background: #f1eafe;
}

.orders-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid #e9edf2;
    border-radius: 20px;
    box-shadow: 0 7px 25px rgba(15, 23, 42, .055);
}

.orders-card-header,
.orders-section-header {
    padding: 20px 24px;
    border-bottom: 1px solid #edf0f3;
    background: #fff;
}

.orders-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.orders-search-box {
    position: relative;
}

.orders-search-box > i {
    position: absolute;
    top: 50%;
    right: 15px;
    z-index: 2;
    color: #9ca3af;
    transform: translateY(-50%);
}

.orders-search-box input {
    height: 44px;
    padding-right: 42px;
    padding-left: 42px;
    border-radius: 11px;
}

.orders-clear-search {
    position: absolute;
    top: 50%;
    left: 9px;
    z-index: 2;
    padding: 3px 6px;
    color: #9ca3af;
    background: transparent;
    border: 0;
    transform: translateY(-50%);
}

.orders-clear-search:hover {
    color: #dc3545;
}

.orders-table {
    min-width: 1000px;
}

.orders-table thead th,
.order-item-table thead th,
.order-formulas-table thead th {
    padding: 14px 16px;
    color: #6b7280;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

.orders-table tbody td {
    padding: 15px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f0f2f5;
}

.orders-table tbody tr:last-child td {
    border-bottom: 0;
}

.orders-table tbody tr:hover {
    background: #f8fbff;
}

.order-number-link {
    padding: 0;
    color: var(--theme-primary);
    font-weight: 800;
    background: transparent;
    border: 0;
}

.order-number-link:hover {
    text-decoration: underline;
}

.order-id-caption {
    margin-top: 4px;
    color: #9ca3af;
    font-size: .72rem;
}

.order-product-summary {
    max-width: 230px;
    overflow: hidden;
    color: #374151;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.orders-action-buttons {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.orders-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: #6b7280;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 9px;
    transition: all .18s ease;
}

.orders-action-button:hover {
    transform: translateY(-2px);
}

.orders-action-button.view {
    color: #0dcaf0;
}

.orders-action-button.edit {
    color: #f59e0b;
}

.orders-action-button.delete {
    color: #dc3545;
}

.orders-action-button.view:hover {
    background: #e9fbff;
    border-color: #b8eff8;
}

.orders-action-button.edit:hover {
    background: #fff8e8;
    border-color: #ffe2a9;
}

.orders-action-button.delete:hover {
    background: #fff0f1;
    border-color: #ffc9ce;
}

.order-status {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .73rem;
    font-weight: 700;
    white-space: nowrap;
}

.order-status-draft {
    color: #495057;
    background: #f1f3f5;
    border-color: #dee2e6;
}

.order-status-sample {
    color: #6f42c1;
    background: #f1eafe;
    border-color: #dfd0fb;
}

.order-status-sample-sent {
    color: #087990;
    background: #e5f8fc;
    border-color: #b8eff8;
}

.order-status-waiting {
    color: #946200;
    background: #fff4d6;
    border-color: #ffe69c;
}

.order-status-production {
    color: #055160;
    background: #dff6fb;
    border-color: #b6effb;
}

.order-status-depot {
    color: #055160;
    background: #e2f3f5;
    border-color: #badde1;
}

.order-status-shipped,
.order-status-completed {
    color: #146c43;
    background: #e8f5e9;
    border-color: #badbcc;
}

.order-status-confirmed {
    color: #084298;
    background: #e7f1ff;
    border-color: #b6d4fe;
}

.order-status-cancelled {
    color: #b02a37;
    background: #f8d7da;
    border-color: #f1aeb5;
}

.order-status-unknown {
    color: #495057;
    background: #e9ecef;
    border-color: #ced4da;
}

.orders-card-footer {
    padding: 15px 22px;
    color: #8a94a6;
    font-size: .8rem;
    background: #fff;
    border-top: 1px solid #edf0f3;
}

.orders-loading-state,
.orders-empty-state {
    padding: 70px 20px;
    text-align: center;
}

.orders-details-loading {
    background: #fff;
    border: 1px solid #e9edf2;
    border-radius: 20px;
}

.orders-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 90px;
    height: 90px;
    margin: 0 auto 20px;
    color: var(--theme-primary);
    font-size: 2.7rem;
    background: #eef5ff;
    border-radius: 25px;
}

.orders-empty-state h5 {
    color: #1f2937;
    font-weight: 800;
}

.orders-empty-state p {
    margin-bottom: 22px;
    color: #8a94a6;
}

.orders-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #8a94a6;
    font-size: .8rem;
}

.orders-breadcrumb button {
    padding: 0;
    color: var(--theme-primary);
    background: transparent;
    border: 0;
}

.order-number-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 13px;
    color: var(--theme-primary);
    font-weight: 800;
    background: #eef5ff;
    border: 1px solid #d7e7ff;
    border-radius: 10px;
}

.order-field {
    height: 100%;
    padding: 13px 15px;
    background: #f8fafc;
    border: 1px solid #edf0f3;
    border-radius: 12px;
}

.order-field span {
    display: block;
    margin-bottom: 6px;
    color: #8a94a6;
    font-size: .76rem;
}

.order-field strong,
.order-field a {
    
    font-size: .9rem;
    font-weight: 700;
    text-decoration: none;
}

.order-field a {
    color: var(--theme-primary);
}

.order-description {
    padding: 5px 5px;
    color: #374151;
    line-height: 1;
    white-space: pre-wrap;
    background: #fafbfc;
    border: 1px solid #edf0f3;
    border-radius: 12px;
}

.order-description-title {
    margin-bottom: 5px;
    color: #6b7280;
    font-size: .65rem;
    font-weight: 700;
}

.order-item-card {
    overflow: hidden;
    border: 1px solid #e4e9ef;
    border-radius: 16px;
}

.order-item-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 18px;
    background: #f8fafc;
    border-bottom: 1px solid #e4e9ef;
}

.order-items-section-header {
    gap: 16px;
}

.order-items-toggle {
    min-width: 108px;
}

.order-items-panel {
    position: relative;
}

.order-items-panel::before {
    position: absolute;
    top: 30px;
    right: 27px;
    bottom: 30px;
    width: 2px;
    content: "";
    background: #e0ebfa;
}

.order-items-panel .order-item-card {
    position: relative;
    z-index: 1;
    margin-right: 18px;
    overflow: visible;
    background: #fff;
}

.order-items-panel .order-item-card::before {
    position: absolute;
    top: 31px;
    right: -18px;
    width: 18px;
    content: "";
    border-top: 2px solid #e0ebfa;
}

.order-items-panel .order-item-card-header {
    border-radius: 16px 16px 0 0;
}

.order-items-panel .order-item-card-body {
    border-radius: 0 0 16px 16px;
}

.order-items-panel .order-item-card.is-collapsed .order-item-card-header {
    border-radius: 16px;
}

.order-item-toggle {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    min-width: 0;
    gap: 12px;
    padding: 0;
    color: inherit;
    text-align: right;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.order-item-toggle:focus-visible,
.order-items-toggle:focus-visible {
    outline: 3px solid rgba(13, 110, 253, .22);
    outline-offset: 2px;
}

.order-item-toggle-icon {
    display: inline-flex;
    flex: 0 0 26px;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    color: var(--theme-primary);
    background: #eef5ff;
    border-radius: 8px;
}

.order-item-title {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
}

.order-item-product-name {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: #1f2937;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-item-card-body {
    background: #fff;
}

.order-item-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    color: var(--theme-primary);
    font-weight: 800;
    background: #eaf2ff;
    border-radius: 11px;
}

.order-item-table {
    min-width: 620px;
}

.order-item-table tbody td,
.order-formulas-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #f0f2f5;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    color: #6b7280;
    font-size: .78rem;
}

.progress-label strong {
    color: #374151;
}

.order-progress {
    height: 8px;
    background: #edf0f3;
    border-radius: 999px;
}

.order-item-details-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.order-item-detail {
    padding: 10px 12px;
    background: #fafbfc;
    border: 1px solid #edf0f3;
    border-radius: 10px;
}

.order-item-detail span {
    display: block;
    margin-bottom: 4px;
    color: #8a94a6;
    font-size: .72rem;
}

.order-item-detail strong {
    color: #374151;
    font-size: .82rem;
}

.order-formulas-box {
    padding: 13px 15px;
    background: #fbfcfe;
    border: 1px solid #e5eaf0;
    border-radius: 12px;
}

.order-formulas-table {
    min-width: 650px;
}

.edit-order-items-note {
    padding: 12px 14px;
    color: #5c6675;
    font-size: .82rem;
    line-height: 1.8;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 11px;
}

/* =========================================================
   Production Batch Management
   ========================================================= */

.production-page .page-header {
    margin-bottom: 24px;
}

.production-table {
    min-width: 1100px;
}

.production-table thead th,
.production-material-details-table thead th {
    padding: 14px 16px;
    color: #6b7280;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

.production-table tbody td,
.production-material-details-table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f0f2f5;
}

.production-lot-link {
    padding: 0;
    color: var(--theme-primary);
    font-weight: 800;
    background: transparent;
    border: 0;
}

.production-lot-link:hover {
    text-decoration: underline;
}

.production-product-name {
    color: #1f2937;
    font-weight: 700;
}

.production-muted-caption {
    margin-top: 4px;
    color: #9ca3af;
    font-size: .72rem;
}

.production-unit {
    color: #8a94a6;
    font-size: .75rem;
}

.production-action-buttons {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.production-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: #6b7280;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 9px;
    transition: all .18s ease;
}

.production-action-button:hover {
    transform: translateY(-2px);
}

.production-action-button.view {
    color: #0dcaf0;
}

.production-action-button.edit {
    color: #f59e0b;
}

.production-action-button.delete {
    color: #dc3545;
}

.production-status {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .73rem;
    font-weight: 700;
    white-space: nowrap;
}

.production-status.created {
    color: #495057;
    background: #f1f3f5;
    border-color: #dee2e6;
}

.production-status.weighing,
.production-status.mixing {
    color: #946200;
    background: #fff4d6;
    border-color: #ffe69c;
}

.production-status.extrusion {
    color: #055160;
    background: #dff6fb;
    border-color: #b6effb;
}

.production-status.completed {
    color: #146c43;
    background: #e8f5e9;
    border-color: #badbcc;
}

.production-status.rejected,
.production-status.cancelled {
    color: #b02a37;
    background: #f8d7da;
    border-color: #f1aeb5;
}

.production-status.unknown {
    color: #495057;
    background: #e9ecef;
    border-color: #ced4da;
}

.production-stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 100%;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid #edf0f3;
    border-radius: 16px;
    box-shadow: 0 5px 18px rgba(15, 23, 42, .05);
}

.production-stat-label {
    color: #6b7280;
    font-size: .8rem;
}

.production-stat-card strong {
    color: #1f2937;
    font-size: .95rem;
    font-weight: 800;
    text-align: left;
}

.production-lot-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 13px;
    color: var(--theme-primary);
    font-weight: 800;
    background: #eef5ff;
    border: 1px solid #d7e7ff;
    border-radius: 10px;
}

.production-batch-editor {
    color: #263238;
}

.production-editor-section {
    padding: 16px;
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid #e5eaf0;
    border-radius: 14px;
}

.production-editor-section:last-child {
    margin-bottom: 0;
}

.production-editor-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: #37474f;
    font-size: .95rem;
    font-weight: 800;
}

.production-editor-section-title i {
    color: var(--theme-primary);
}

.production-label {
    display: block;
    margin-bottom: 5px;
    color: #455a64;
    font-size: .76rem;
    font-weight: 700;
}

.production-input,
.production-select {
    width: 100%;
    height: 38px;
    box-sizing: border-box;
    padding: 7px 10px;
    color: #263238;
    font-family: Tahoma, Arial, sans-serif;
    font-size: .8rem;
    background: #fff;
    border: 1px solid #cfd8dc;
    border-radius: 7px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.production-input:focus,
.production-select:focus {
    border-color: #607d8b;
    box-shadow: 0 0 0 3px rgba(96, 125, 139, .12);
}

.production-input::placeholder {
    color: #90a4ae;
}

.production-textarea {
    height: auto;
    min-height: 78px;
    line-height: 1.8;
    resize: vertical;
}

.production-batch-editor .persian-date-picker {
    position: relative;
    width: 100%;
}

.production-batch-editor .persian-date-picker .input-group {
    position: relative;
    display: block !important;
    width: 100%;
}

.production-batch-editor .persian-date-picker .shamsi-input {
    display: block !important;
    width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    box-sizing: border-box;
    padding: 7px 38px 7px 10px !important;
    color: #263238 !important;
    font-family: Tahoma, Arial, sans-serif !important;
    font-size: .8rem !important;
    text-align: center;
    direction: ltr;
    background: #fff !important;
    border: 1px solid #cfd8dc !important;
    border-radius: 7px !important;
    box-shadow: none !important;
}

.production-batch-editor .persian-date-picker .calendar-button {
    position: absolute !important;
    left: 4px;
    bottom: 4px;
    z-index: 2;
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
    padding: 0 !important;
    color: #37474f !important;
    background: #eceff1 !important;
    border: 0 !important;
    border-radius: 6px !important;
    line-height: 30px;
}

.production-batch-editor .persian-date-picker .calendar-button:hover {
    background: #cfd8dc !important;
}

.production-batch-editor .persian-date-picker .calendar-popup {
    width: 264px;
    padding: 9px;
    border-color: #e2e6ea;
    border-radius: 12px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .16);
}

.production-materials-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.production-material-list {
    display: grid;
    gap: 12px;
}

.production-material-card {
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #e5eaf0;
    border-radius: 12px;
}

.production-material-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 13px;
}

.production-material-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #37474f;
    font-size: .84rem;
    font-weight: 800;
}

.production-material-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--theme-primary);
    background: #eaf2ff;
    border-radius: 8px;
}

.production-empty-materials {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 5px;
    padding: 30px 20px;
    color: #6b7280;
    text-align: center;
    background: #f8fafc;
    border: 1px dashed #cfd8dc;
    border-radius: 12px;
}

.production-empty-materials i {
    margin-bottom: 4px;
    color: #90a4ae;
    font-size: 1.5rem;
}

.production-empty-materials small {
    color: #9ca3af;
}

.production-material-details-table {
    min-width: 900px;
}

.production-delete-card {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}

.production-delete-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    color: #dc3545;
    font-size: 1.45rem;
    background: rgba(220, 53, 69, .1);
    border-radius: 16px;
}

.production-delete-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
    text-align: right;
}

.production-delete-summary > div {
    padding: 13px;
    background: #fafbfc;
    border: 1px solid #edf0f3;
    border-radius: 11px;
}

.production-delete-summary span {
    display: block;
    margin-bottom: 5px;
    color: #8a94a6;
    font-size: .76rem;
}

.production-delete-summary strong {
    color: #1f2937;
}

.order-production-batches {
    padding: 13px 15px;
    background: #fbfcfe;
    border: 1px solid #e5eaf0;
    border-radius: 12px;
}

.order-production-batch-list {
    display: grid;
    gap: 7px;
}

.order-production-batch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 11px;
    color: #374151;
    text-decoration: none;
    background: #fff;
    border: 1px solid #edf0f3;
    border-radius: 9px;
    transition: background .15s, border-color .15s;
}

.order-production-batch-row:hover {
    color: var(--theme-primary);
    background: #f8fbff;
    border-color: #d7e7ff;
}

.order-production-batch-row > span:first-child {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.order-production-batch-row small {
    color: #8a94a6;
    font-size: .72rem;
}

@media (max-width: 768px) {
    .production-materials-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .production-materials-header .btn {
        width: 100%;
    }

    .production-delete-summary {
        grid-template-columns: 1fr;
    }
}

.order-delete-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    color: #dc3545;
    font-size: 1.35rem;
    background: rgba(220, 53, 69, .1);
    border-radius: 14px;
}

.order-delete-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.order-delete-summary > div {
    padding: 14px;
    background: #fafbfc;
    border: 1px solid #edf0f3;
    border-radius: 12px;
}

.order-delete-summary span {
    display: block;
    margin-bottom: 5px;
    color: #8a94a6;
    font-size: .76rem;
}

.order-delete-summary strong {
    color: #1f2937;
}

@media (max-width: 768px) {
    .orders-page .page-header {
        padding: 20px;
    }

    .orders-page .page-title {
        font-size: 1.3rem;
    }

    .orders-card-header,
    .orders-section-header {
        padding: 18px;
    }

    .order-item-card-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .order-item-toggle {
        width: 100%;
    }

    .order-item-card-header > .d-flex {
        width: 100%;
        justify-content: flex-end;
    }

    .order-items-panel {
        padding: 16px !important;
    }

    .order-items-panel::before {
        right: 15px;
    }

    .order-items-panel .order-item-card {
        margin-right: 12px;
    }

    .order-items-panel .order-item-card::before {
        right: -12px;
        width: 12px;
    }

    .order-item-details-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .order-delete-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .order-item-details-grid {
        grid-template-columns: 1fr;
    }

    .order-detail-stat {
        padding: 16px;
    }
}

.order-item-editor {
    overflow: hidden;
    border: 1px solid #e7ebf0;
    border-radius: 14px;
   
}

.order-item-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    
    border-bottom: 1px solid #e7ebf0;
}

.order-item-editor-number {
    display: inline-flex;
    align-items: center;
   
    font-weight: 700;
}

@media (max-width: 576px) {
    .order-item-editor-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* =========================================================
   Order Edit - هماهنگ با فرم ثبت سفارش
   ========================================================= */

.order-edit-page .order-edit-form .compact-input,
.order-edit-page .order-edit-form .compact-select {
    width: 100% !important;
    height: 36px !important;
    min-height: 36px !important;
    box-sizing: border-box;
    border: 1px solid #cfd8dc !important;
    border-radius: 6px !important;
    padding: 6px 9px !important;
    color: #263238 !important;
    background: #fff !important;
    font-family: Tahoma, Arial, sans-serif !important;
    font-size: 12.5px !important;
    line-height: 1.5;
    outline: none;
    box-shadow: none !important;
    transition: border-color .15s, box-shadow .15s;
}

.order-edit-page .order-edit-form .compact-input:focus,
.order-edit-page .order-edit-form .compact-select:focus {
    border-color: #607d8b !important;
    box-shadow: 0 0 0 3px rgba(96, 125, 139, .12) !important;
}

.order-edit-page .order-edit-form .compact-input::placeholder {
    color: #90a4ae;
}

.order-edit-page .order-edit-form .order-edit-fields {
    --bs-gutter-x: 12px;
    --bs-gutter-y: 12px;
}

.order-edit-page .order-edit-form textarea.compact-input {
    height: auto !important;
    min-height: 92px !important;
    line-height: 1.8;
    resize: vertical;
}

.order-edit-page .order-edit-form .compact-date-picker,
.order-edit-page .order-edit-form .compact-date-picker .persian-date-picker {
    position: relative;
    width: 100% !important;
}

.order-edit-page .order-edit-form .compact-date-picker .persian-date-picker {
    display: block !important;
    height: auto !important;
}

.order-edit-page .order-edit-form .compact-date-picker .input-group {
    position: relative;
    display: block !important;
    direction: rtl;
    width: 100% !important;
}

.order-edit-page .order-edit-form .compact-date-picker .shamsi-input {
    display: block !important;
    width: 100% !important;
    height: 36px !important;
    min-height: 36px !important;
    box-sizing: border-box;
    border: 1px solid #cfd8dc !important;
    border-radius: 6px !important;
    padding: 6px 38px 6px 9px !important;
    color: #263238 !important;
    background: #fff !important;
    font-family: Tahoma, Arial, sans-serif !important;
    font-size: 12.5px !important;
    direction: ltr;
    text-align: center;
    box-shadow: none !important;
}

.order-edit-page .order-edit-form .compact-date-picker .shamsi-input:focus {
    border-color: #607d8b !important;
    box-shadow: 0 0 0 3px rgba(96, 125, 139, .12) !important;
}

.order-edit-page .order-edit-form .compact-date-picker .calendar-button {
    position: absolute !important;
    left: 4px;
    bottom: 3px;
    z-index: 2;
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 6px !important;
    color: #37474f !important;
    background: #eceff1 !important;
    font-size: 13px;
    line-height: 30px;
}

.order-edit-page .order-edit-form .compact-date-picker .calendar-button:hover {
    background: #cfd8dc;
}

.order-edit-page .order-edit-form .compact-date-picker .calendar-popup {
    top: calc(100% + 5px);
    right: 0;
    width: 264px;
    padding: 9px;
    border: 1px solid #e2e6ea;
    border-radius: 12px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .16);
}

.order-edit-page .order-edit-form .compact-date-picker .calendar-header {
    display: grid;
    grid-template-columns: 30px 1fr 30px;
    gap: 4px;
    margin-bottom: 7px;
}

.order-edit-page .order-edit-form .compact-date-picker .calendar-nav {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 6px;
    color: #37474f;
    background: #eceff1;
    font-size: 16px;
}

.order-edit-page .order-edit-form .compact-date-picker .calendar-nav:hover {
    background: #cfd8dc;
}

.order-edit-page .order-edit-form .compact-date-picker .calendar-title {
    color: #37474f;
    font-size: 12.5px;
    font-weight: 700;
    text-align: center;
}

.order-edit-page .order-edit-form .compact-date-picker .calendar-weekdays,
.order-edit-page .order-edit-form .compact-date-picker .calendar-days {
    gap: 3px;
}

.order-edit-page .order-edit-form .compact-date-picker .calendar-weekdays > div {
    padding: 3px 0;
    color: #90a4ae;
    font-size: 10.5px;
    font-weight: 700;
    text-align: center;
}

.order-edit-page .order-edit-form .compact-date-picker .calendar-days button {
    height: 30px;
    border-radius: 6px;
    color: #37474f;
    font-size: 11.5px;
}

.order-edit-page .order-edit-form .compact-date-picker .calendar-days button:hover {
    background: #eceff1;
    color: #37474f;
}

.order-edit-page .order-edit-form .compact-date-picker .calendar-days button.today {
    border-color: #90a4ae;
    color: #455a64;
}

.order-edit-page .order-edit-form .compact-date-picker .calendar-days button.selected {
    background: #607d8b;
    color: #fff;
}


/* =========================================================
   پنل جستجوی پیشرفته (Div پنهان‌شونده)
   استفاده مشترک در صفحات سفارش‌ها، فرمول‌ها و جست‌وجوی اقلام
   ========================================================= */

.advanced-search-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .28s ease;
}

.advanced-search-wrapper.open {
    grid-template-rows: 1fr;
}

.advanced-search-inner {
    overflow: hidden;
    min-height: 0;
}

.advanced-search-wrapper.open .advanced-search-inner {
    padding-top: 14px;
    margin-top: 14px;
    border-top: 1px dashed #e3e7eb;
    /* تقویم‌های بازشونده نباید توسط پنل جست‌وجو بریده شوند. */
    overflow: visible;
}

.advanced-search-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.advanced-search-toggle i.bi-chevron-up,
.advanced-search-toggle i.bi-chevron-down {
    transition: transform .2s ease;
    font-size: .8rem;
}

/* نوار کنترل مشترک: مرتب‌سازی، اعمال/پاک‌کردن فیلتر و خروجی در یک ردیف فشرده. */
.advanced-search-inner .advanced-control-row {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: .5rem;
    margin-inline: 0;
}

.advanced-search-inner .advanced-control-row > [class*="col"] {
    width: auto;
    flex: 0 1 auto;
    padding-inline: 0;
}

.advanced-search-inner .advanced-control-row .form-select,
.advanced-search-inner .advanced-control-row .btn {
    min-height: 36px;
    width: auto;
    white-space: nowrap;
}

.advanced-search-inner .advanced-control-row .form-select {
    min-width: 110px;
}

.advanced-search-inner .advanced-control-row .filter-button {
    width: auto !important;
    padding-inline: .85rem;
}

@media (max-width: 576px) {
    .advanced-search-inner .advanced-control-row > [class*="col"],
    .advanced-search-inner .advanced-control-row .btn,
    .advanced-search-inner .advanced-control-row .form-select {
        width: 100%;
    }
}
