/* =============================================
   SELECT PAYMENT PAGE - Responsive Design
   ============================================= */

/* Page Wrapper */
.sp-page {
    min-height: calc(100vh - 80px);
    padding: 28px 16px 64px;
}

.sp-container {
    max-width: 1060px;
    margin: 0 auto;
}

/* ---- Progress Steps ---- */
.sp-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32px;
}

.sp-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.sp-step__circle {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--color-gray-100);
    color: var(--color-gray-500);
    font-weight: 700;
    font-size: 14px;
    border: 2px solid var(--color-gray-200);
    transition: all 0.2s;
}

.sp-step__label {
    font-size: 12px;
    color: var(--color-gray-500);
    font-weight: 500;
}

.sp-step__line {
    width: 48px;
    height: 2px;
    background: var(--color-gray-200);
    margin: 0 6px;
    margin-bottom: 26px;
    border-radius: 2px;
}

.sp-step--done .sp-step__circle,
.sp-step--active .sp-step__circle {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(12, 149, 30, 0.25);
}

.sp-step--active .sp-step__label {
    color: var(--color-primary);
    font-weight: 700;
}

.sp-step__line--done {
    background: var(--color-primary);
}

/* ---- Grid Layout ---- */
.sp-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
    align-items: start;
}

/* ---- Generic Card ---- */
.sp-card {
    background: white;
    border: 1px solid var(--color-gray-200);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.sp-card__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--color-gray-200);
    background: rgba(12, 149, 30, 0.03);
}

.sp-card__head svg {
    color: var(--color-primary);
    flex-shrink: 0;
}

.sp-card__head h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-gray-800);
    margin: 0;
}

.sp-card__body {
    padding: 22px;
}

/* ---- Discount Code ---- */
.sp-discount {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-gray-200);
}

.sp-discount__title {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.sp-discount__row {
    display: flex;
    gap: 8px;
}

.sp-discount__input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--color-gray-200);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    text-transform: uppercase;
    color: var(--color-gray-800);
    outline: none;
    transition: border-color 0.2s;
    min-width: 0;
}

.sp-discount__input:focus {
    border-color: var(--color-primary);
}

.sp-discount__btn {
    padding: 12px 20px;
    background: var(--color-gray-100);
    border: 2px solid var(--color-gray-200);
    border-radius: 12px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    color: var(--color-gray-700);
    transition: all 0.2s;
}

.sp-discount__btn:hover {
    border-color: var(--color-gray-400);
}

.sp-discount__btn--remove {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.sp-discount__btn--remove:hover {
    background: #fecaca;
}

.sp-discount__msg {
    font-size: 12px;
    margin-top: 8px;
    font-weight: 600;
}

.sp-discount__msg--success {
    color: #16a34a;
}

.sp-discount__msg--error {
    color: #ef4444;
}

/* ---- Payment Groups ---- */
.sp-group {
    margin-bottom: 22px;
}

.sp-group:last-child {
    margin-bottom: 0;
}

.sp-group__title {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.sp-methods {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ---- Payment Method Option ---- */
.sp-method {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 2px solid var(--color-gray-200);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.sp-method:hover {
    border-color: var(--color-gray-300);
}

.sp-method.selected {
    border-color: var(--color-primary);
    background: rgba(12, 149, 30, 0.03);
    box-shadow: 0 0 0 1px var(--color-primary);
}

.sp-method input[type="radio"] {
    display: none;
}

.sp-method__radio {
    width: 22px;
    height: 22px;
    border: 2px solid var(--color-gray-300);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sp-method.selected .sp-method__radio {
    border-color: var(--color-primary);
}

.sp-method__radio::after {
    content: '';
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--color-primary);
    transform: scale(0);
    transition: transform 0.15s ease;
}

.sp-method.selected .sp-method__radio::after {
    transform: scale(1);
}

.sp-method__info {
    flex: 1;
    min-width: 0;
}

.sp-method__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-gray-800);
}

.sp-method__fee {
    font-size: 12px;
    color: var(--color-gray-500);
    margin-top: 2px;
}

.sp-method__fee--red {
    color: #ef4444;
    font-weight: 600;
}

.sp-method__fee--green {
    color: #16a34a;
    font-weight: 600;
}

.sp-method__total {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-primary);
    white-space: nowrap;
}

/* Empty State */
.sp-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--color-gray-500);
}

.sp-empty p:first-child {
    font-weight: 600;
    margin-bottom: 4px;
}

.sp-empty p:last-child {
    font-size: 13px;
}

/* ---- Sidebar ---- */
.sp-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 100px;
}

/* Order Summary Mini */
.sp-summary {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sp-summary__img {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--color-gray-100);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sp-summary__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sp-summary__img--fallback {
    background: var(--color-gray-100);
}

.sp-summary__text {
    flex: 1;
    min-width: 0;
}

.sp-summary__text h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-gray-800);
    margin: 0;
    line-height: 1.3;
}

.sp-summary__text p {
    font-size: 12px;
    color: var(--color-gray-500);
    margin: 3px 0 0;
}

/* ---- Totals ---- */
.sp-totals {
    padding: 16px 22px 20px;
    background: rgba(12, 149, 30, 0.03);
    border-top: 1px solid var(--color-gray-200);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sp-totals__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.sp-totals__label {
    color: var(--color-gray-500);
    font-size: 13px;
    font-weight: 500;
}

.sp-totals__value {
    font-weight: 600;
    color: var(--color-gray-800);
    font-size: 13px;
}

.sp-totals__row--discount .sp-totals__label,
.sp-totals__row--discount .sp-totals__value {
    color: #16a34a;
}

.sp-totals__row--grand {
    padding-top: 12px;
    margin-top: 6px;
    border-top: 2px solid var(--color-gray-200);
}

.sp-totals__row--grand .sp-totals__label {
    font-weight: 700;
    color: var(--color-gray-800);
    font-size: 14px;
}

.sp-totals__row--grand .sp-totals__value {
    font-size: 18px;
    font-weight: 800;
    color: var(--color-primary);
}

/* ---- Action Buttons ---- */
.sp-actions {
    display: flex;
    gap: 12px;
}

.sp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
}

.sp-btn--primary {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 2px 10px rgba(12, 149, 30, 0.3);
    flex: 1;
}

.sp-btn--primary:hover {
    background: var(--color-primary-dark);
    box-shadow: 0 4px 16px rgba(12, 149, 30, 0.35);
    transform: translateY(-1px);
}

.sp-btn--secondary {
    background: white;
    color: var(--color-gray-700);
    border: 2px solid var(--color-gray-200);
}

.sp-btn--secondary:hover {
    border-color: var(--color-gray-400);
}

.sp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Spinner */
.sp-spin {
    animation: spSpin 1s linear infinite;
}

@keyframes spSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ---- Mobile Sticky Footer (hidden on desktop) ---- */
.sp-mobile-footer {
    display: none;
}

/* =============================================
   RESPONSIVE - Tablet (max 900px)
   ============================================= */
@media (max-width: 900px) {
    .sp-grid {
        grid-template-columns: 1fr 300px;
        gap: 20px;
    }
}

/* =============================================
   RESPONSIVE - Mobile (max 768px)
   ============================================= */
@media (max-width: 768px) {
    .sp-page {
        padding: 20px 12px 120px;
        /* extra bottom for sticky footer */
    }

    .sp-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .sp-sidebar {
        position: static;
    }

    /* Reorder: summary first on mobile */
    .sp-grid {
        display: flex;
        flex-direction: column;
    }

    .sp-sidebar {
        order: -1;
    }

    /* Steps compact */
    .sp-steps {
        margin-bottom: 24px;
    }

    .sp-step__circle {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }

    .sp-step__label {
        font-size: 11px;
    }

    .sp-step__line {
        width: 32px;
        margin: 0 4px;
        margin-bottom: 24px;
    }

    /* Cards */
    .sp-card {
        border-radius: 14px;
    }

    .sp-card__head {
        padding: 14px 18px;
    }

    .sp-card__head h2 {
        font-size: 14px;
    }

    .sp-card__body {
        padding: 18px;
    }

    /* Methods */
    .sp-method {
        padding: 12px 14px;
        border-radius: 12px;
        gap: 10px;
    }

    .sp-method__radio {
        width: 20px;
        height: 20px;
    }

    .sp-method__radio::after {
        width: 10px;
        height: 10px;
    }

    .sp-method__name {
        font-size: 13px;
    }

    .sp-method__fee {
        font-size: 11px;
    }

    .sp-method__total {
        font-size: 13px;
    }

    /* Desktop actions hidden; mobile footer shown */
    .sp-actions {
        display: none;
    }

    .sp-mobile-footer {
        display: flex;
        align-items: center;
        gap: 16px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 14px 16px;
        border-top: 1px solid var(--color-gray-200);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
        z-index: 100;
    }

    .sp-mobile-footer__total {
        display: flex;
        flex-direction: column;
        gap: 1px;
        min-width: 0;
    }

    .sp-mobile-footer__total span {
        font-size: 11px;
        color: var(--color-gray-500);
        font-weight: 600;
    }

    .sp-mobile-footer__total strong {
        font-size: 17px;
        font-weight: 800;
        color: var(--color-primary);
        white-space: nowrap;
    }

    .sp-mobile-footer__btn {
        flex: 1;
        padding: 14px 16px;
        font-size: 14px;
    }

    /* Totals section */
    .sp-totals {
        padding: 14px 18px 16px;
    }

    .sp-totals__row--grand .sp-totals__value {
        font-size: 16px;
    }

    /* Discount */
    .sp-discount__input {
        padding: 10px 14px;
        font-size: 13px;
    }

    .sp-discount__btn {
        padding: 10px 16px;
    }
}

/* =============================================
   RESPONSIVE - Small phones (max 400px)
   ============================================= */
@media (max-width: 400px) {
    .sp-page {
        padding: 16px 8px 110px;
    }

    .sp-step__line {
        width: 20px;
    }

    .sp-step__circle {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .sp-step__circle svg {
        width: 13px;
        height: 13px;
    }

    .sp-method {
        padding: 10px 12px;
    }

    .sp-mobile-footer {
        flex-direction: column;
        gap: 10px;
        padding: 12px 14px;
    }

    .sp-mobile-footer__total {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        width: 100%;
        justify-content: space-between;
    }

    .sp-mobile-footer__btn {
        width: 100%;
    }
}