/*
 * profile-page.css
 * Aurora atmospheric profile — auth ページと同じ世界観で揃える。
 *  - 背景: ブランドの purple / cyan radial mesh
 *  - アバター: ヘッダーの identity-avatar と同じ brand gradient
 *  - カード: ガラスモルフィズム + ヘアライン gradient border
 *  - 数値: tabular-nums + grad で「電光掲示」風
 */

/* 背景は styles.css の body + body::before を共有する（viewer と完全一致）。
 * profile-page.css は ガラスカード・アバター・stats・履歴等のローカルスタイル専用。 */
:root {
    --pp-glass-bg: rgba(18, 18, 36, 0.55);
    --pp-glass-border: rgba(255, 255, 255, 0.08);
    --pp-text-primary: #fff;
    --pp-text-soft: rgba(255, 255, 255, 0.72);
    --pp-text-muted: rgba(255, 255, 255, 0.45);
    --pp-text-hint: rgba(255, 255, 255, 0.30);
    --pp-link: #b39bff;
    --pp-link-hover: #d2c2ff;
    --pp-success: #4ade80;
    --pp-danger: #f87171;
    --pp-gradient-brand: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

.profile-main {
    max-width: 880px;
    margin: 0 auto;
    padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1rem, 3vw, 1.5rem) 4rem;
}

.profile-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ── プロフィールヘッダー: glass card ───────────── */
.profile-header {
    position: relative;
    background: var(--pp-glass-bg);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--pp-glass-border);
    border-radius: 22px;
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1.75rem;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
}
.profile-header::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.45) 0%, rgba(255, 255, 255, 0) 35%, rgba(34, 211, 238, 0.32) 100%);
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
}

.avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--pp-gradient-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    box-shadow:
        0 12px 32px rgba(118, 75, 162, 0.40),
        0 0 0 1px rgba(255, 255, 255, 0.10);
}

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

.profile-info h1 {
    color: var(--pp-text-primary);
    margin: 0 0 0.4rem;
    font-size: clamp(1.4rem, 3vw, 1.7rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    word-break: break-word;
}

.profile-info .username,
.profile-info .email {
    font-size: 0.88rem;
    word-break: break-all;
    line-height: 1.5;
}
.profile-info .username { color: var(--pp-text-muted); margin-bottom: 0.2rem; font-variant-numeric: tabular-nums; }
.profile-info .email    { color: var(--pp-text-soft); }

.badges {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.85rem;
    flex-wrap: wrap;
}

.badge {
    padding: 0.28rem 0.8rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.04em;
}
.badge-christian {
    background: rgba(167, 139, 250, 0.18);
    color: #c4b5fd;
    border: 1px solid rgba(167, 139, 250, 0.35);
}
.badge-role {
    background: rgba(34, 211, 238, 0.15);
    color: #67e8f9;
    border: 1px solid rgba(34, 211, 238, 0.35);
}

/* ── セクション共通 ────────────────────────── */
.profile-section {
    position: relative;
    background: var(--pp-glass-bg);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--pp-glass-border);
    border-radius: 18px;
    padding: 1.5rem;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}
.profile-section::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.32) 0%, rgba(255, 255, 255, 0) 40%, rgba(34, 211, 238, 0.22) 100%);
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
}

.profile-section h2 {
    color: var(--pp-text-primary);
    font-size: 0.95rem;
    margin: 0 0 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--pp-text-soft);
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.1rem;
}
.section-head h2 { margin: 0; }

.btn-link {
    background: transparent;
    border: none;
    color: var(--pp-link);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
    text-decoration: none;
    transition: color 200ms ease, background-color 200ms ease;
}
.btn-link:hover {
    color: var(--pp-link-hover);
    background: rgba(167, 139, 250, 0.08);
}
.btn-link:focus-visible {
    outline: 2px solid rgba(34, 211, 238, 0.7);
    outline-offset: 2px;
}

/* ── 統計 ──────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.85rem;
}
.stats-grid--compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 380px;
}

.stat-item {
    text-align: center;
    padding: 1.1rem 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    transition: transform 200ms ease, border-color 240ms ease, background-color 240ms ease;
}
.stat-item:hover {
    transform: translateY(-2px);
    border-color: rgba(167, 139, 250, 0.35);
    background: rgba(167, 139, 250, 0.06);
}
.stat-item .number {
    font-size: 1.85rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    background: var(--pp-gradient-brand);
    -webkit-background-clip: text;
            background-clip: text;
    -webkit-text-fill-color: transparent;
            color: transparent;
}
.stat-item .label {
    color: var(--pp-text-muted);
    font-size: 0.74rem;
    margin-top: 0.4rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ── 履歴 / bookmark のリスト ───────────────── */
.entry-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.entry-item { margin: 0; }

.entry-link {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    width: 100%;
    text-align: left;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 0.7rem 0.9rem;
    cursor: pointer;
    transition: background 200ms ease, transform 160ms ease, border-color 200ms ease;
    color: inherit;
    font: inherit;
}
.entry-link:hover {
    background: rgba(167, 139, 250, 0.06);
    border-color: rgba(167, 139, 250, 0.32);
    transform: translateY(-1px);
}
.entry-link:focus-visible {
    outline: 2px solid rgba(34, 211, 238, 0.7);
    outline-offset: 2px;
}
.entry-link:disabled,
.entry-link[aria-busy="true"] {
    opacity: 0.5;
    cursor: wait;
    /* 色以外の指標として progress バー風のストライプを上塗り (WCAG 1.4.1) */
    background-image: repeating-linear-gradient(
        45deg,
        rgba(167, 139, 250, 0.10) 0,
        rgba(167, 139, 250, 0.10) 6px,
        transparent 6px,
        transparent 12px
    );
}

.entry-thumb {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.04);
}
.entry-thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.4);
}

.entry-body { min-width: 0; flex: 1; }

.entry-title {
    color: var(--pp-text-primary);
    font-size: 0.92rem;
    line-height: 1.4;
    font-weight: 600;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.entry-meta {
    margin-top: 0.3rem;
    font-size: 0.74rem;
    color: var(--pp-text-muted);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.entry-meta-item:not(:last-child)::after {
    content: '·';
    margin-left: 0.5rem;
    color: var(--pp-text-hint);
}

/* ── 空状態 ─────────────────────────── */
.empty-state {
    text-align: center;
    padding: 2rem 1rem 1.5rem;
    color: var(--pp-text-soft);
    position: relative;
}
.empty-state::before {
    content: '';
    display: block;
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background:
        radial-gradient(closest-side, rgba(167, 139, 250, 0.20) 0%, rgba(167, 139, 250, 0) 80%);
    background-image:
        radial-gradient(closest-side, rgba(167, 139, 250, 0.20) 0%, rgba(167, 139, 250, 0) 80%),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='28' height='28' fill='none' stroke='%23a78bfa' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><polyline points='12 6 12 12 16 14'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%, 28px 28px;
}
.empty-state .empty-message {
    margin: 0 0 0.4rem;
    font-size: 0.95rem;
    color: var(--pp-text-soft);
}
.empty-state .empty-hint {
    margin: 0;
    font-size: 0.8rem;
    color: var(--pp-text-muted);
    line-height: 1.6;
}

/* ── フォーム ─────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
    display: block;
    color: var(--pp-text-soft);
    font-size: 0.78rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.form-group input {
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 12px;
    color: var(--pp-text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: background-color 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}
.form-group input:focus-visible {
    outline: none;
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(167, 139, 250, 0.7);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.18);
}
.form-group input:disabled {
    opacity: 0.55;
    /* opacity に加えて border 形状も dashed に切替 (色覚特性配慮、WCAG 1.4.1) */
    border-style: dashed;
}

.checkbox-group { display: flex; align-items: center; gap: 0.75rem; }
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: #a78bfa; }
.checkbox-group label { margin-bottom: 0; cursor: pointer; text-transform: none; letter-spacing: 0; font-size: 0.92rem; }

/* ── ボタン ────────────────────────── */
.btn {
    padding: 0.85rem 1.6rem;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 220ms ease, background-color 200ms ease;
}
.btn-primary {
    position: relative;
    overflow: hidden;
    background: var(--pp-gradient-brand);
    background-size: 180% 180%;
    background-position: 0% 50%;
    color: #fff;
    box-shadow: 0 8px 24px rgba(118, 75, 162, 0.32);
}
.btn-primary:hover {
    transform: translateY(-1px);
    background-position: 100% 50%;
    box-shadow: 0 14px 32px rgba(118, 75, 162, 0.45);
}
.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--pp-text-primary);
    border: 1px solid rgba(255, 255, 255, 0.14);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
}
.btn-danger {
    background: rgba(248, 113, 113, 0.10);
    color: #fca5a5;
    border: 1px solid rgba(248, 113, 113, 0.40);
}
.btn-danger:hover {
    background: rgba(248, 113, 113, 0.20);
    border-color: rgba(248, 113, 113, 0.65);
}
.btn-group { display: flex; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }

/* ── メッセージ ─────────────────────── */
.message {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 0.88rem;
}
.message.success {
    background: rgba(74, 222, 128, 0.12);
    border: 1px solid rgba(74, 222, 128, 0.4);
    color: #86efac;
}
.message.error {
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.4);
    color: #fca5a5;
}

/* ── アクセス拒否 ──────────────────── */
.access-denied {
    text-align: center;
    padding: 4rem 1.5rem;
    max-width: 480px;
    margin: 2rem auto;
}
.access-denied h2 {
    color: var(--pp-text-primary);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 800;
}
.btn-login {
    display: inline-block;
    padding: 0.95rem 2rem;
    background: var(--pp-gradient-brand);
    color: #fff;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 700;
    transition: transform 160ms ease, box-shadow 220ms ease;
    box-shadow: 0 8px 24px rgba(118, 75, 162, 0.32);
}
.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(118, 75, 162, 0.45);
}

/* ── レスポンシブ ──────────────────── */
@media (max-width: 640px) {
    .profile-main { padding: 1.25rem 0.75rem 3rem; }
    .profile-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
        padding: 1.5rem;
    }
    .badges { justify-content: center; }
    .profile-info h1 { font-size: 1.3rem; }
    .avatar { width: 80px; height: 80px; font-size: 2rem; }
    .stats-grid--compact { max-width: none; }
    .entry-thumb { width: 48px; height: 48px; }
}
