/**
 * Cybervend Lot Pricing - Frontend Styles
 */

/* CSS Variables */
:root {
    --clp-primary-color: #2271b1;
    --clp-primary-hover: #135e96;
    --clp-text-color: #333;
    --clp-light-text: #666;
    --clp-border-color: #ddd;
    --clp-bg-light: #f5f5f5;
    --clp-success: #46b450;
    --clp-error: #dc3232;
}

/* ==========================================================================
   Add to Quote Button
   ========================================================================== */

.clp-add-to-quote-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 15px 40px;
    background: var(--clp-primary-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    text-align: center;
}

.clp-add-to-quote-btn:hover {
    background: var(--clp-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

.clp-add-to-quote-btn:active {
    transform: translateY(0);
}

.clp-add-to-quote-btn.clp-added {
    background: var(--clp-success);
}

.clp-add-to-quote-btn.clp-added:hover {
    background: #3a9a42;
}

.clp-add-to-quote-btn svg {
    flex-shrink: 0;
}

/* ==========================================================================
   Floating Cart Button
   ========================================================================== */

.clp-floating-cart {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
}

.clp-floating-cart.clp-position-left {
    right: auto;
    left: 30px;
}

.clp-floating-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: var(--clp-primary-color);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.clp-floating-btn:hover {
    background: var(--clp-primary-hover);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.clp-floating-btn svg {
    width: 24px;
    height: 24px;
}

/* Cart count badge */
.clp-cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: var(--clp-error);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Header cart item */
.clp-header-cart-item {
    position: relative;
}

.clp-header-cart-link {
    display: flex;
    align-items: center;
    position: relative;
    padding: 0 10px;
}

.clp-header-cart-link svg {
    width: 20px;
    height: 20px;
}

.clp-header-cart-link .clp-cart-count {
    position: absolute;
    top: -8px;
    right: 0;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
}

/* ==========================================================================
   Modal Overlay
   ========================================================================== */

.clp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

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

/* ==========================================================================
   Modal Container
   ========================================================================== */

.clp-modal {
    background: #fff;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.clp-modal-overlay.clp-active .clp-modal {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.clp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--clp-border-color);
    background: var(--clp-bg-light);
}

.clp-modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--clp-text-color);
}

.clp-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.clp-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.clp-modal-close svg {
    width: 24px;
    height: 24px;
    color: var(--clp-text-color);
}

/* Modal Body */
.clp-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* ==========================================================================
   Products List
   ========================================================================== */

.clp-products-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.clp-product-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--clp-border-color);
}

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

.clp-product-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
}

.clp-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

.clp-product-image-placeholder {
    width: 100%;
    height: 100%;
    background: var(--clp-bg-light);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clp-product-image-placeholder svg {
    width: 24px;
    height: 24px;
    color: #ccc;
}

.clp-product-info {
    flex: 1;
    min-width: 0;
}

.clp-product-title {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--clp-text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.clp-product-title a {
    color: inherit;
    text-decoration: none;
}

.clp-product-title a:hover {
    color: var(--clp-primary-color);
}

.clp-product-sku {
    font-size: 12px;
    color: var(--clp-light-text);
}

.clp-product-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.clp-product-remove:hover {
    background: rgba(220, 50, 50, 0.1);
}

.clp-product-remove svg {
    width: 18px;
    height: 18px;
    color: var(--clp-error);
}

/* Empty cart */
.clp-empty-cart {
    text-align: center;
    padding: 40px 20px;
    color: var(--clp-light-text);
}

.clp-empty-cart svg {
    width: 60px;
    height: 60px;
    color: #ddd;
    margin-bottom: 15px;
}

.clp-empty-cart p {
    margin: 0;
    font-size: 16px;
}

/* ==========================================================================
   Quote Form
   ========================================================================== */

.clp-quote-form {
    border-top: 1px solid var(--clp-border-color);
    padding-top: 20px;
    margin-top: 20px;
}

.clp-form-row {
    margin-bottom: 15px;
}

.clp-form-row label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 600;
    color: var(--clp-text-color);
}

.clp-form-row label .required {
    color: var(--clp-error);
}

.clp-form-row input[type="text"],
.clp-form-row input[type="email"],
.clp-form-row input[type="tel"],
.clp-form-row textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--clp-border-color);
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.clp-form-row input:focus,
.clp-form-row textarea:focus {
    outline: none;
    border-color: var(--clp-primary-color);
}

.clp-form-row input.clp-error,
.clp-form-row textarea.clp-error {
    border-color: var(--clp-error);
}

.clp-form-row textarea {
    min-height: 80px;
    resize: vertical;
}

.clp-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Honeypot */
.clp-hp-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

/* Submit button */
.clp-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 24px;
    background: var(--clp-primary-color);
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-top: 10px;
}

.clp-submit-btn:hover {
    background: var(--clp-primary-hover);
}

.clp-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.clp-submit-btn .clp-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: clp-spin 0.8s linear infinite;
}

.clp-submit-btn.clp-loading .clp-spinner {
    display: block;
}

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

/* Form messages */
.clp-form-message {
    padding: 12px 15px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 14px;
}

.clp-form-message.clp-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.clp-form-message.clp-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

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

.clp-toast {
    position: fixed;
    bottom: 100px;
    right: 30px;
    padding: 15px 20px;
    background: var(--clp-text-color);
    color: #fff;
    border-radius: 5px;
    font-size: 14px;
    z-index: 999998;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 300px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.clp-toast.clp-visible {
    opacity: 1;
    transform: translateY(0);
}

.clp-toast.clp-success {
    background: var(--clp-success);
}

.clp-toast.clp-error {
    background: var(--clp-error);
}

/* Toast position when floating icon is on left */
.clp-toast.clp-position-left {
    right: auto;
    left: 30px;
}

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

@media screen and (max-width: 768px) {
    .clp-floating-cart {
        bottom: 20px;
        right: 20px;
    }

    .clp-floating-cart.clp-position-left {
        right: auto;
        left: 20px;
    }

    .clp-floating-btn {
        width: 50px;
        height: 50px;
    }

    .clp-floating-btn svg {
        width: 20px;
        height: 20px;
    }

    .clp-modal {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .clp-modal-overlay {
        padding: 0;
    }

    .clp-form-grid {
        grid-template-columns: 1fr;
    }

    .clp-toast {
        bottom: 80px;
        right: 20px;
        left: 20px;
        max-width: none;
    }

    .clp-toast.clp-position-left {
        right: 20px;
        left: 20px;
    }
}

@media screen and (max-width: 480px) {
    .clp-add-to-quote-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
    .clp-floating-cart,
    .clp-modal-overlay,
    .clp-toast {
        display: none !important;
    }
}
