/* css/settings.css - アカウント＆設定専用のスタイル */

/* モーダル全体のオーバーレイ */
#global-settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: block; /* 🌟 変更：Flexを解除し、自然な縦スクロールを有効にする */
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#global-settings-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* メインのすりガラスウィンドウ（枠ごとスクロール仕様） */
.settings-window {
    width: 92%; /* 98%から少し狭く */
    max-width: 1100px; /* 1400pxから縮小し、全体のバランスを改善 */
    margin: 12vh auto 0 auto; /* 🌟 変更：画面上部から12vh下げて配置 */
    min-height: 88vh; /* 最低でも画面下部まで届くようにする */
    height: auto; /* 🌟 魔法のコード：中身が増えたら枠自体が伸びる */
    background: rgba(10, 10, 10, 0.65); /* モノトーンすりガラスベース */
    backdrop-filter: blur(40px) saturate(150%);
    -webkit-backdrop-filter: blur(40px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.1); 
    border-bottom: none; /* 下にくっつくので下の線は消す */
    border-radius: 20px 20px 0 0; /* 上の角だけ丸くする */
    box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 🌟 変更：枠自体が伸びるので、中のスクロールは不要 */
    padding-bottom: 40px; /* 内容物が一番下にくっつかないように */
    position: relative;
    transform: translateY(100vh); /* 最初は画面下に隠す */
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

#global-settings-overlay.show .settings-window {
    transform: translateY(0); /* 画面下から上にスッと現れる */
}

/* 上部の光るヘッダーエリア（モノトーンに変更） */
.settings-header-bg {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 200px;
    background: radial-gradient(ellipse at top, rgba(255, 255, 255, 0.15) 0%, transparent 70%); /* 白系の光 */
    z-index: 0;
    pointer-events: none;
}

.settings-header {
    position: relative;
    z-index: 1;
    padding: 30px 40px 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-header i.settings-gear-icon {
    font-size: 34px;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin-right: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.settings-header-text {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 12px;
}

.settings-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 1px;
}

.settings-header p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
}

.settings-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    border-radius: 50%;
    padding: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.settings-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* スクロールする中身エリア */
.settings-content {
    padding: 0 40px 40px; /* 🌟 ヘッダーとのつながりをよくするため上の余白を詰める */
    position: relative;
    z-index: 1;
}

/* スクロールバーのカスタマイズ（オーバーレイ全体に適用） */
#global-settings-overlay::-webkit-scrollbar { width: 8px; }
#global-settings-overlay::-webkit-scrollbar-track { background: transparent; }
#global-settings-overlay::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
#global-settings-overlay::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }

/* 各セクションのグループ枠 */
.settings-group {
    background: rgba(0, 0, 0, 0.5); /* 枠内をさらに暗く落とし込む */
    border: 1px solid rgba(255, 255, 255, 0.08); /* 丸みを帯びた枠線 */
    border-radius: 16px;
    margin-bottom: 30px;
    overflow: hidden;
}

.settings-group-title {
    padding: 16px 20px;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.settings-group-title .material-symbols-outlined {
    color: rgba(255, 255, 255, 0.5);
}

/* グループ内の各項目 */
.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item-text {
    flex: 1;
    padding-right: 20px;
}

.settings-item-text h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 6px 0;
}

.settings-item-text p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
    line-height: 1.4;
}

/* 操作用コントロール類 */
.settings-item-control {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* カスタムボタン類 */
.settings-btn-primary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}
.settings-btn-primary:hover {
    background: white;
    color: black;
}

/* セレクトボックス（言語・秒数など） */
.settings-select {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    appearance: none;
    min-width: 120px;
}
.settings-select:hover {
    border-color: rgba(255, 255, 255, 0.3);
}
.settings-select option {
    background: #111;
    color: white;
}

/* 美しいトグルスイッチ */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: .3s;
    border-radius: 34px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
input:checked + .toggle-slider {
    background-color: var(--primary-accent, #e50914);
}
input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* セグメントボタン（サムネ/ポスター切替など） */
.segment-group {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}
.segment-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.segment-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 600;
}
.segment-btn:hover:not(.active) {
    color: white;
}

/* アバター画像設定のプレビュー */
.settings-avatar-preview {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #333;
    background-size: cover;
    background-position: center;
}

/* --- サブモーダル（パスワード変更など重なるポップアップ用） --- */
.sub-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.sub-modal-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.sub-modal-window {
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    transform: translateY(0);
    animation: popupFadeIn 0.3s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- 上から降りてくるトースト通知 --- */
.settings-toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(229, 9, 20, 0.95);
    color: white;
    padding: 14px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    z-index: 100000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.settings-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
