:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --background-color: #f8f9fa;
    --text-color: #2c3e50;
    --border-color: #e9ecef;
    --hover-color: #f1f3f5;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.5;
}

.history-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.header {
    margin-bottom: 2rem;
    text-align: center;
}

.header h1 {
    font-size: 2rem;
    color: #1d1d1f;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #86868b;
}

.table-wrapper {
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    background: #f5f5f7;
    padding: 1rem;
    text-align: left;
    color: #1d1d1f;
    font-weight: 600;
    white-space: nowrap;
}

.history-table td {
    padding: 1rem;
    border-bottom: 1px solid #e8e8ed;
}

.order-header {
    background: #f8f9fa;
}

.order-header td {
    padding: 0.8rem 1rem;
    color: #0071e3;
}

.order-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.item-price {
    color: #0071e3;
    font-size: 0.95rem;
    white-space: nowrap;
}

.order-item td {
    background: white;
}

.quantity {
    background: rgba(46, 125, 50, 0.1);
    color: #2e7d32;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    white-space: nowrap;
}

.order-total {
    background: #f8f9fa;
}

.total-price {
    color: #0071e3;
    font-size: 1.1rem;
    white-space: nowrap;
}

.order-info {
    background: #f8f9fa;
}

.info-cell {
    padding: 1rem;
    vertical-align: top;
}

.order-address, .order-code {
    background: #f5f5f7;
    padding: 1rem;
    border-radius: 8px;
    height: 100%;
    min-height: 80px;
}

.order-address strong, .order-code strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #1d1d1f;
}

.code-value {
    color: #0071e3;
    font-weight: 500;
    font-size: 1.1rem;
}

.code-empty {
    color: #86868b;
    font-style: italic;
}

.action-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1rem;
}

.receive-button {
    background: #28a745;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.receive-button:hover {
    background: #218838;
}

.cancel-button {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.cancel-button:hover {
    background: #c82333;
}

.order-received {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    color: #28a745;
}

.status-icon {
    font-size: 1.5rem;
    margin-right: 0.5rem;
}

.status-text {
    font-size: 1.1rem;
    font-weight: 500;
}

@media (max-width: 768px) {
    .history-container {
        margin: 1rem;
        padding: 0;
    }

    .table-wrapper {
        border-radius: 12px;
    }

    .history-table {
        display: block;
    }

    .history-table thead {
        display: none;
    }

    .history-table tbody {
        display: block;
    }

    .history-table tr {
        display: block;
        margin-bottom: 1rem;
        border-bottom: 2px solid #e8e8ed;
    }

    .history-table td {
        display: block;
        padding: 0.8rem;
        text-align: right;
        position: relative;
        padding-left: 50%;
    }

    .history-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0.8rem;
        width: 45%;
        text-align: left;
        font-weight: 500;
        color: #86868b;
    }

    .order-header td {
        text-align: center;
        padding-left: 0.8rem;
    }

    .order-header td::before {
        display: none;
    }

    .order-title {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }

    .order-info td {
        padding-left: 0.8rem;
        text-align: left;
    }

    .order-info td::before {
        display: none;
    }

    .info-cell {
        padding: 0.8rem;
    }

    .order-address, .order-code {
        margin-bottom: 0.8rem;
        text-align: left;
    }

    .action-buttons {
        flex-direction: column;
        padding: 0.8rem;
    }

    .receive-button, .cancel-button {
        width: 100%;
        padding: 0.8rem;
        text-align: center;
    }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        padding: 0 0.8rem;
    }

    .pagination-link {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

.empty-message {
    text-align: center;
    padding: 2rem;
    color: #86868b;
    font-size: 1.1rem;
}

/* Пагинация */
.pagination {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.pagination-info {
    color: #6c757d;
    font-size: 0.9rem;
    margin: 0 1rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.pagination-pages {
    display: flex;
    gap: 0.25rem;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    min-width: 40px;
}

.pagination-link:hover {
    background: var(--hover-color);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.pagination-current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background: var(--secondary-color);
    border: 1px solid var(--secondary-color);
    border-radius: 4px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 40px;
}

/* Адаптивный дизайн */
@media (max-width: 768px) {
    .history-container {
        padding: 1rem;
    }

    .table-wrapper {
        border-radius: 0;
        box-shadow: none;
    }

    .history-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .history-table th,
    .history-table td {
        padding: 0.75rem;
    }

    h1 {
        font-size: 2rem;
    }

    .pagination {
        flex-wrap: wrap;
    }

    .pagination-controls {
        gap: 0.25rem;
    }

    .pagination-link, 
    .pagination-current {
        padding: 0.4rem 0.8rem;
        min-width: 35px;
    }
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Стили для способа оплаты */
.order-payment {
    margin: 5px 0;
    padding: 5px 0;
}

.payment-type {
    font-weight: 500;
    color: #2c7be5;
    background-color: rgba(44, 123, 229, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
}

.payment-empty {
    color: #6c757d;
    font-style: italic;
}

.payment-details {
    margin-top: 8px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #2c7be5;
}

.payment-number {
    margin: 5px 0;
    font-size: 0.9rem;
}

.payment-additional {
    margin: 5px 0;
    font-size: 0.9rem;
    color: #495057;
}