/**
 * Nerdspider Product Calculator Styles
 */

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

/* Trigger Button */
.nspc-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
    background-color: var(--e-global-color-primary, #2563eb);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nspc-trigger-btn:hover {
    background-color: var(--e-global-color-primary, #2563eb);
    filter: brightness(0.9);
    transform: translateY(-1px);
}

.nspc-trigger-btn:active {
    transform: translateY(0);
}

.nspc-trigger-btn.nspc-active {
    background-color: var(--e-global-color-primary, #2563eb);
    filter: brightness(0.9);
}

.nspc-btn-icon {
    display: flex;
    align-items: center;
    font-size: 1em;
}

.nspc-btn-icon svg {
    width: 1em;
    height: 1em;
}

/* Popup Overlay */
.nspc-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Popup Content */
.nspc-popup-content {
    position: relative;
    width: 420px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 32px;
    opacity: 0;
    transform: scale(0.95) translateY(10px);
    transition: all 0.2s ease;
}

.nspc-popup-content.nspc-popup-animate {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Inline Drawer */
.nspc-inline-drawer {
    margin-top: 16px;
    width: 100%;
}

.nspc-inline-content {
    width: 100%;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 24px;
    border: 1px solid #e5e7eb;
}

/* Close Button */
.nspc-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    color: #6b7280;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.nspc-popup-close svg {
    width: 1em;
    height: 1em;
}

.nspc-popup-close:hover {
    color: #1f2937;
    background-color: #f3f4f6;
}

/* Popup Title */
.nspc-popup-title {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
}

/* Product Info */
.nspc-product-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background-color: #f9fafb;
    border-radius: 8px;
    margin-bottom: 20px;
}

.nspc-product-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.nspc-product-details {
    flex: 1;
    min-width: 0;
}

.nspc-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nspc-product-price {
    font-size: 14px;
    color: #059669;
    font-weight: 500;
}

/* Variation Selectors */
.nspc-variations {
    margin-bottom: 20px;
}

.nspc-variation-row {
    margin-bottom: 12px;
}

.nspc-variation-row:last-child {
    margin-bottom: 0;
}

.nspc-variation-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.nspc-variation-select {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    background-color: #ffffff;
    color: #1f2937;
    cursor: pointer;
    transition: border-color 0.15s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 20px;
    padding-right: 40px;
}

.nspc-variation-select:focus {
    outline: none;
    border-color: var(--e-global-color-primary, #2563eb);
}

.nspc-variation-select:hover {
    border-color: #9ca3af;
}

/* Toast Notification */
.nspc-toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.nspc-toast-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.nspc-toast-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.nspc-toast-message {
    flex: 1;
}

.nspc-toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    color: inherit;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.nspc-toast-close:hover {
    opacity: 1;
}

/* Formula Info */
.nspc-formula-info {
    padding: 12px 16px;
    background-color: #f8fafc;
    border-left: 3px solid var(--e-global-color-primary, #2563eb);
    border-radius: 0 6px 6px 0;
    font-size: 14px;
    color: #334155;
    margin-bottom: 20px;
}

/* Input Group */
.nspc-input-group {
    margin-bottom: 20px;
}

.nspc-input-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.nspc-input-wrapper {
    display: flex;
    align-items: stretch;
}

.nspc-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 18px;
    border: 2px solid #e5e7eb;
    border-radius: 8px 0 0 8px;
    outline: none;
    transition: border-color 0.15s ease;
    -moz-appearance: textfield;
}

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

.nspc-input:focus {
    border-color: var(--e-global-color-primary, #2563eb);
}

.nspc-input-suffix {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    background-color: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-left: none;
    border-radius: 0 8px 8px 0;
    min-width: 50px;
}

.nspc-input-suffix svg,
.nspc-input-suffix i {
    width: 1em;
    height: 1em;
}

/* Result */
.nspc-result {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border-radius: 10px;
    margin-bottom: 20px;
    color: #ffffff;
}

.nspc-result-label {
    font-size: 14px;
    opacity: 0.9;
}

.nspc-result-quantity {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
}

.nspc-result-unit {
    font-size: 16px;
    font-weight: 500;
}

/* Actions */
.nspc-actions {
    margin-bottom: 16px;
}

.nspc-add-to-cart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background-color: var(--e-global-color-primary, #2563eb);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nspc-add-to-cart-btn:hover:not(:disabled) {
    filter: brightness(0.9);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.3);
}

.nspc-add-to-cart-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nspc-add-to-cart-btn:active:not(:disabled) {
    transform: translateY(0);
}

/* Spinner */
.nspc-spinner {
    width: 20px;
    height: 20px;
    animation: nspc-spin 1s linear infinite;
}

@keyframes nspc-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Message */
.nspc-message {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    margin-bottom: 16px;
}

.nspc-message.nspc-success {
    background-color: #d1fae5;
    color: #065f46;
}

.nspc-message.nspc-error {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Cart Links */
.nspc-cart-links {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.nspc-cart-links a {
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s ease;
}

.nspc-view-cart {
    color: #6b7280;
}

.nspc-view-cart:hover {
    color: #1f2937;
}

.nspc-checkout {
    color: var(--e-global-color-primary, #2563eb);
}

.nspc-checkout:hover {
    color: var(--e-global-color-primary, #2563eb);
    filter: brightness(0.8);
}

/* Responsive */
@media (max-width: 480px) {
    .nspc-popup-content,
    .nspc-inline-content {
        padding: 24px;
    }

    .nspc-popup-title {
        font-size: 18px;
        padding-right: 30px;
    }

    .nspc-product-info {
        flex-direction: column;
        text-align: center;
    }

    .nspc-product-name {
        white-space: normal;
    }

    .nspc-result-quantity {
        font-size: 28px;
    }
}
