/* =========================
   ORDERS PAGE
========================= */

.orders-page {
    min-height: calc(100vh - 100px);
}


/* =========================
   PAGE HEADER
========================= */

.orders-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 24px;
}

.orders-header h3 {
    font-size: 21px;
}

.orders-header p {
    margin-top: 5px;

    color: var(--text-soft);
    font-size: 13px;
}


/* =========================
   ORDER STATS
========================= */

.orders-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));

    gap: 18px;

    margin-bottom: 20px;
}

.order-stat {
    display: flex;
    align-items: center;
    gap: 14px;

    padding: 20px;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    background: var(--surface);

    box-shadow: var(--shadow-sm);
}

.order-stat__icon {
    width: 46px;
    height: 46px;

    display: grid;
    place-items: center;

    flex-shrink: 0;

    border-radius: 12px;

    background: var(--primary-soft);
    color: var(--primary);

    font-size: 18px;
}

.order-stat > div:last-child {
    display: flex;
    flex-direction: column;
    gap: 5px;

    min-width: 0;
}

.order-stat span {
    color: var(--text-soft);
    font-size: 12px;
}

.order-stat strong {
    font-size: 23px;
}


/* =========================
   ORDERS CARD
========================= */

.orders-card {
    padding: 0;

    overflow: hidden;
}


/* =========================
   TOOLBAR
========================= */

.orders-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;

    padding: 18px;

    border-bottom: 1px solid var(--border);
}

.orders-search {
    width: min(380px, 100%);

    display: flex;
    align-items: center;
    gap: 10px;

    padding: 10px 13px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--surface-soft);
}

.orders-search i {
    color: var(--text-light);
}

.orders-search input {
    width: 100%;

    border: none;
    outline: none;

    background: transparent;

    color: var(--text);
}

.orders-search input::placeholder {
    color: var(--text-light);
}

.orders-filters {
    display: flex;
    align-items: center;
    gap: 10px;
}

.orders-select {
    min-height: 40px;

    padding: 0 12px;

    border: 1px solid var(--border);
    border-radius: 10px;

    outline: none;

    background: var(--surface-soft);
    color: var(--text);
}


/* =========================
   TABLE
========================= */

.orders-management-table {
    width: 100%;

    border-collapse: collapse;
}

.orders-management-table th,
.orders-management-table td {
    padding: 15px 18px;

    text-align: left;

    border-bottom: 1px solid var(--border);

    white-space: nowrap;
}

.orders-management-table th {
    color: var(--text-soft);

    font-size: 11px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.orders-management-table td {
    font-size: 13px;
}

.orders-management-table tbody tr {
    transition: background 0.2s ease;
}

.orders-management-table tbody tr:hover {
    background: var(--surface-soft);
}

.orders-management-table tbody tr:last-child td {
    border-bottom: none;
}

.order-id {
    color: var(--primary);
    font-weight: 700;
}

.customer-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.customer-avatar {
    width: 34px;
    height: 34px;

    display: grid;
    place-items: center;

    flex-shrink: 0;

    border-radius: 50%;

    background: var(--primary-soft);
    color: var(--primary);

    font-size: 11px;
    font-weight: 700;
}

.customer-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.customer-info strong {
    font-size: 12px;
}

.customer-info span {
    color: var(--text-soft);
    font-size: 10px;
}


/* =========================
   STATUS
========================= */

.order-status {
    display: inline-flex;

    padding: 6px 10px;

    border-radius: 999px;

    font-size: 10px;
    font-weight: 700;
}

.order-status.completed {
    background: rgba(22, 163, 74, 0.12);
    color: #16a34a;
}

.order-status.processing {
    background: rgba(37, 99, 235, 0.12);
    color: #3b82f6;
}

.order-status.pending {
    background: rgba(245, 158, 11, 0.14);
    color: #d97706;
}

.order-status.cancelled {
    background: rgba(220, 38, 38, 0.12);
    color: #ef4444;
}


/* =========================
   VIEW BUTTON
========================= */

.view-order-button {
    width: 34px;
    height: 34px;

    display: grid;
    place-items: center;

    border-radius: 8px;

    background: var(--surface-soft);
    color: var(--text-soft);

    transition: 0.2s ease;
}

.view-order-button:hover {
    background: var(--primary-soft);
    color: var(--primary);
}


/* =========================
   EMPTY STATE
========================= */

.orders-empty {
    min-height: 280px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 8px;

    padding: 30px;

    text-align: center;
}

.orders-empty[hidden] {
    display: none;
}

.orders-empty i {
    margin-bottom: 8px;

    color: var(--text-light);
    font-size: 34px;
}

.orders-empty strong {
    font-size: 16px;
}

.orders-empty span {
    color: var(--text-soft);
    font-size: 12px;
}


/* =========================
   PAGINATION
========================= */

.orders-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    padding: 16px 18px;

    border-top: 1px solid var(--border);

    color: var(--text-soft);

    font-size: 12px;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagination-button {
    width: 34px;
    height: 34px;

    display: grid;
    place-items: center;

    border-radius: 8px;

    background: var(--surface-soft);
    color: var(--text);

    transition: 0.2s ease;
}

.pagination-button:hover:not(:disabled) {
    background: var(--primary);
    color: #fff;
}

.pagination-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#currentPage {
    min-width: 32px;

    text-align: center;

    color: var(--text);
    font-weight: 700;
}


/* =========================
   MODAL
========================= */

.order-modal {
    position: fixed;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    opacity: 0;
    visibility: hidden;

    z-index: 2000;

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease;
}

.order-modal.open {
    opacity: 1;
    visibility: visible;
}

.order-modal__backdrop {
    position: absolute;
    inset: 0;

    background: rgba(2, 6, 23, 0.68);

    backdrop-filter: blur(3px);
}

.order-modal__content {
    position: relative;

    width: min(540px, 100%);

    border: 1px solid var(--border);
    border-radius: 18px;

    background: var(--surface);

    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.28);

    overflow: hidden;

    transform: translateY(10px);

    transition: transform 0.2s ease;
}

.order-modal.open .order-modal__content {
    transform: translateY(0);
}

.order-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    padding: 20px;

    border-bottom: 1px solid var(--border);
}

.order-modal__header span {
    color: var(--text-soft);
    font-size: 11px;
}

.order-modal__header h3 {
    margin-top: 3px;

    font-size: 20px;
}

.order-modal__body {
    display: grid;
    grid-template-columns: repeat(2, 1fr);

    gap: 18px;

    padding: 22px;
}

.order-detail {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.order-detail span {
    color: var(--text-soft);
    font-size: 11px;
}

.order-detail strong {
    font-size: 13px;
}


/* =========================
   DARK THEME
========================= */

body.dark-theme .orders-search,
body.dark-theme .orders-select,
body.dark-theme .view-order-button,
body.dark-theme .pagination-button {
    background: var(--surface-soft);
    border-color: var(--border);
}


/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1100px) {

    .orders-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .orders-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .orders-search {
        width: 100%;
    }

    .orders-filters {
        width: 100%;
    }

    .orders-select {
        flex: 1;
    }
}


@media (max-width: 768px) {

    .orders-header {
        align-items: stretch;
        flex-direction: column;
    }

    .orders-header .button {
        align-self: flex-start;
    }

    .orders-management-table {
        min-width: 850px;
    }
}


@media (max-width: 520px) {

    .orders-stats {
        grid-template-columns: 1fr;
    }

    .orders-header .button {
        width: 100%;
    }

    .orders-filters {
        flex-direction: column;
    }

    .orders-select {
        width: 100%;
    }

    .orders-pagination {
        align-items: flex-start;
        flex-direction: column;
    }

    .order-modal__body {
        grid-template-columns: 1fr;
    }
}