/* Order History Styling */
.order-history-container {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    padding: 35px 25px;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.order-history-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(to right, #5dc560, #8fd97f);
}

.page-title {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f2f2f2;
    position: relative;
}

.page-title::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(to right, #5dc560, #8fd97f);
}

.page-title h2 {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.page-title .subtitle {
    color: #888;
    font-size: 16px;
    font-weight: 500;
}

/* FILTERS STYLING (Mobile First) */
.order-filters {
    margin-bottom: 30px;
}

.filter-dropdown {
    position: relative;
}

.filter-dropdown-toggle {
    display: block;
    padding: 12px 25px;
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    margin-bottom: 10px;
    transition: all 0.3s;
}
.filter-dropdown-toggle:hover {
    border-color: #5dc560;
    color: #5dc560;
}
.filter-dropdown-toggle::after {
    content: ' ▼';
    font-size: 12px;
}

.filters-wrapper {
    display: none; /* Hidden by default on mobile */
    flex-direction: column;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    z-index: 100;
    border: 1px solid #eee;
    padding: 8px 0;
    animation: fadeInDropdown 0.2s ease-out;
}

@keyframes fadeInDropdown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.filters-wrapper.show {
    display: flex; /* Show when toggled */
}

.filter-btn {
    display: block;
    padding: 12px 20px;
    background: transparent;
    border-radius: 0;
    color: #555;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    box-shadow: none;
    border: none;
    width: 100%;
    text-align: left;
}
.filter-btn:not(:last-child) {
    border-bottom: 1px solid #f5f5f5;
}

.filter-btn:hover {
    background: #f8f8f8;
    color: #333;
    transform: none;
    box-shadow: none;
}

.filter-btn.active {
    background: #e9f7ea;
    color: #5dc560;
    font-weight: 700;
    box-shadow: none;
}

/* Desktop Filter Styles */
@media (min-width: 768px) {
    .filter-dropdown-toggle {
        display: none;
    }

    .filters-wrapper {
        display: flex;
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
        gap: 12px;
        position: static;
        box-shadow: none;
        border: none;
        padding: 0;
        animation: none;
        background: transparent;
    }

    .filter-btn {
        display: inline-block;
        width: auto;
        padding: 10px 20px;
        background: #f8f8f8;
        border-radius: 30px;
        color: #666;
        font-weight: 600;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.03);
    }
    .filter-btn:not(:last-child) {
        border-bottom: none;
    }

    .filter-btn:hover {
        background: #e9f7ea;
        color: #5dc560;
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(93, 197, 96, 0.15);
    }
    
    .filter-btn.active {
        background: #5dc560;
        color: #fff;
        box-shadow: 0 5px 15px rgba(93, 197, 96, 0.2);
    }
}

.status-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.5px;
}

.status-pending {
    background-color: #fff5e6;
    color: #ff9500;
    border: 1px solid rgba(255, 149, 0, 0.1);
}

.status-processing {
    background-color: #e6f4ff;
    color: #0080ff;
    border: 1px solid rgba(0, 128, 255, 0.1);
}

.status-delivered {
    background-color: #edfaee;
    color: #26b72b;
    border: 1px solid rgba(38, 183, 43, 0.1);
}

.status-cancelled {
    background-color: #fdeeee;
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.1);
}

.btn-track {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: #f1f1f1;
    border-radius: 30px;
    color: #555;
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-track:hover {
    background: #5dc560;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(93, 197, 96, 0.2);
}

.btn-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: #fdeeee;
    border-radius: 30px;
    color: #e74c3c;
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none;
    margin-left: 10px;
}
.btn-cancel:hover {
    background: #e74c3c;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.2);
}

/* Cancellation Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 450px;
    transform: translateY(-50px);
    transition: transform 0.3s ease;
    animation: fadeInModal 0.4s both;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #eef0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, #e74c3c, #c0392b);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.modal-header h4 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.close-modal {
    font-size: 28px;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    border: none;
    background: transparent;
    padding: 0;
    line-height: 1;
}

.close-modal:hover {
    color: #333;
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px 25px;
    line-height: 1.7;
    color: #555;
    text-align: center;
}

.modal-body .icon {
    font-size: 50px;
    color: #e74c3c;
    margin-bottom: 15px;
    display: block;
    line-height: 1;
}

.modal-body p {
    margin: 0 0 10px;
    font-size: 16px;
}

.modal-footer {
    padding: 20px 25px;
    background-color: #f9f9f9;
    border-top: 1px solid #eef0f1;
    display: flex;
    justify-content: center;
    gap: 15px;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.modal-footer button {
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 15px;
}

.modal-footer .btn-secondary {
    background: #fff;
    color: #555;
    border-color: #ddd;
}

.modal-footer .btn-secondary:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.modal-footer .btn-danger {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}

.modal-footer .btn-danger:hover {
    background: #c0392b;
    border-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.2);
}

.empty-orders {
    text-align: center;
    padding: 60px 20px;
}

.empty-orders i {
    font-size: 70px;
    color: #ddd;
    margin-bottom: 20px;
    display: block;
}

.empty-orders h3 {
    font-size: 22px;
    color: #555;
    margin-bottom: 15px;
    font-weight: 600;
}

.empty-orders p {
    color: #888;
    margin-bottom: 30px;
    max-width: 350px;
    margin-left: auto;
    margin-right: auto;
}

.btn-continue {
    display: inline-block;
    padding: 12px 30px;
    background: #5dc560;
    color: #fff;
    border-radius: 30px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(93, 197, 96, 0.2);
}

.btn-continue:hover {
    background: #4ab14e;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(93, 197, 96, 0.3);
    color: #fff;
}

.animate__animated {
    animation-duration: 0.8s;
}

.animate__fadeIn {
    animation-name: fadeIn;
}

.animate__fadeInUp {
    animation-name: fadeInUp;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.order-list {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.order-card {
    background: #fff;
    border: 1px solid #eef0f1;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.order-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #eef0f1;
    flex-wrap: wrap;
    gap: 15px;
}

.order-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.order-info-item .info-label {
    font-size: 13px;
    color: #888;
    font-weight: 500;
}

.order-info-item .info-value {
    font-size: 15px;
    color: #333;
    font-weight: 600;
}

.order-card-body {
    padding: 20px 25px;
}

.product-list-title {
    font-size: 16px;
    font-weight: 600;
    color: #444;
    margin-bottom: 20px;
}

.product-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.product-item:not(:last-child){
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #f5f5f5;
}

.product-image {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f9f9f9;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-details {
    flex-grow: 1;
}

.product-name {
    font-size: 15px;
    font-weight: 500;
    margin: 0 0 8px 0;
}
.product-name a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s;
}
.product-name a:hover {
    color: #5dc560;
}

.product-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
    color: #666;
}
.product-price {
    font-weight: 600;
}

/* Responsive styles */
@media (max-width: 991px) {
    .page-title h2 {
        font-size: 28px;
    }
    
    .order-history-container {
        padding: 25px 15px;
    }
    
    .filters-wrapper {
        justify-content: center;
    }
    .order-card-header {
        flex-direction: column;
        align-items: stretch;
    }
    .order-info-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 5px 0;
    }
    .order-action-item {
        justify-content: flex-end;
        margin-top: 10px;
    }
}

@media (max-width: 767px) {
    .order-history-container {
        border-radius: 10px;
        padding: 20px 10px;
    }
    
    .page-title h2 {
        font-size: 24px;
    }
    
    .page-title .subtitle {
        font-size: 14px;
    }

    .status-badge {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    /* Refined Order Card for mobile */
    .order-card-header {
        padding: 15px;
        background-color: #fafafa;
    }
    .order-card-body {
        padding: 15px;
    }
    .order-info-item {
        border-bottom: 1px solid #f0f0f0;
        padding: 12px 0;
        gap: 8px;
    }
    .order-info-item:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    .order-info-item .info-label {
        font-size: 14px;
        font-weight: 400;
        color: #666;
    }
    .order-info-item .info-value {
        font-size: 15px;
    }
    .order-action-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding-top: 15px;
        margin-top: 0;
    }
    .btn-track, .btn-cancel {
        width: 100%;
        text-align: center;
        margin-left: 0;
        padding: 12px;
        font-size: 14px;
    }
    .product-item {
        gap: 12px;
    }
    .product-image {
        width: 60px;
        height: 60px;
    }
    .product-name {
        font-size: 14px;
    }
    .product-meta {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .filters-wrapper {
        gap: 8px;
    }
    
    .filter-btn {
        padding: 6px 12px;
        font-size: 12px;
        margin-bottom: 5px;
    }

    .product-item {
        position: relative;
    }
    .product-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}
