/* Form Container */
.form-container {
    position: relative;
    align-items: center;
}

.history-anchor {
    position: relative;
}

.history-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #d9dde2;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    padding: 0.25rem 0;
    margin-top: 2px;
    z-index: 55;
    max-height: 260px;
    overflow-y: auto;
    font-size: 0.8rem;
}

.history-dropdown ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history-dropdown li {
    margin: 0;
}

.history-dropdown .history-btn {
    display: flex;
    flex-direction: column;
    width: 100%;
    text-align: right;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    line-height: 1.2;
}

.history-dropdown .history-btn:hover,
.history-dropdown .history-btn:focus {
    background: #f5f8fa;
}

.history-dropdown .history-btn.active {
    background: #e9f3ff;
}

.history-dropdown .history-line {
    font-weight: 500;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-dropdown .history-time {
    font-size: 0.6rem;
    color: #6c757d;
    margin-top: 2px;
    direction: ltr;
    text-align: left;
}

.history-dropdown-empty {
    padding: 0.5rem 0.75rem;
    color: #888;
    font-size: 0.75rem;
}
/* Grid layout for key/value pairs (4 columns: key, value, key, value ...) */
.history-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem 0.75rem;
    align-items: start;
}
.history-grid .hist-pair {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 0.35rem;
    align-items: center;
    min-width: 0;
}
.history-grid .hist-key {
    font-weight: 600;
    font-size: 0.65rem;
    color: #445;
    background: #f1f3f5;
    padding: 2px 6px;
    border-radius: 4px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-grid .hist-val {
    font-size: 0.65rem;
    color: #222;
    padding: 2px 4px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-btn:hover .hist-pair .hist-val {
    border-color: #c9ced3;
}
.history-btn.active .hist-pair .hist-val {
    border-color: #007bff;
}

/* Compact Form Styles */
.form-container.compact-form {
    gap: 0.5rem;
    max-width: 60%;
    margin: 0 auto;
    padding-top: 1.6rem;
}

.compact-form .form-row {
    margin: 0;
    margin-bottom: 0.5rem;
}

.compact-form .input-group {
    margin-bottom: 0.5rem;
}

/* .compact-form .input-wrapper {
    height: 2.25rem;
} */

.compact-form input.form-control {
    height: 2.25rem;
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
}

.compact-form .prefix-icon {
    line-height: 2.25rem;
    width: 2.25rem;
}

/* Purchase Summary */
.purchase-summary {
    margin: 0;
    border-radius: var(--card-border-radius);
    overflow: hidden;
    border-left: 0.25rem solid var(--color-primary-500);
    /* 4px ÷ 16 = 0.25rem */
    transition: var(--transition-smooth);
    background-color: var(--card-bg);
    color: var(--text-color);
    height: 100%;
    box-shadow: var(--shadow-small);
    width: 100%;
    max-width: 36rem;
}

.purchase-summary-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1rem;
    height: 100%;
}

.purchase-game-details {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.game-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: var(--text-md);
}

.service-divider {
    color: var(--color-primary-500);
    font-weight: bold;
}

.service-name {
    color: var(--color-primary-500);
    font-weight: 600;
    font-size: var(--text-md);
}

.purchase-price {
    display: flex;
    align-items: baseline;
    gap: 0.15rem;
}

.price-amount {
    font-weight: 700;
    font-size: var(--text-xl);
    color: var(--text-color);
}

.currency-symbol {
    font-weight: 600;
    font-size: var(--text-md);
    color: var(--color-primary-500);
}

/* Form Footer Container */
.form-footer-conrainer {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin: 1rem -0.3125rem;
    align-items: center;
    border-top: 0.0625rem solid var(--border-color);
    padding-top: 1rem;
    justify-content: center;
}

.compact-form .form-footer-conrainer {
    gap: 1rem;
    margin: 0.5rem 0;
    padding-top: 0.5rem;
}

/* Submit Button Styling */
.form-container .submit-btn {
    min-width: 7.5rem;
    /* 120px ÷ 16 = 7.5rem */
    max-width: 12.5rem;
    /* 200px ÷ 16 = 12.5rem */
    /* margin-inline-start: auto; */
    width: 100%;
    margin: 0;
}

/* .compact-form .submit-btn {
    height: 2.25rem;
    font-size: 0.875rem;
    padding: 0.25rem 1rem;
} */

/* Quantity Control Styling */
.quantity-control {
    justify-self: start;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 9.375rem;
    /* 150px ÷ 16 = 9.375rem */
    height: 100%;
    background-color: var(--input-bg);
    border-radius: var(--card-border-radius);
    overflow: hidden;
    border: 0.0625rem solid var(--border-color);
    /* 1px ÷ 16 = 0.0625rem */
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-small);
    margin: 0;
}

.compact-form .quantity-control {
    max-width: 13.5rem;
    height: 3.25rem;
}

.quantity-control:focus-within {
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 0.125rem rgba(var(--color-primary-500-rgb), 0.2);
    /* 2px ÷ 16 = 0.125rem */
}

.quantity-input {
    flex: 1;
    text-align: center;
    font-weight: 600;
    color: var(--text-color);
    background-color: transparent;
    height: 2.5rem;
    /* 40px ÷ 16 = 2.5rem */
    padding: 0 0.5rem;
    border-left: 0.0625rem solid var(--border-color);
    /* 1px ÷ 16 = 0.0625rem */
    border-right: 0.0625rem solid var(--border-color);
    /* 1px ÷ 16 = 0.0625rem */
}

.compact-form .quantity-input {
    height: 2.25rem;
    font-size: 0.875rem;
    padding: 0 0.25rem;
}

.quantity-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    /* 40px ÷ 16 = 2.5rem */
    height: 2.5rem;
    /* 40px ÷ 16 = 2.5rem */
    color: var(--text-color);
    background-color: transparent;
    transition: var(--transition-smooth);
}

.compact-form .quantity-btn {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.75rem;
}

.quantity-btn:hover {
    background-color: var(--color-primary-500);
    color: var(--color-gray-50);
}

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

.quantity-btn.plus {
    color: var(--color-primary-600);
}

.quantity-btn.minus {
    color: var(--color-primary-600);
}

/* Pin Warning */
.pin-warning {
    background-color: var(--color-red-600);
    color: var(--color-gray-50);
    border-radius: var(--card-border-radius);
    padding: 0.5rem;
    font-weight: 500;
    text-align: center;
    margin: 0;
    border-left: 0.25rem solid var(--color-red-800);
    /* 4px ÷ 16 = 0.25rem */
    animation: red-pulse 2s infinite;
}

@keyframes red-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(var(--color-red-600-rgb), 0.7);
    }

    70% {
        box-shadow: 0 0 0 0.625rem rgba(var(--color-red-600-rgb), 0);
        /* 10px ÷ 16 = 0.625rem */
    }

    100% {
        box-shadow: 0 0 0 0 rgba(var(--color-red-600-rgb), 0);
    }
}

/* Dark Mode Styles */
html.dark .purchase-summary {
    border-left-color: var(--color-primary-600);
}

html.dark .service-name {
    color: var(--color-primary-400);
}

html.dark .service-divider {
    color: var(--color-primary-600);
}

html.dark .currency-symbol {
    color: var(--color-primary-400);
}

html.dark .quantity-btn.plus,
html.dark .quantity-btn.minus {
    color: var(--color-primary-400);
}

html.dark .quantity-btn:hover {
    background-color: var(--color-primary-700);
    color: var (--color-gray-100);
}

html.dark .pin-warning {
    background-color: var(--color-red-900);
    border-left-color: var(--color-red-600);
}

html.dark @keyframes red-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(var(--color-red-700-rgb), 0.7);
    }

    70% {
        box-shadow: 0 0 0 0.625rem rgba(var(--color-red-700-rgb), 0);
        /* 10px ÷ 16 = 0.625rem */
    }

    100% {
        box-shadow: 0 0 0 0 rgba(var(--color-red-700-rgb), 0);
    }
}

/* Media Queries */
@media (max-width: 768px) {
    .quantity-control {
        justify-self: center;
        margin: auto;
    }

    .purchase-summary {
        margin-bottom: 0.5rem;
    }

    .form-container .submit-btn {
        margin: auto;
    }

    .form-container.compact-form {
        gap: 0.3rem;
        max-width: 95%;
    }
}

@media (max-width: 576px) {
    .purchase-summary-content {
        padding: 0.5rem 1rem;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .quantity-control {
        max-width: 7.5rem;
        /* 120px ÷ 16 = 7.5rem */
        height: 2.25rem;
        /* 36px ÷ 16 = 2.25rem */
    }

    .quantity-btn {
        width: 2.25rem;
        /* 36px ÷ 16 = 2.25rem */
        height: 2.25rem;
        /* 36px ÷ 16 = 2.25rem */
    }

    .quantity-input {
        height: 2.25rem;
        /* 36px ÷ 16 = 2.25rem */
        font-size: 0.9rem;
    }

    .form-container .submit-btn {
        font-size: 0.95rem;
        max-width: none;
    }

    .game-name,
    .service-name {
        font-size: var(--text-xs);
    }

    .price-amount {
        font-size: var(--text-lg);
    }

    .currency-symbol {
        font-size: var(--text-xs);
    }

    .form-container.compact-form {
        gap: 0.2rem;
        max-width: 100%;
        padding: 1.5rem 0.5rem;
    }

    .compact-form .form-footer-conrainer {
        gap: 0.5rem;
    }
}

.no-product-selected-message {
    margin: 2rem 0;
    animation: fadeIn 0.3s ease-in-out;
}

.no-product-selected-message .alert {
    border: 2px dashed var(--color-primary-500);
    background-color: rgba(var(--color-primary-500-rgb), 0.1);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 0;
}

.no-product-selected-message .alert i {
    font-size: 2rem;
    color: var(--color-primary-500);
    margin-bottom: 1rem;
}

.no-product-selected-message .alert h5 {
    color: var(--color-primary-500);
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.no-product-selected-message .alert p {
    color: var(--color-gray-600);
    margin-bottom: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-container {
    animation: slideIn 0.3s ease-in-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
