/*
 * ============================================================
 * HGPS Common CSS 
 * ============================================================
 * Shared design system for:
 *   - index.html
 *   - energy-checkin.html
 *   - wallet.html
 *   - community.html
 *
 * Page-specific CSS is loaded after this file.
 * ============================================================
 */

:root {
    --h-primary: #7407ff;
    --h-primary-light: #9f78ff;
    --h-primary-dark: #5824d6;
    --h-primary-soft: #f1eaff;

    --h-bg: #f7f5fd;
    --h-surface: #ffffff;

    --h-title: #2e2844;
    --h-text: #55566a;
    --h-muted: #9091a5;

    --h-border: #ddd2ff;

    --h-danger: #e34d6f;
    --h-success: #2eae68;

    --h-radius-sm: 14px;
    --h-radius-md: 18px;
    --h-radius-lg: 24px;

    --h-page-width: 1500px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background: var(--h-bg);
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background:
        radial-gradient(
            circle at 50% 18%,
            rgba(116, 7, 255, .08),
            transparent 30%
        ),
        linear-gradient(
            145deg,
            #ffffff 0%,
            var(--h-bg) 100%
        );

    color: var(--h-text);

    font-family:
        Pretendard,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        "Noto Sans KR",
        sans-serif;

    font-size: 16px;
    line-height: 1.7;

    word-break: keep-all;

    -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: .6;
}

/* ============================================================
   PAGE SHELL
   ============================================================ */

.h-page {
    width: 100%;
    max-width: var(--h-page-width);
    margin-inline: auto;
    padding: 10px 18px 70px;
}

.h-text-center {
    text-align: center;
}

.h-hidden {
    display: none !important;
}

.h-primary {
    color: var(--h-primary);
    font-weight: 700;
}

.h-mt-sm {
    margin-top: 10px;
}

.h-mt-md {
    margin-top: 18px;
}

.h-mt-lg {
    margin-top: 26px;
}

/* ============================================================
   BUTTON
   ============================================================ */

.h-btn {
    min-height: 52px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 7px;

    padding: 0 20px;

    border: 0;
    border-radius: var(--h-radius-sm);

    font-size: 16px;
    font-weight: 700;

    text-decoration: none;

    transition:
        transform .15s ease,
        box-shadow .2s ease,
        background .2s ease,
        border-color .2s ease;
}

.h-btn:active {
    transform: scale(.985);
}

.h-btn-full {
    width: 100%;
}

.h-btn-primary {
    background: linear-gradient(
        135deg,
        var(--h-primary),
        var(--h-primary-light)
    );

    color: #fff;

    box-shadow:
        0 7px 20px rgba(116, 7, 255, .18);
}

.h-btn-primary:hover:not(:disabled) {
    background: linear-gradient(
        135deg,
        var(--h-primary-dark),
        var(--h-primary)
    );
}

.h-btn-outline {
    background: #fff;
    color: var(--h-title);
    border: 1px solid var(--h-border);
}

.h-btn-secondary {
    background: var(--h-primary-soft);
    color: var(--h-primary);
}

/* ============================================================
   CARD
   ============================================================ */

.h-card {
    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius-lg);
    box-shadow: 0 18px 60px rgba(92, 63, 170, .08);
}

.h-card + .h-card {
    margin-top: 18px;
}

.h-card-body {
    padding: 26px;
}

.h-card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 16px 42px rgba(40, 20, 70, .08),
        0 4px 12px rgba(40, 20, 70, .04);
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

.h-title {
    margin: 0;

    color: var(--h-title);

    font-size: 25px;
    font-weight: 800;

    line-height: 1.35;
    letter-spacing: -.025em;
}

.h-description {
    margin: 8px 0 0;

    color: var(--h-muted);

    font-size: 16px;
    line-height: 1.7;
}

.h-eyebrow {
    margin-bottom: 5px;

    color: var(--h-primary);

    font-size: 13px;
    font-weight: 700;

    letter-spacing: .08em;
    text-transform: uppercase;
}

.h-section-header {
    margin-bottom: 22px;
}

.h-header-divider {
    color: #cfc7dd;
}

.h-header-link {
    color: inherit;
    text-decoration: none;
}

.h-header-link:hover {
    color: var(--h-primary);
}

/* ============================================================
   FORM
   ============================================================ */

.h-field {
    margin-bottom: 20px;
}

.h-field:last-child {
    margin-bottom: 0;
}

.h-label {
    display: block;

    margin-bottom: 8px;

    color: var(--h-title);

    font-size: 16px;
    font-weight: 700;
}

.h-label-help {
    margin-left: 5px;
    color: var(--h-muted);
    font-size: 14px;
    font-weight: 500;
}

.h-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;
    margin-bottom: 10px;
}

.h-label-row .h-label {
    flex: 1;
    margin: 0;
}

.h-input,
.h-textarea,
.h-select {
    width: 100%;

    border: 1px solid var(--h-border);
    border-radius: var(--h-radius-sm);

    background: #fff;
    color: var(--h-text);

    font-size: 16px;

    outline: none;

    transition:
        border-color .2s ease,
        box-shadow .2s ease;
}

.h-input,
.h-select {
    min-height: 52px;
    padding: 0 15px;
}

.h-textarea {
    min-height: 110px;
    padding: 14px 15px;
    line-height: 1.65;
    resize: vertical;
}

.h-input::placeholder,
.h-textarea::placeholder {
    color: #aaa4b1;
}

.h-input:focus,
.h-textarea:focus,
.h-select:focus {
    border-color: var(--h-primary);

    box-shadow:
        0 0 0 3px rgba(116, 7, 255, .08);
}

/* ============================================================
   PROFILE
   ============================================================ */

.h-profile-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.h-profile-avatar {
    flex: 0 0 48px;

    width: 48px;
    height: 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;
    overflow: hidden;

    border: 0;
    border-radius: 50%;

    background:
        linear-gradient(
            145deg,
            var(--h-primary),
            #914cff
        );

    color: #fff;

    font-size: 19px;
    font-weight: 800;
    line-height: 1;
}

.h-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.h-profile-avatar-link {
    cursor: pointer;

    transition:
        transform .18s ease,
        box-shadow .18s ease;
}

.h-profile-avatar-link:hover {
    transform: translateY(-1px);

    box-shadow:
        0 6px 16px rgba(116, 7, 255, .20);
}

.h-profile-main {
    flex: 1;
    min-width: 0;
}

.h-profile-name {
    color: var(--h-title);

    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
}

.h-profile-name-line {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 6px;
}

.h-profile-meta {
    color: var(--h-muted);

    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

.h-profile-assets-inline {
    display: flex;
    align-items: center;

    gap: 5px;
    margin-top: 3px;

    color: var(--h-muted);

    font-size: 13px;
    font-weight: 600;
}

.h-profile-asset-divider {
    color: #b7b1bf;
    font-weight: 400;
}

.h-profile-divider {
    width: 100%;
    height: 1px;

    margin: 16px 0 13px;

    background: var(--h-border);
}

.h-profile-message {
    margin-top: 9px;

    color: var(--h-muted);

    font-size: 13px;
    line-height: 1.55;
}

/* ============================================================
   LOADING
   ============================================================ */

.h-loading {
    position: fixed;
    inset: 0;

    z-index: 9999;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 24px;

    background: rgba(20, 15, 30, .42);

    backdrop-filter: blur(5px);
}

.h-loading.is-visible {
    display: flex;
}

.h-loading-box {
    width: 100%;
    max-width: 330px;

    padding: 30px 24px;

    border: 1px solid var(--h-border);
    border-radius: 18px;

    background: #fff;

    text-align: center;

    box-shadow:
        0 16px 45px rgba(0, 0, 0, .15);
}

.h-spinner {
    width: 38px;
    height: 38px;

    margin: 0 auto 16px;

    border: 4px solid #eee8f5;
    border-top-color: var(--h-primary);

    border-radius: 50%;

    animation: h-spin .8s linear infinite;
}

.h-loading-title {
    color: var(--h-title);

    font-size: 18px;
    font-weight: 800;
}

.h-loading-text {
    margin-top: 5px;

    color: var(--h-muted);

    font-size: 14px;
    line-height: 1.6;
}

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

/* ============================================================
   MODAL
   ============================================================ */

.h-modal {
    position: fixed;
    inset: 0;

    z-index: 10000;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(20, 15, 30, .42);
    backdrop-filter: blur(5px);
}

.h-modal.active {
    display: flex;
}

.h-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 20px;

    border-bottom: 1px solid var(--h-border);
}

.h-modal-body {
    padding: 20px;
}

.h-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 20px;

    border-top: 1px solid var(--h-border);
}

/* ============================================================
   TOAST
   ============================================================ */

.h-toast {
    position: fixed;

    left: 50%;
    bottom: 24px;

    z-index: 10000;

    width: calc(100% - 36px);
    max-width: 420px;

    padding: 14px 16px;

    border-radius: 12px;

    background: #211b29;
    color: #fff;

    font-size: 14px;
    font-weight: 600;
    line-height: 1.55;

    transform:
        translateX(-50%)
        translateY(20px);

    opacity: 0;
    pointer-events: none;

    transition: .25s ease;
}

.h-toast.is-visible {
    transform:
        translateX(-50%)
        translateY(0);

    opacity: 1;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {

    .h-page {
        max-width: 100%;
        padding: 10px 12px 50px;
    }

    .h-card-body {
        padding: 22px 18px;
    }

    .h-title {
        font-size: 22px;
    }
}
/* ============================================================
   AUTH ENTRY / INDEX PRIMITIVES
   ============================================================ */
.h-auth-page {
            min-height: 100vh;

            display: flex;
            align-items: center;
            justify-content: center;

            padding: 24px 16px;
        }

        .h-auth-shell {
            width: 100%;
            max-width: 520px;
        }

        .h-auth-brand {
            margin-bottom: 28px;
            text-align: center;
        }

        .h-auth-brand-mark {
            width: 62px;
            height: 62px;

            margin: 0 auto 15px;

            display: flex;
            align-items: center;
            justify-content: center;

            border-radius: 20px;

            background:
                linear-gradient(
                    135deg,
                    var(--h-primary),
                    var(--h-primary-light)
                );

            color: #fff;

            font-size: 20px;
            font-weight: 800;
            letter-spacing: -.04em;

            box-shadow:
                0 14px 35px rgba(116, 7, 255, .22);
        }

        .h-auth-brand-title {
            margin: 0;

            color: var(--h-title);

            font-size: 28px;
            font-weight: 800;

            line-height: 1.3;
            letter-spacing: -.04em;
        }

        .h-auth-brand-subtitle {
            margin: 5px 0 0;

            color: var(--h-muted);

            font-size: 13px;
            font-weight: 600;
        }

        .h-auth-card {
            overflow: hidden;

            background: rgba(255, 255, 255, .96);

            border:
                1px solid
                var(--h-border);

            border-radius:
                var(--h-radius-lg);

            box-shadow:
                0 18px 60px rgba(92, 63, 170, .10);
        }

        .h-auth-card-body {
            padding: 34px 32px 30px;
        }

        .h-auth-step {
            display: none;
        }

        .h-auth-step.active {
            display: block;
        }

        .h-auth-question {
            margin: 0;

            color: var(--h-title);

            font-size: 23px;
            font-weight: 800;

            line-height: 1.4;
            letter-spacing: -.035em;
        }

        .h-auth-description {
            margin: 9px 0 24px;

            color: var(--h-muted);

            font-size: 14px;
            line-height: 1.6;
        }

        .h-auth-field {
            display: flex;
            gap: 9px;
        }

        .h-auth-code-row {
            display: flex;
            gap: 10px;
        }

        .h-auth-code-input {
            text-align: center;

            letter-spacing: .28em;

            font-size: 20px;
            font-weight: 800;
        }

        .h-auth-verify-meta {
            display: flex;
            align-items: center;
            justify-content: space-between;

            gap: 10px;

            margin-top: 10px;
            min-height: 22px;

            color: var(--h-muted);

            font-size: 12px;
        }

        .h-auth-timer {
            color: var(--h-primary);
            font-weight: 700;
        }

        .h-auth-resend,
        .h-auth-back {
            border: 0;
            background: transparent;

            padding: 0;

            color: var(--h-muted);

            font-size: 12px;
            font-weight: 700;
        }

        .h-auth-resend:hover:not(:disabled),
        .h-auth-back:hover {
            color: var(--h-primary);
        }

        .h-auth-back {
            margin-top: 14px;
            font-size: 13px;
        }

        .h-auth-message {
            display: none;

            margin-top: 14px;
            padding: 11px 13px;

            border-radius: 12px;

            background: #f6f3fb;
            color: var(--h-muted);

            font-size: 13px;
            line-height: 1.55;
        }

        .h-auth-message.show {
            display: block;
        }

        .h-auth-message.error {
            background: #fff2f5;
            color: var(--h-danger);
        }

        .h-auth-message.success {
            background: #effaf4;
            color: var(--h-success);
        }

        .h-auth-footer {
            margin-top: 18px;

            text-align: center;

            color: #aaa4b1;

            font-size: 11px;
        }

        @media (max-width: 520px) {

            .h-auth-page {
                padding: 18px 12px;
            }

            .h-auth-brand {
                margin-bottom: 22px;
            }

            .h-auth-brand-mark {
                width: 56px;
                height: 56px;

                border-radius: 18px;

                font-size: 18px;
            }

            .h-auth-brand-title {
                font-size: 25px;
            }

            .h-auth-card-body {
                padding: 28px 20px 24px;
            }

            .h-auth-question {
                font-size: 21px;
            }

            .h-auth-field {
                flex-direction: column;
            }

            .h-auth-field .h-btn {
                width: 100%;
            }
        }
