/* ========================================
   WooCommerce Cart - Registration Style
   Redesigned for training registration experience
   ======================================== */

/* ========================================
   Base Layout & Container
   ======================================== */

.woocommerce-cart {
    min-height: 100vh;
}

/* WooCommerce notices need to clear the sticky header */
.woocommerce-notices-wrapper:first-child {
    padding-top: 80px;
}

.woocommerce-cart > .container > .cart-header {
    padding-top: 80px; /* Clear sticky header */
}

/* When notices are shown, reduce cart-header padding */
.woocommerce-notices-wrapper + .woocommerce-cart > .container > .cart-header {
    padding-top: 1rem;
}

.woocommerce-cart .page-title {
    font-size: 2rem;
    font-weight: 600;
    color: rgb(13, 54, 75);
    margin-bottom: 0.5rem;
}

.woocommerce-cart .page-subtitle {
    font-size: 1rem;
    color: rgb(29, 112, 183);
    margin-bottom: 2rem;
}

/* ========================================
   Two-Column Layout
   ======================================== */

.cart-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}

.cart-items-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cart-summary-column {
    position: sticky;
    top: 100px;
}

/* Mobile: Stack columns */
@media only screen and (max-width: 992px) {
    .cart-layout {
        grid-template-columns: 1fr;
    }

    .cart-summary-column {
        position: static;
        order: -1; /* Show summary first on mobile */
    }
}

/* ========================================
   Training/Voucher Card
   ======================================== */

.cart-item-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    transition: box-shadow 0.3s ease;
}

.cart-item-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.cart-item-content {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.5rem;
    align-items: start;
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: rgb(13, 54, 75);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.cart-item-title a {
    color: rgb(29, 112, 183);
    text-decoration: none;
    transition: color 0.2s ease;
}

.cart-item-title a:hover {
    color: rgb(13, 54, 75);
    text-decoration: underline;
}

.cart-item-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.cart-item-meta-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: rgb(13, 54, 75);
}

.cart-item-meta-row .material-symbols-sharp {
    font-size: 18px;
    color: rgb(29, 112, 183);
}

.cart-item-meta-label {
    font-weight: 500;
    color: rgb(29, 112, 183);
}

.cart-item-meta-value {
    color: rgb(13, 54, 75);
}

.cart-item-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(29, 112, 183, 0.1);
    color: rgb(29, 112, 183);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.cart-item-session-id {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

/* ========================================
   Cart Item Actions (Right Side)
   ======================================== */

.cart-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
}

.cart-item-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: rgb(13, 54, 75);
    white-space: nowrap;
}

.cart-item-price-note {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.5rem;
}

.cart-item-quantity label {
    font-size: 0.85rem;
    font-weight: 500;
    color: rgb(13, 54, 75);
    margin: 0;
}

.cart-item-quantity input[type="number"] {
    width: 60px;
    height: 36px;
    text-align: center;
    border: 1px solid rgba(13, 54, 75, 0.2);
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    color: rgb(13, 54, 75);
    padding: 0.25rem;
}

.cart-item-quantity input[type="number"]:focus {
    outline: none;
    border-color: rgb(29, 112, 183);
    box-shadow: 0 0 0 3px rgba(29, 112, 183, 0.1);
}

/* Remove arrows from number input */
.cart-item-quantity input[type="number"]::-webkit-inner-spin-button,
.cart-item-quantity input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-item-quantity input[type="number"] {
    -moz-appearance: textfield;
}

/* Quantity +/- Buttons */
.qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #fff;
    border: 1px solid rgba(13, 54, 75, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.qty-btn:hover {
    background: rgba(29, 112, 183, 0.1);
    border-color: rgb(29, 112, 183);
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-btn .material-symbols-sharp {
    font-size: 20px;
    color: rgb(13, 54, 75);
}

.qty-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.qty-btn:disabled:hover {
    background: #fff;
    border-color: rgba(13, 54, 75, 0.2);
}

/* Fixed Quantity Display (for training registrations) */
.cart-item-quantity-fixed {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.cart-item-quantity-fixed .qty-label {
    color: #6c757d;
    font-weight: 500;
}

.cart-item-quantity-fixed .qty-value {
    color: rgb(13, 54, 75);
    font-weight: 600;
}

.cart-item-remove {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #dc3545;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    background: transparent;
    border: 1px solid transparent;
}

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

.cart-item-remove .material-symbols-sharp {
    font-size: 18px;
}

/* ========================================
   Registration Summary (Right Column)
   ======================================== */

.registration-summary {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

.registration-summary-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: rgb(13, 54, 75);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid rgba(13, 54, 75, 0.1);
}

.registration-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.95rem;
}

.registration-summary-row.subtotal {
    color: rgb(13, 54, 75);
    border-bottom: 1px solid rgba(13, 54, 75, 0.1);
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

.registration-summary-row.tax {
    color: #6c757d;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(13, 54, 75, 0.1);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.registration-summary-row.tax:last-of-type {
    border-bottom: 2px solid rgba(13, 54, 75, 0.15);
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

.registration-summary-row.total {
    font-size: 0.95rem;
    font-weight: 700;
    color: rgb(13, 54, 75);
    padding-top: 0.75rem;
    margin-top: 0.25rem;
}

.registration-summary-row.total .includes_tax {
    display: none;
}

.registration-summary-label {
    font-weight: 500;
}

.registration-summary-value {
    font-weight: 600;
}

.registration-summary-total-label {
    font-weight: 700;
}

.registration-summary-total-value {
    font-weight: 700;
    color: rgb(29, 112, 183);
}

/* ========================================
   Buttons
   ======================================== */

.btn-register {
    width: 100%;
    background: rgb(13, 54, 75);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1.5rem;
    display: block;
}

.btn-register:hover {
    background: rgba(13, 54, 75, 0.9);
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 54, 75, 0.3);
}

.btn-continue-shopping {
    width: 100%;
    background: rgba(29, 112, 183, .15);
    color: rgb(13, 54, 75);
    border: 2px solid transparent;
    border-radius: 5px;
    padding: .65rem 1rem .75rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all .25s ease;
    margin-top: 1rem;
    display: block;
}

.btn-continue-shopping:hover {
    background: rgba(29, 112, 183, 0.25);
    color: rgb(13, 54, 75);
    text-decoration: none;
}

.btn-update-cart {
    background: rgb(29, 112, 183);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-update-cart:hover {
    background: rgba(29, 112, 183, 0.9);
}

/* ========================================
   Empty Cart State
   ======================================== */

.cart-empty-state {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 3rem 2rem;
    text-align: center;
}

.cart-empty-state .material-symbols-sharp {
    font-size: 80px;
    color: rgba(29, 112, 183, 0.3);
    margin-bottom: 1.5rem;
}

.cart-empty-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: rgb(13, 54, 75);
    margin-bottom: 1rem;
}

.cart-empty-message {
    font-size: 1.1rem;
    color: #6c757d;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.btn-view-trainings {
    display: inline-block;
    background: rgb(29, 112, 183);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-view-trainings:hover {
    background: rgba(29, 112, 183, 0.9);
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 112, 183, 0.3);
}

/* ========================================
   Empty Cart Category Buttons
   ======================================== */

.empty-cart-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
    justify-content: center;
}

.empty-cart-categories .btn-view-trainings {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
}

/* ========================================
   Coupon Section
   ======================================== */

.cart-coupon-section {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    margin-top: 1rem;
}

.cart-coupon-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: rgb(13, 54, 75);
    margin-bottom: 1rem;
}

.coupon-input-group {
    display: flex;
    gap: 0.5rem;
}

.coupon-input-group input[type="text"] {
    flex: 1;
    height: 44px;
    border: 1px solid rgba(13, 54, 75, 0.2);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    color: rgb(13, 54, 75);
}

.coupon-input-group input[type="text"]:focus {
    outline: none;
    border-color: rgb(29, 112, 183);
    box-shadow: 0 0 0 3px rgba(29, 112, 183, 0.1);
}

.coupon-input-group button {
    background: rgb(29, 112, 183);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.coupon-input-group button:hover {
    background: rgba(29, 112, 183, 0.9);
}

/* ========================================
   Toast Notifications
   ======================================== */

.cart-toast {
    position: fixed;
    top: 100px;
    right: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 9999;
    animation: slideInRight 0.3s ease-out;
    max-width: 400px;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.cart-toast.hiding {
    animation: slideOutRight 0.3s ease-out forwards;
}

.cart-toast.success {
    border-left: 4px solid #28a745;
}

.cart-toast.error {
    border-left: 4px solid #dc3545;
}

.cart-toast.info {
    border-left: 4px solid rgb(29, 112, 183);
}

.cart-toast-icon {
    font-size: 24px;
}

.cart-toast.success .cart-toast-icon {
    color: #28a745;
}

.cart-toast.error .cart-toast-icon {
    color: #dc3545;
}

.cart-toast.info .cart-toast-icon {
    color: rgb(29, 112, 183);
}

.cart-toast-content {
    flex: 1;
}

.cart-toast-title {
    font-weight: 600;
    color: rgb(13, 54, 75);
    margin-bottom: 0.25rem;
}

.cart-toast-message {
    font-size: 0.9rem;
    color: #6c757d;
}

.cart-toast-close {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    line-height: 1;
}

.cart-toast-close:hover {
    color: rgb(13, 54, 75);
}

/* ========================================
   Update Cart Button
   ======================================== */

.cart-update-section {
    margin-top: 1rem;
}

.btn-update-cart {
    width: 100%;
    background: rgb(29, 112, 183);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-update-cart .material-symbols-sharp {
    font-size: 20px;
}

.btn-update-cart:hover:not(:disabled) {
    background: rgba(29, 112, 183, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(29, 112, 183, 0.3);
}

.btn-update-cart:disabled {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-update-cart.cart-needs-update {
    background: rgb(154, 218, 68);
    animation: pulse 2s ease-in-out infinite;
}

.btn-update-cart.cart-needs-update:hover {
    background: rgb(95, 165, 0);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(154, 218, 68, 0.7);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(154, 218, 68, 0);
    }
}

/* ========================================
   Update Cart Actions (Legacy)
   ======================================== */

.cart-actions-row {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ========================================
   Mobile Responsiveness
   ======================================== */

@media only screen and (max-width: 768px) {
    .woocommerce-cart > .container > .cart-header {
        padding-top: 80px; /* Clear mobile sticky header */
    }

    .woocommerce-cart .page-title {
        font-size: 1.5rem;
    }

    .cart-item-card {
        padding: 1rem;
    }

    .cart-item-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .cart-item-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        width: 100%;
    }

    .cart-item-price {
        font-size: 1.25rem;
        text-align: left;
    }

    .cart-item-quantity {
        justify-content: space-between;
        width: 100%;
    }

    .cart-item-quantity input[type="number"],
    .cart-item-quantity input.qty {
        flex: 1;
        max-width: 80px;
    }

    .cart-item-remove {
        justify-content: center;
        width: 100%;
        border: 1px solid rgba(220, 53, 69, 0.3);
    }

    .registration-summary {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        max-height: 70vh;
        overflow-y: auto;
    }

    .registration-summary-title {
        font-size: 1.25rem;
    }

    .registration-summary-row.total {
        font-size: 1.25rem;
    }

    .btn-register {
        font-size: 1rem;
        padding: 0.875rem 1.25rem;
    }

    .cart-toast {
        top: 20px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .cart-actions-row {
        flex-direction: column;
    }

    .cart-actions-row button {
        width: 100%;
    }

    .empty-cart-categories {
        flex-direction: column;
        align-items: stretch;
    }

    .empty-cart-categories .btn-view-trainings {
        width: 100%;
    }
}

/* ========================================
   Loading State
   ======================================== */

.cart-loading {
    position: relative;
}

.cart-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
   Accessibility
   ======================================== */

.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    width: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
}

/* Focus states for keyboard navigation */
.cart-item-remove:focus,
.btn-register:focus,
.btn-continue-shopping:focus,
.btn-update-cart:focus,
.btn-view-trainings:focus {
    outline: 3px solid rgb(29, 112, 183);
    outline-offset: 2px;
}

input:focus,
button:focus {
    outline: 2px solid rgb(29, 112, 183);
    outline-offset: 2px;
}
