/* Edwiser Store - Cart Page Styles */

/*
 * The declarations below intentionally use `!important` to override styles
 * coming from the active Moodle theme (Boost, RemUI, Classic and downstream
 * forks) and from Bootstrap utility classes. The plugin's host page selectors
 * (`#page-local-edwiserstore-*`, `.path-local-edwiserstore`) already provide
 * high specificity, but theme stylesheets load after this file and frequently
 * target the same shells, so `!important` is the documented escape hatch.
 */
/* stylelint-disable declaration-no-important */

/* Cart items, order summary, and empty states */

.local-edwiserstore-cart-page {
    padding: 24px 0;
    max-width: 1400px;
    margin: 0 auto;
}

.path-local-edwiserstore .cart-page-container {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    padding: 24px;
    background-color: #fff;
}

.path-local-edwiserstore .cart-items-section {
    flex: 1;
    min-width: 0;
}

.path-local-edwiserstore .cart-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.path-local-edwiserstore .cart-header-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.path-local-edwiserstore .cart-title {
    font-size: 32px;
    font-weight: 700;
    color: #212529;
    margin: 0;
}

.path-local-edwiserstore .cart-item-count {
    font-size: 16px;
    color: #6c757d;
    font-weight: 400;
    white-space: nowrap;
}

.path-local-edwiserstore .cart-delete-all {
    background-color: var(--edw-primary) !important;
    color: #fff !important;
    border: 1px solid var(--edw-primary) !important;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    box-shadow: none;
}

.path-local-edwiserstore .cart-delete-all:hover,
.path-local-edwiserstore .cart-delete-all:focus {
    background-color: var(--edw-primary-hover) !important;
    border-color: var(--edw-primary-hover) !important;
    color: #fff !important;
    text-decoration: none;
    box-shadow: none;
}

.path-local-edwiserstore .cart-delete-all:active {
    background-color: var(--edw-primary-dark) !important;
    border-color: var(--edw-primary-dark) !important;
    box-shadow: none;
}

.path-local-edwiserstore .cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.path-local-edwiserstore .cart-item-card {
    display: flex;
    gap: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.path-local-edwiserstore .cart-item-image-wrapper {
    flex-shrink: 0;
    width: 240px;
    height: auto;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f7fa;
}

.path-local-edwiserstore .cart-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.path-local-edwiserstore .cart-item-image-link {
    display: block;
    width: 100%;
    height: 100%;
}

.path-local-edwiserstore .cart-item-image-link:hover .cart-item-image {
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.path-local-edwiserstore .cart-item-title a {
    color: inherit;
    text-decoration: none;
}

.path-local-edwiserstore .cart-item-title a:hover {
    color: var(--edw-primary);
}

.path-local-edwiserstore .cart-item-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px 0;
}

.path-local-edwiserstore .cart-item-category-tag {
    display: inline-block;
    padding: 4px 12px;
    background: #f3f4f6;
    color: #374151;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
    width: fit-content;
}

.path-local-edwiserstore .cart-item-title {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    margin: 0;
    line-height: 1.4;
}

.path-local-edwiserstore .cart-item-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.path-local-edwiserstore .cart-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #6c757d;
}

.path-local-edwiserstore .cart-meta-item i {
    color: #ffd700;
}

.path-local-edwiserstore .cart-meta-item i.fa-users {
    color: #6c757d;
}

.path-local-edwiserstore .cart-item-price {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.path-local-edwiserstore .cart-price-original {
    font-size: 16px;
    color: #9ca3af;
    text-decoration: line-through;
}

.path-local-edwiserstore .cart-price-actual {
    font-size: 20px;
    font-weight: 700;
    color: var(--edw-primary);
}

.path-local-edwiserstore .cart-sale-tag {
    display: inline-block;
    padding: 4px 10px;
    background: #ffd700;
    color: #212529;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.path-local-edwiserstore .cart-item-actions {
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    padding: 20px;
}

.path-local-edwiserstore .cart-item-delete {
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.path-local-edwiserstore .cart-item-delete i {
    color: #fff;
}

.path-local-edwiserstore .cart-order-summary-section {
    flex-shrink: 0;
    width: 380px;
}

.path-local-edwiserstore .order-summary-card {
    background: #fff;
    padding: 24px;
    padding-bottom: 0;
    top: 20px;
}

.path-local-edwiserstore .order-summary-title {
    font-size: 24px;
    font-weight: 700;
    color: #212529;
    margin: 0 0 24px 0;
}

.path-local-edwiserstore .order-summary-details {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.path-local-edwiserstore .summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.path-local-edwiserstore .summary-label {
    font-size: 16px;
    color: #374151;
    font-weight: 500;
}

.path-local-edwiserstore .summary-value {
    font-size: 16px;
    color: #212529;
    font-weight: 600;
}

.path-local-edwiserstore .summary-row.total-row {
    padding-top: 16px;
    border-top: 2px solid #e2e8f0;
    margin-top: 8px;
}

.path-local-edwiserstore .summary-row.total-row .summary-label,
.path-local-edwiserstore .summary-row.total-row .summary-value {
    font-size: 20px;
    font-weight: 700;
}

.path-local-edwiserstore .total-value {
    color: #212529;
}

.path-local-edwiserstore .coupon-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.path-local-edwiserstore .coupon-input-container {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 4px;
}

.path-local-edwiserstore .coupon-input-wrapper {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 300px;
    margin-left: auto;
}

.path-local-edwiserstore .coupon-input {
    flex: 1;
    padding: 12px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
}

.path-local-edwiserstore .coupon-input:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    border-color: var(--edw-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--edw-primary) 10%, transparent);
}

.path-local-edwiserstore .coupon-apply-btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.path-local-edwiserstore .coupon-discount-value {
    color: #28a745;
}

.path-local-edwiserstore .coupon-input-wrapper-applied {
    display: flex;
    gap: 8px;
    width: 100%;
    align-items: center;
    position: relative;
}

.path-local-edwiserstore .coupon-input-applied {
    flex: 1;
    padding: 12px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    color: #6c757d;
}

.path-local-edwiserstore .coupon-remove-btn-inline {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: transparent;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.path-local-edwiserstore .coupon-remove-btn-inline:hover {
    color: #c82333;
}

.path-local-edwiserstore .coupon-applied-message {
    font-size: 12px;
    color: #28a745;
    font-weight: 500;
    width: 100%;
    text-align: left;
}

.path-local-edwiserstore .coupon-edit-link,
.path-local-edwiserstore .coupon-apply-link {
    font-size: 14px;
    color: var(--edw-primary);
    text-decoration: none;
}

.path-local-edwiserstore .coupon-edit-link:hover,
.path-local-edwiserstore .coupon-apply-link:hover {
    text-decoration: underline;
}

.path-local-edwiserstore .order-summary-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.path-local-edwiserstore .proceed-checkout-btn {
    width: 100%;
    padding: 14px 24px;
    background: var(--edw-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    display: block;
}

.path-local-edwiserstore .proceed-checkout-btn:hover {
    background: var(--edw-primary-hover);
    color: #fff;
    text-decoration: none;
}

.path-local-edwiserstore .continue-shopping-btn,
.path-local-edwiserstore .continue-shopping-btn-empty {
    width: 100%;
    padding: 10px 24px;
    background: transparent;
    color: var(--edw-primary);
    border: none;
    font-size: 14px;
    text-align: center;
    text-decoration: none;
    display: block;
}

.path-local-edwiserstore .continue-shopping-btn:hover,
.path-local-edwiserstore .continue-shopping-btn-empty:hover {
    color: var(--edw-primary-hover);
    text-decoration: underline;
}

/* Empty Cart State */
.path-local-edwiserstore .cart-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    text-align: center;
}

.path-local-edwiserstore .cart-empty-illustration {
    margin-bottom: 32px;
}

.path-local-edwiserstore .empty-cart-image {
    max-width: 400px;
    width: 100%;
    height: auto;
}

.path-local-edwiserstore .cart-empty-content {
    max-width: 500px;
}

.path-local-edwiserstore .cart-empty-title {
    font-size: 28px;
    font-weight: 700;
    color: #212529;
    margin: 0 0 16px 0;
}

.path-local-edwiserstore .cart-empty-message {
    font-size: 16px;
    color: #6c757d;
    margin: 0 0 32px 0;
    line-height: 1.6;
}

/* Delete Confirmation Modal */
.path-local-edwiserstore .cart-delete-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.path-local-edwiserstore .cart-delete-modal-content {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.path-local-edwiserstore .cart-delete-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
}

.path-local-edwiserstore .cart-delete-modal-header h4 {
    font-size: 20px;
    font-weight: 700;
    color: #212529;
    margin: 0;
}

.path-local-edwiserstore .cart-delete-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.path-local-edwiserstore .cart-delete-modal-close:hover {
    color: #212529;
}

.path-local-edwiserstore .cart-delete-modal-body {
    padding: 24px;
}

.path-local-edwiserstore .cart-delete-modal-body p {
    font-size: 16px;
    color: #374151;
    margin: 0;
    line-height: 1.6;
}

.path-local-edwiserstore .cart-delete-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
}

.path-local-edwiserstore .cart-delete-modal-footer .btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    min-width: 80px;
}

.path-local-edwiserstore .cart-delete-cancel {
    background: #fff;
    color: var(--edw-primary);
    border: 1px solid var(--edw-primary);
}

.path-local-edwiserstore .cart-delete-cancel:hover {
    background: #f5f8ff;
}

.path-local-edwiserstore .cart-delete-confirm {
    background: var(--edw-primary);
    color: #fff;
}

.path-local-edwiserstore .cart-delete-confirm:hover {
    background: var(--edw-primary-hover);
}

/* Responsive Cart Page */
@media (max-width: 1024px) {
    .path-local-edwiserstore .cart-page-container {
        flex-direction: column;
    }

    .path-local-edwiserstore .cart-order-summary-section {
        width: 100%;
    }

    .path-local-edwiserstore .order-summary-card {
        position: static;
    }
}

@media (max-width: 768px) {
    .local-edwiserstore-cart-page {
        padding: 16px;
    }

    .path-local-edwiserstore .cart-item-card {
        flex-direction: column;
        padding: 16px;
    }

    .path-local-edwiserstore .cart-item-image-wrapper {
        width: 100%;
        height: 200px;
    }

    .path-local-edwiserstore .cart-header-bottom {
        flex-wrap: wrap;
    }

    .path-local-edwiserstore .cart-title {
        font-size: 24px;
    }

    .path-local-edwiserstore .cart-empty-title {
        font-size: 24px;
    }

    .path-local-edwiserstore .cart-empty-illustration {
        margin-bottom: 24px;
    }

    .path-local-edwiserstore .empty-cart-image {
        max-width: 300px;
    }
}

@media (max-width: 576px) {
    .path-local-edwiserstore .cart-item-meta {
        flex-direction: column;
        gap: 8px;
    }

    .path-local-edwiserstore .coupon-input-wrapper {
        flex-direction: column;
    }

    .path-local-edwiserstore .coupon-apply-btn {
        width: 100%;
    }
}

/* Design fixes */
#page-local-edwiserstore-cart #page {
    padding: 0 !important;
}

#page-local-edwiserstore-cart #topofscroll {
    padding: 0 !important;
    max-width: 100% !important;
}

#page-local-edwiserstore-cart #page-content div[role='main'] {
    padding: 0 !important;
}

#page-local-edwiserstore-cart #page-header {
    display: none !important;
}

#page-local-edwiserstore-cart .local-edwiserstore-cart-page {
    max-width: 1320px !important;
    margin: 0 auto !important;
}

#page-local-edwiserstore-cart .coupon-input-wrapper {
    margin-left: 0 !important;
    max-width: 100% !important;
}

.local-edwiserstore-cart-page .cart-item-image-wrapper {
    border-radius: 8px 0 0 8px !important;
}

.local-edwiserstore-cart-page .cart-item-delete,
.local-edwiserstore-cart-page .cart-delete-all {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    font-weight: 600 !important;
    padding: 8px 12px !important;
    font-size: 12px !important;
    line-height: 16px !important;
}

#page-local-edwiserstore-cart .coupon-input-container {
    flex-direction: column;
}

#page-local-edwiserstore-cart .coupon-input-wrapper,
#page-local-edwiserstore-cart .coupon-input-wrapper-applied,
#page-local-edwiserstore-cart .coupon-applied-message {
    margin-left: 0 !important;
    max-width: 100% !important;
}
/* stylelint-enable declaration-no-important */
