/* =========================================
   COMPONENTS
   ========================================= */

.btn-retry {
    margin-top: 16px;
    padding: 10px 24px;
    background: var(--color-primary);
    color: var(--color-surface);
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
}

.price-old {
    font-size: 11px;
    text-decoration: line-through;
    color: var(--color-text-muted);
}

.price-current {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-primary);
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-backdrop[data-state="open"] {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--color-surface);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: 24px 24px 0 0;
    position: relative;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
}

.modal-backdrop[data-state="open"] .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    border: none;
    border-radius: 50%;
    color: var(--color-surface);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.modal-body {
    padding: 24px;
}

.modal-header {
    margin-bottom: 24px;
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--color-text);
}

.modal-desc {
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
}

.modal-price-box {
    display: flex;
    flex-direction: column;
}

.modal-price-box .price-old {
    font-size: 14px;
}

.modal-price-box .price-current {
    font-size: 20px;
    color: var(--color-primary);
}

.option-label {
    cursor: pointer;
    position: relative;
    user-select: none;
    margin: 0;
}

.option-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.option-label .radio-custom,
.option-label .checkbox-custom {
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    height: 20px;
    width: 20px;
    background-color: transparent;
    border: 2px solid var(--color-text-muted);
    transition: all 0.2s ease;
}

.option-label .radio-custom {
    border-radius: 50%;
}

.option-label .checkbox-custom {
    border-radius: 4px;
}

.option-label .radio-custom::after {
    content: "";
    position: absolute;
    display: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-primary);
}

.option-label .checkbox-custom::after {
    content: "✓";
    position: absolute;
    display: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: 900;
}

.option-label input:checked ~ .radio-custom,
.option-label input:checked ~ .checkbox-custom {
    border-color: var(--color-primary);
}

.option-label input[type="checkbox"]:checked ~ .checkbox-custom {
    background: var(--color-primary);
}

.option-label input:checked ~ .radio-custom::after,
.option-label input:checked ~ .checkbox-custom::after {
    display: block;
}

.option-label input:checked ~ .radio-custom {
    border-color: var(--color-primary);
}

.option-label input:checked ~ .radio-custom::after {
    display: block;
}

.option-label:has(input:checked) {
    border-color: var(--color-primary);
    background: rgba(249, 115, 22, 0.1);
}

.option-label:has(input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--color-surface);
}

.option-label:has(input:disabled) .radio-custom {
    border-color: rgba(255, 255, 255, 0.1);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: 0 0 24px 24px;
    position: sticky;
    bottom: 0;
}

.modal-backdrop[data-state="open"] .modal-footer {
    display: block;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-surface);
    border: none;
    border-radius: 12px;
    padding: 16px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.btn-primary:active:not(.btn-disabled) {
    transform: scale(0.98);
}

.btn-primary:disabled,
.btn-primary.btn-disabled {
    background: var(--color-border);
    color: var(--color-text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-outline {
    background: transparent;
    color: var(--color-text);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 16px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-outline:hover:not(:disabled) {
    background: var(--color-background);
}

.btn-outline:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

[data-role="product-added-confirmation"] .modal-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

[data-role="product-added-confirmation"] .modal-footer > button {
    min-height: 55px;
}

.error-highlight {
    border: 1px solid var(--color-danger) !important;
    background-color: rgba(239, 68, 68, 0.05);
    border-radius: 12px;
    padding: 12px;
    transition: all 0.3s ease;
}

.error-msg {
    color: var(--color-danger);
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
    display: block;
}

.cart-btn-link {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
    font-family: inherit;
}

.cart-btn-link:hover {
    color: var(--color-text);
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    padding: 4px 12px;
}

.qty-btn {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.qty-btn:disabled {
    color: var(--color-text-muted);
    cursor: not-allowed;
}

.qty-val {
    font-weight: 700;
    font-size: 14px;
}

.modal-content {
    display: flex !important;
    flex-direction: column !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    padding-bottom: 0 !important;
}

.modal-scroll-container {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 32px; 
}

.modal-footer {
    position: relative !important;
    flex-shrink: 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom)) !important;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    z-index: 10;
    width: 100%;
}
