/**
 * Cart Panel Styles
 * Slide-in shopping cart panel for V2 theme
 */

/* ============================
   Cart Icon in Header
   ============================ */
.header-cart-icon {
    position: relative;
    margin-right: 15px;
    display: flex;
    align-items: center;
}

.cart-icon-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    position: relative;
    transition: color 0.2s ease;
}

/* When header has fixed-header */
header.fixed-header .cart-icon-btn {
    color: #CC5500;
}

.cart-icon-btn:hover {
    color: #ffc107;
}

.cart-icon-btn:focus {
    outline: none;
}

/* Sticky header - darker icon */
.sticky-header .cart-icon-btn {
    color: #333;
}

.sticky-header .cart-icon-btn:hover {
    color: #173C97;
}

/* Cart Badge */
.cart-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #c1241a;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    animation: badgePop 0.3s ease;
}

@keyframes badgePop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ============================
   Cart Panel Overlay
   ============================ */
.cart-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

/* ============================
   Cart Panel Container
   ============================ */
.cart-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 100vw;
    height: 100vh;
    background: #fff;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.cart-panel.open {
    right: 0;
}

/* Prevent body scroll when panel is open */
body.cart-panel-open {
    overflow: hidden;
}

/* ============================
   Cart Panel Header
   ============================ */
.cart-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: #173C97;
    color: #fff;
    flex-shrink: 0;
}

.cart-panel-header h3 {
    color: white;
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-panel-header h3 i {
    font-size: 22px;
}

.cart-panel-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.cart-panel-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.cart-panel-close:focus {
    outline: none;
}

/* ============================
   Cart Panel Body
   ============================ */
.cart-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Loading State */
.cart-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #666;
}

.cart-loading i {
    color: #173C97;
    margin-bottom: 15px;
}

.cart-loading p {
    margin: 0;
    font-size: 15px;
}

/* Empty State */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 30px;
    text-align: center;
}

.cart-empty i {
    color: #ddd;
    margin-bottom: 20px;
}

.cart-empty h4 {
    margin: 0 0 10px;
    font-size: 20px;
    color: #333;
}

.cart-empty p {
    margin: 0 0 25px;
    color: #666;
    font-size: 15px;
}

.cart-empty .btn {
    padding: 12px 30px;
}

/* ============================
   Cart Items List
   ============================ */
.cart-items-list {
    padding: 15px;
}

/* Cart Item Card */
.cart-item {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 12px;
    position: relative;
    transition: all 0.2s ease;
}

.cart-item:last-child {
    margin-bottom: 0;
}

.cart-item:hover {
    background: #f0f2f5;
}

/* Cart Item Image */
.cart-item-image {
    width: 70px;
    height: 70px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #e9ecef;
}

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

/* Cart Item Details */
.cart-item-details {
    flex: 1;
    padding: 0 12px;
    min-width: 0;
}

.cart-item-name {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-item-type {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #fff;
    background: #6c757d;
    padding: 2px 8px;
    border-radius: 3px;
    margin-right: 8px;
}

.cart-item-type.course {
    background: #173C97;
}

.cart-item-type.package {
    background: #28a745;
}

.cart-item-type.book {
    background: #fd7e14;
}

.cart-item-delivery {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.cart-item-price {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #c1241a;
    margin-top: 6px;
}

/* Cart Item Remove Button */
.cart-item-remove {
    background: transparent;
    border: none;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.cart-item-remove:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.cart-item-remove:focus {
    outline: none;
}

/* Item removing animation */
.cart-item.removing {
    opacity: 0.5;
    pointer-events: none;
}

/* Item updating animation */
.cart-item.updating {
    opacity: 0.7;
    pointer-events: none;
}

/* ============================
   Schedule Info Styles (Compact)
   ============================ */
.cart-item-schedule {
    margin-top: 6px;
    padding: 5px 8px;
    background: linear-gradient(135deg, #e8f4ff 0%, #f0f7ff 100%);
    border-radius: 4px;
    font-size: 10px;
    color: #444;
    line-height: 1.4;
    border-left: 2px solid #173C97;
    display: flex;
    align-items: flex-start;
    gap: 5px;
}

.cart-item-schedule i {
    color: #173C97;
    flex-shrink: 0;
    margin-top: 1px;
}

.cart-item-schedule span {
    word-break: break-word;
}

/* Package schedule summary */
.cart-package-summary {
    margin-top: 6px;
}

.package-schedule-count {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: #666;
    background: #f0f0f0;
    padding: 3px 8px;
    border-radius: 3px;
}

.package-schedule-count i {
    color: #28a745;
}

/* ============================
   Quantity Controls Styles
   ============================ */
.cart-item-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.cart-qty-btn {
    width: 28px;
    height: 28px;
    background: #f8f9fa;
    border: none;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.cart-qty-btn:hover {
    background: #e9ecef;
    color: #333;
}

.cart-qty-btn:active {
    background: #dee2e6;
}

.cart-qty-btn i {
    font-size: 10px;
}

.cart-qty-input {
    width: 36px;
    height: 28px;
    border: none;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    -moz-appearance: textfield;
}

.cart-qty-input::-webkit-outer-spin-button,
.cart-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-qty-input:focus {
    outline: none;
}


/* ============================
   Cart Panel Footer
   ============================ */
.cart-panel-footer {
    padding: 20px 25px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.cart-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 18px;
}

.cart-subtotal span:first-child {
    color: #666;
    font-weight: 500;
}

.cart-total-price {
    font-size: 24px;
    font-weight: 700;
    color: #173C97;
}

.cart-panel-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-panel-actions .btn {
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 6px;
    text-align: center;
    text-decoration: none;
    display: block;
}

.cart-panel-actions .btn-outline-secondary {
    background: transparent;
    border: 2px solid #e5e7eb;
    color: #333;
}

.cart-panel-actions .btn-outline-secondary:hover {
    background: #f8f9fa;
    border-color: #d1d5db;
}

.cart-panel-actions .btn-primary {
    background: linear-gradient(135deg, #173C97 0%, #2451b8 100%);
    border: none;
    color: #fff;
}

.cart-panel-actions .btn-primary:hover {
    background: linear-gradient(135deg, #122d75 0%, #1d4199 100%);
}

/* ============================
   Add to Cart Button Animation
   ============================ */
.add-to-cart-btn {
    position: relative;
    overflow: hidden;
}

.add-to-cart-btn.adding {
    pointer-events: none;
}

.add-to-cart-btn.adding::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
}

.add-to-cart-btn.adding::before {
    content: '\f110';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ============================
   Toast Notification (optional)
   ============================ */
.cart-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #28a745;
    color: #fff;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.cart-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.cart-toast i {
    font-size: 20px;
}

.cart-toast-message {
    font-size: 14px;
    font-weight: 500;
}

/* ============================
   Responsive Styles
   ============================ */
@media (max-width: 576px) {
    .cart-panel {
        width: 100%;
        right: -100%;
    }

    .cart-panel-header {
        padding: 15px 20px;
    }

    .cart-panel-header h3 {
        font-size: 18px;
    }

    .cart-panel-footer {
        padding: 15px 20px;
    }

    .cart-items-list {
        padding: 12px;
    }

    .cart-item {
        padding: 12px;
    }

    .cart-item-image {
        width: 60px;
        height: 60px;
    }

    .cart-item-name {
        font-size: 13px;
    }

    .cart-total-price {
        font-size: 20px;
    }

    .cart-toast {
        left: 15px;
        right: 15px;
        bottom: 15px;
    }
}

/* ============================
   Dark Theme Support (optional)
   ============================ */
@media (prefers-color-scheme: dark) {
    /* Add dark theme styles here if needed */
}
