/**
 * Ongyul 내 이용 내역 페이지 스타일
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #191F28;
    background: #F6F7F9;
    padding-bottom: 72px;
}

body.modal-open {
    overflow: hidden;
}

.header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
    border-bottom: 1px solid #E5E8EB;
    padding: 16px 20px;
}

.header__content {
    max-width: 960px;
    margin: 0 auto;
}

.header__title {
    font-size: 20px;
    font-weight: 800;
    color: #191F28;
    letter-spacing: 0;
}

.container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
}

.subscriptions-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.usage-section,
.history-section {
    background: #fff;
    border: 1px solid #E5E8EB;
    border-radius: 8px;
    overflow: hidden;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid #E5E8EB;
}

.section-kicker {
    font-size: 13px;
    font-weight: 700;
    color: #3182F6;
    margin-bottom: 4px;
}

.section-title {
    font-size: 22px;
    font-weight: 800;
    color: #191F28;
    letter-spacing: 0;
}

.section-count {
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 700;
    color: #4E5968;
    background: #F2F4F6;
    border-radius: 999px;
    padding: 6px 10px;
}

.usage-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 16px;
}

.usage-card {
    border: 1px solid #E5E8EB;
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.usage-card--urgent {
    border-color: #FFB8B8;
    background: #FFF7F7;
}

.usage-card--paused {
    border-color: #FFD4A3;
    background: #FFFBF5;
}

.usage-card__top,
.usage-card__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.usage-card__type {
    font-size: 13px;
    font-weight: 800;
    color: #3182F6;
}

.usage-card__title {
    font-size: 18px;
    font-weight: 800;
    color: #191F28;
    line-height: 1.35;
    word-break: keep-all;
}

.usage-card__meta,
.usage-card__period {
    font-size: 14px;
    color: #6B7684;
    word-break: keep-all;
}

.usage-card__notice {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #B54708;
    word-break: keep-all;
}

.usage-card__remain {
    flex-shrink: 0;
    font-size: 19px;
    font-weight: 900;
    color: #111827;
}

.payment-board {
    width: 100%;
}

.payment-board__head,
.payment-row {
    display: grid;
    grid-template-columns: 108px 72px minmax(180px, 1.5fr) minmax(180px, 1fr) 104px 84px;
    align-items: center;
    gap: 12px;
}

.payment-board__head {
    padding: 12px 20px;
    background: #F9FAFB;
    border-bottom: 1px solid #E5E8EB;
    color: #6B7684;
    font-size: 13px;
    font-weight: 800;
}

.payment-board__body {
    display: flex;
    flex-direction: column;
}

.payment-row {
    width: 100%;
    min-height: 68px;
    padding: 14px 20px;
    border: 0;
    border-bottom: 1px solid #F2F4F6;
    background: #fff;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.payment-row:last-child {
    border-bottom: 0;
}

.payment-row:hover,
.payment-row:focus-visible {
    background: #F8FBFF;
    outline: none;
}

.payment-row__date,
.payment-row__type,
.payment-row__period {
    font-size: 14px;
    color: #4E5968;
}

.payment-row__type {
    font-weight: 800;
    color: #3182F6;
}

.payment-row__product {
    min-width: 0;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 3px 10px;
    align-items: center;
}

.payment-row__thumb {
    grid-row: 1 / span 2;
    width: 42px;
    height: 42px;
    border-radius: 9px;
    border: 1px solid #E5E8EB;
    background: linear-gradient(135deg, #F7FAFC 0%, #E8EEF6 100%);
    overflow: hidden;
}

.payment-row__thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.payment-row__product strong {
    font-size: 15px;
    font-weight: 800;
    color: #191F28;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.payment-row__product em {
    font-style: normal;
    font-size: 13px;
    color: #8B95A1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.payment-row__amount {
    font-size: 15px;
    font-weight: 900;
    color: #191F28;
    text-align: right;
}

.payment-row__status {
    display: flex;
    justify-content: flex-end;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.status-badge--success {
    background: #E8F7EF;
    color: #148A4A;
}

.status-badge--danger {
    background: #FFEBEE;
    color: #D92D20;
}

.status-badge--warning {
    background: #FFF4E5;
    color: #B54708;
}

.status-badge--default {
    background: #F2F4F6;
    color: #6B7684;
}

.loading-state,
.empty-state {
    padding: 32px 20px;
    text-align: center;
    color: #6B7684;
    font-size: 15px;
}

.empty-state.compact,
.loading-state.compact {
    padding: 18px 16px;
}

.empty-state p {
    color: #4E5968;
    font-size: 16px;
    font-weight: 700;
}

.empty-state__desc {
    margin-top: 6px;
    color: #8B95A1 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
}

.auth-required-state {
    min-height: 360px;
    padding: 64px 20px 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #E5E8EB;
    border-radius: 8px;
}

.auth-required-state__icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #F2F4F6;
    color: #8B95A1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}

.auth-required-state__icon svg {
    width: 34px;
    height: 34px;
}

.auth-required-state__title {
    font-size: 20px;
    font-weight: 800;
    color: #191F28;
    margin-bottom: 8px;
}

.auth-required-state__desc {
    font-size: 15px;
    color: #6B7684;
    margin-bottom: 24px;
    word-break: keep-all;
}

.auth-required-state__button {
    min-width: 160px;
    height: 48px;
    padding: 0 22px;
    border: none;
    border-radius: 8px;
    background: #3182F6;
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
}

.history-modal[hidden] {
    display: none;
}

.history-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.history-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.54);
}

.history-modal__panel {
    position: relative;
    width: min(560px, 100%);
    max-height: min(720px, calc(100vh - 48px));
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.history-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid #E5E8EB;
}

.history-modal__eyebrow {
    font-size: 13px;
    font-weight: 800;
    color: #3182F6;
    margin-bottom: 4px;
}

.history-modal__title {
    font-size: 22px;
    font-weight: 900;
    color: #191F28;
    line-height: 1.35;
    word-break: keep-all;
}

.history-modal__close {
    width: 36px;
    height: 36px;
    border: 1px solid #E5E8EB;
    border-radius: 8px;
    background: #fff;
    color: #4E5968;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.history-modal__close svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.history-modal__body {
    padding: 20px 24px 24px;
    overflow: auto;
}

.history-modal__footer {
    padding: 16px 24px 20px;
    border-top: 1px solid #E5E8EB;
    background: #fff;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    border: 1px solid #E5E8EB;
    border-radius: 8px;
    overflow: hidden;
}

.detail-field {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 12px;
    padding: 13px 14px;
    border-bottom: 1px solid #F2F4F6;
}

.detail-field:last-child {
    border-bottom: 0;
}

.detail-field dt {
    color: #8B95A1;
    font-size: 14px;
    font-weight: 800;
}

.detail-field dd {
    color: #191F28;
    font-size: 14px;
    font-weight: 700;
    word-break: keep-all;
}

.detail-payments {
    margin-top: 18px;
}

.detail-payments__title {
    font-size: 16px;
    font-weight: 900;
    color: #191F28;
    margin-bottom: 10px;
}

.detail-payment-list {
    border: 1px solid #E5E8EB;
    border-radius: 8px;
    overflow: hidden;
}

.detail-payment-item {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 110px 78px;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid #F2F4F6;
    font-size: 14px;
}

.detail-payment-item:last-child {
    border-bottom: 0;
}

.detail-payment-item span {
    color: #6B7684;
}

.detail-payment-item strong {
    color: #191F28;
    text-align: right;
}

.detail-payment-item em {
    font-style: normal;
    color: #3182F6;
    text-align: right;
    font-weight: 800;
}

.modal-action {
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
}

.modal-action--danger {
    background: #FFF0F0;
    color: #E03131;
}

body.lb-platform-web .header {
    display: none !important;
}

body.lb-platform-web .container {
    max-width: 1040px;
    padding: 32px 40px 70px;
}

@media (max-width: 1024px) {
    body.lb-platform-web .container {
        max-width: 100%;
        padding: 24px 24px 70px;
    }

    .payment-board__head,
    .payment-row {
        grid-template-columns: 96px 64px minmax(160px, 1.4fr) minmax(150px, 1fr) 96px 78px;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    body {
        background: #fff;
    }

    body.lb-platform-web .container,
    .container {
        padding: 14px 14px 86px;
    }

    .subscriptions-page {
        gap: 12px;
    }

    .usage-section,
    .history-section {
        border-left: 0;
        border-right: 0;
        border-radius: 0;
        margin-left: -14px;
        margin-right: -14px;
    }

    .section-heading {
        padding: 18px 16px 14px;
        align-items: center;
    }

    .section-title {
        font-size: 20px;
    }

    .usage-summary {
        grid-template-columns: 1fr;
        padding: 12px 14px 16px;
    }

    .usage-card {
        padding: 14px;
    }

    .usage-card__title {
        font-size: 17px;
    }

    .usage-card__remain {
        font-size: 18px;
    }

    .payment-board__head {
        display: none;
    }

    .payment-board__body {
        gap: 0;
    }

    .payment-row {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "product status"
            "meta amount"
            "period period";
        gap: 7px 12px;
        min-height: 0;
        padding: 15px 16px;
    }

    .payment-row__date {
        grid-area: meta;
    }

    .payment-row__type {
        grid-area: meta;
        margin-left: 84px;
    }

    .payment-row__product {
        grid-area: product;
    }

    .payment-row__period {
        grid-area: period;
        font-size: 13px;
    }

    .payment-row__amount {
        grid-area: amount;
        align-self: center;
    }

    .payment-row__status {
        grid-area: status;
        align-self: start;
    }

    .history-modal {
        align-items: flex-end;
        padding: 0;
    }

    .history-modal__panel {
        width: 100%;
        max-height: calc(100vh - 44px);
        border-radius: 8px 8px 0 0;
    }

    .history-modal__header {
        padding: 20px 18px 16px;
    }

    .history-modal__body {
        padding: 18px;
    }

    .history-modal__footer {
        padding: 14px 18px 18px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 15px 16px;
    }

    .header__title {
        font-size: 18px;
    }

    .section-heading {
        gap: 10px;
    }

    .section-kicker {
        font-size: 12px;
    }

    .section-title {
        font-size: 19px;
    }

    .section-count {
        font-size: 13px;
        padding: 5px 9px;
    }

    .payment-row__product strong {
        font-size: 14px;
    }

    .payment-row__date,
    .payment-row__type,
    .payment-row__amount {
        font-size: 13px;
    }

    .payment-row__type {
        margin-left: 78px;
    }

    .history-modal__title {
        font-size: 20px;
    }

    .detail-field {
        grid-template-columns: 96px minmax(0, 1fr);
        padding: 12px;
    }

    .detail-payment-item {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .detail-payment-item strong,
    .detail-payment-item em {
        text-align: left;
    }
}
