/**
 * ppsharecart - Cart Sharing Module
 *
 * Frontend Styles
 *
 * @author    PrestaPro
 * @copyright PrestaPro
 * @license   AFL-3.0
 */

/* ============================================
   Share Cart - Compact Inline Layout
   ============================================ */

.ppsharecart-share-container {
    margin: 12px 0;
    border-top: 1px solid #e5e5e5;
    padding-top: 12px;
}

.ppsharecart-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.ppsharecart-benefits {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.ppsharecart-benefit {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #7a7a7a;
    white-space: nowrap;
}

.ppsharecart-benefit svg {
    flex-shrink: 0;
    color: #2fb5d2;
}

.ppsharecart-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.4;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ppsharecart-share-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ppsharecart-login-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #2fb5d2;
    border: 1px solid #2fb5d2;
    border-radius: 5px;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.ppsharecart-login-link:hover {
    background-color: #2fb5d2;
    color: #fff;
    text-decoration: none;
}

.ppsharecart-login-link svg {
    flex-shrink: 0;
}

.ppsharecart-icon {
    flex-shrink: 0;
}

/* ============================================
   Checkout - Compact variant
   ============================================ */

.ppsharecart-checkout {
    text-align: center;
    padding: 10px 0 4px;
}

.ppsharecart-checkout-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 500;
    color: #7a7a7a;
    background: none;
    border: 1px solid #e5e5e5;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.ppsharecart-checkout-btn:hover {
    color: #2fb5d2;
    border-color: #2fb5d2;
    text-decoration: none;
}

.ppsharecart-checkout-btn svg {
    flex-shrink: 0;
}

.ppsharecart-checkout-btn--login:hover {
    background-color: #2fb5d2;
    color: #fff;
}

/* ============================================
   Modal Overlay and Container
   ============================================ */

.ppsharecart-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.ppsharecart-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ppsharecart-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.ppsharecart-modal-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 20px;
    z-index: 1;
}

.ppsharecart-modal-content {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: ppsharecart-modal-appear 0.2s ease-out;
}

@keyframes ppsharecart-modal-appear {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   Modal Header
   ============================================ */

.ppsharecart-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e5e5;
}

.ppsharecart-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #232323;
}

.ppsharecart-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: none;
    color: #666;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.ppsharecart-modal-close:hover {
    background-color: #f0f0f0;
    color: #232323;
}

/* ============================================
   Modal Body
   ============================================ */

.ppsharecart-modal-body {
    padding: 20px;
    min-height: 150px;
}

/* State containers */
.ppsharecart-state {
    text-align: center;
}

/* Loading State */
.ppsharecart-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 0;
}

.ppsharecart-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e5e5;
    border-top-color: #2fb5d2;
    border-radius: 50%;
    animation: ppsharecart-spin 0.8s linear infinite;
}

@keyframes ppsharecart-spin {
    to {
        transform: rotate(360deg);
    }
}

.ppsharecart-loading p {
    margin-top: 15px;
    color: #666;
    font-size: 14px;
}

/* Success State */
.ppsharecart-success {
    text-align: left;
}

.ppsharecart-description {
    margin: 0 0 15px;
    color: #444;
    font-size: 14px;
}

.ppsharecart-link-container {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.ppsharecart-link-input {
    flex: 1;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background-color: #f8f8f8;
    color: #333;
    cursor: text;
}

.ppsharecart-link-input:focus {
    outline: none;
    border-color: #2fb5d2;
    background-color: #fff;
}

.ppsharecart-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.ppsharecart-copy-btn.copied {
    background-color: #28a745;
    border-color: #28a745;
}

.ppsharecart-expiry-info {
    margin: 0;
    padding: 10px 12px;
    background-color: #f0f7ff;
    border-left: 3px solid #2fb5d2;
    border-radius: 0 4px 4px 0;
    font-size: 13px;
    color: #555;
}

.ppsharecart-copy-feedback {
    display: none;
    margin-top: 12px;
    padding: 10px 15px;
    background-color: #d4edda;
    color: #155724;
    border-radius: 4px;
    font-size: 14px;
    animation: ppsharecart-fade-in 0.2s ease;
}

.ppsharecart-copy-feedback.visible {
    display: block;
}

@keyframes ppsharecart-fade-in {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Error State */
.ppsharecart-error {
    padding: 20px 0;
}

.ppsharecart-error-icon {
    margin-bottom: 15px;
    color: #dc3545;
}

.ppsharecart-error-message {
    margin: 0 0 20px;
    color: #666;
    font-size: 14px;
}

.ppsharecart-retry-btn {
    margin-top: 10px;
}

/* ============================================
   Modal Footer
   ============================================ */

.ppsharecart-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid #e5e5e5;
    background-color: #f8f8f8;
}

/* ============================================
   Load Result Page Styles
   ============================================ */

.ppsharecart-result {
    max-width: 600px;
    margin: 40px auto;
    padding: 20px;
}

.ppsharecart-result-content {
    text-align: center;
}

.ppsharecart-result-icon {
    margin-bottom: 20px;
}

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

.ppsharecart-icon-warning {
    color: #ffc107;
}

.ppsharecart-icon-error {
    color: #dc3545;
}

.ppsharecart-result-title {
    margin: 0 0 15px;
    font-size: 24px;
    font-weight: 600;
    color: #232323;
}

.ppsharecart-result-message {
    margin: 0 0 25px;
    font-size: 16px;
    color: #666;
}

/* Products Lists */
.ppsharecart-products-list {
    margin: 25px 0;
    text-align: left;
}

.ppsharecart-products-list h4 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ppsharecart-products {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    overflow: hidden;
}

.ppsharecart-product-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    border-bottom: 1px solid #e5e5e5;
    font-size: 14px;
}

.ppsharecart-product-item:last-child {
    border-bottom: none;
}

.ppsharecart-product-success {
    background-color: #f8fff8;
}

.ppsharecart-product-failed {
    background-color: #fff8f8;
}

.ppsharecart-product-name {
    flex: 1;
    font-weight: 500;
    color: #232323;
}

.ppsharecart-product-attributes {
    color: #666;
    font-size: 13px;
}

.ppsharecart-product-qty {
    color: #666;
    font-size: 13px;
    min-width: 40px;
    text-align: right;
}

.ppsharecart-product-reason {
    width: 100%;
    margin-top: 4px;
    padding-left: 0;
    color: #dc3545;
    font-size: 12px;
    font-style: italic;
}

/* Action Buttons */
.ppsharecart-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 30px;
}

.ppsharecart-btn-cart,
.ppsharecart-btn-home {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.ppsharecart-btn-cart:hover,
.ppsharecart-btn-home:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    text-decoration: none;
}

/* ============================================
   Responsive Styles
   ============================================ */

@media (max-width: 576px) {
    .ppsharecart-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .ppsharecart-benefits {
        justify-content: center;
    }

    .ppsharecart-share-btn,
    .ppsharecart-login-link {
        justify-content: center;
    }

    .ppsharecart-modal-container {
        margin: 10px;
    }

    .ppsharecart-modal-header {
        padding: 14px 16px;
    }

    .ppsharecart-modal-body {
        padding: 16px;
    }

    .ppsharecart-modal-footer {
        padding: 14px 16px;
    }

    .ppsharecart-link-container {
        flex-direction: column;
    }

    .ppsharecart-copy-btn {
        width: 100%;
    }

    .ppsharecart-result {
        margin: 20px auto;
        padding: 15px;
    }

    .ppsharecart-result-title {
        font-size: 20px;
    }

    .ppsharecart-result-message {
        font-size: 14px;
    }

    .ppsharecart-actions {
        flex-direction: column;
    }

    .ppsharecart-btn-cart,
    .ppsharecart-btn-home {
        width: 100%;
        text-align: center;
    }
}

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

.ppsharecart-modal-close:focus,
.ppsharecart-share-btn:focus,
.ppsharecart-copy-btn:focus,
.ppsharecart-retry-btn:focus {
    outline: 2px solid #2fb5d2;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .ppsharecart-modal-content {
        animation: none;
    }

    .ppsharecart-spinner {
        animation-duration: 1.5s;
    }

    .ppsharecart-share-btn:hover,
    .ppsharecart-btn-cart:hover,
    .ppsharecart-btn-home:hover {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ppsharecart-link-input {
        border-width: 2px;
    }

    .ppsharecart-products {
        border-width: 2px;
    }

    .ppsharecart-modal-content {
        border: 2px solid #000;
    }
}
