/* Purchase Modal Styles */
.modal {
    backdrop-filter: blur(4px);
    background-color: rgba(0, 0, 0, 0.5);
}

.modal__panel {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s ease-out;
}

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

/* Quantity Input Styling */
.quantity-controls input[type="number"] {
    -moz-appearance: textfield;
}

.quantity-controls input[type="number"]::-webkit-outer-spin-button,
.quantity-controls input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Button Hover Effects */
.quantity-btn {
    transition: all 0.2s ease-in-out;
}

.quantity-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.quantity-btn:active:not(:disabled) {
    transform: translateY(0);
}

/* Fix icon alignment in buttons */
.btn svg {
    vertical-align: middle;
    display: inline-block;
}

/* Ensure proper alignment for shopping cart icon */
#add-to-cart-btn svg,
#buy-now-btn svg {
    margin-top: 0;
    flex-shrink: 0;
    vertical-align: middle;
}

/* Button with icon alignment fix */
.btn.inline-flex {
    align-items: center;
    justify-content: center;
    display: inline-flex !important;
    flex-direction: row !important;
    white-space: nowrap;
}

.btn.inline-flex svg {
    margin-top: 0;
    vertical-align: middle;
    display: inline-block;
}

.btn.inline-flex span {
    display: inline-block;
    vertical-align: middle;
}

/* Specific fixes for modal buttons */
#add-to-cart-btn,
#buy-now-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-direction: row !important;
    gap: 0.5rem;
}

#add-to-cart-btn svg,
#buy-now-btn svg {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
}

#add-to-cart-btn span,
#buy-now-btn span {
    flex-shrink: 0;
}

/* Enhanced button styling for purchase modal */
.purchase-modal-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 24px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    user-select: none;
}

.purchase-modal-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.purchase-modal-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.purchase-modal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

/* Quantity button specific styling */
.quantity-btn {
    min-width: 48px;
    min-height: 48px;
    border: 2px solid #e2e8f0;
    background: white;
    color: #64748b;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.quantity-btn:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.quantity-btn:active:not(:disabled) {
    transform: scale(0.95);
}

/* Modal button focus states */
.purchase-modal-btn:focus,
.quantity-btn:focus {
    outline: none;
    ring: 2px;
    ring-color: #3b82f6;
    ring-opacity: 0.5;
}

/* Responsive button sizing */
@media (max-width: 640px) {
    .purchase-modal-btn {
        min-height: 48px;
        padding: 14px 20px;
        font-size: 16px;
    }

    .quantity-btn {
        min-width: 52px;
        min-height: 52px;
    }
}

/* Price Summary Styling */
.price-summary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(147, 51, 234, 0.05) 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Responsive Design */
@media (max-width: 640px) {
    .modal__panel {
        margin: 1rem;
        width: calc(100% - 2rem);
        max-width: none;
    }

    .quantity-controls {
        flex-direction: column;
        gap: 0.75rem;
    }

    .quantity-controls input {
        width: 100%;
        text-align: center;
    }

    .quantity-controls .quantity-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Loading State */
.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

/* Product Description Styling */
#modal-product-description {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    line-height: 1.5;
}

/* Ensure proper text wrapping in modal content */
.modal__panel .text-sm {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Success Animation */
.success-checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: #4ade80;
    stroke-miterlimit: 10;
    margin: 10% auto;
    box-shadow: inset 0px 0px 0px #4ade80;
    animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
}

.success-checkmark__circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: #4ade80;
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.success-checkmark__check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes scale {
    0%, 100% {
        transform: none;
    }
    50% {
        transform: scale3d(1.1, 1.1, 1);
    }
}

@keyframes fill {
    100% {
        box-shadow: inset 0px 0px 0px 30px #4ade80;
    }
}
