/**
 * Unified Auth UI - アカウントメニュー用スタイル
 * Version: 1.1.0
 */

/* ==========================================================================
   アカウントアイコン基本スタイル
   ========================================================================== */

.ua-simple-account {
    position: relative;
    display: inline-block;
}

/* ログインリンク（未ログイン時） */
.ua-login-link {
    display: inline-block;
    color: inherit;
    text-decoration: none;
    font-size: 14px !important;  /* メニューの標準サイズに固定 */
    font-weight: 400 !important;  /* 標準の太さ400に固定 */
    font-family: inherit;  /* フォントファミリーを継承 */
    padding: 0;
    line-height: inherit;  /* 行高さを継承 */
    letter-spacing: inherit;  /* 文字間隔を継承 */
    transition: opacity 0.3s ease;
}

.ua-login-link:hover {
    opacity: 0.7;
    color: inherit;
    text-decoration: none;
}

/* SWELLメニュー内での調整 */
.c-gnav .ua-login-link {
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: inherit;
}

/* メニューアイテム内での調整 */
.menu-item .ua-login-link,
.c-gnav__item .ua-login-link {
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: inherit;
    letter-spacing: inherit;
}

/* ヘッダーが明るい場合の対応（必要に応じて） */
.l-header--bg-light .ua-login-link {
    color: #333;
}

.l-header--bg-light .ua-login-link:hover {
    opacity: 0.7;
    color: #333;
}

/* アカウントボタン */
.ua-account-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 14px;
    color: #333;
}

.ua-account-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.2);
}

/* アカウントアバター */
.ua-account-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: #f5f5f5;
}

.ua-account-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ua-account-avatar svg {
    width: 20px;
    height: 20px;
    color: #666;
}

/* アカウント名 */
.ua-account-name {
    font-weight: 500;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ドロップダウン矢印 */
.ua-account-arrow {
    transition: transform 0.3s ease;
    color: #666;
    margin-left: auto;
}

.ua-account-toggle[aria-expanded="true"] .ua-account-arrow {
    transform: rotate(180deg);
}

/* ==========================================================================
   ドロップダウンメニュー
   ========================================================================== */

.ua-account-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: #1a1a1a;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 9999;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ua-account-dropdown[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ドロップダウンヘッダー */
.ua-dropdown-header {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
}

.ua-user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ua-user-name {
    font-weight: 600;
    font-size: 14px;
    color: #fff;
}

.ua-user-email {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

/* ドロップダウンメニュー */
.ua-dropdown-menu {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

.ua-dropdown-menu li {
    margin: 0;
    padding: 0;
}

/* メニューアイテム */
.ua-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 16px;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s ease;
}

.ua-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    text-decoration: none;
}

/* メニューアイコン */
.ua-menu-icon {
    width: 20px;
    height: 20px;
    color: rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
}

/* メニュー区切り線 */
.ua-menu-divider {
    height: 0;
    margin: 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ログアウトメニュー */
.ua-menu-item.ua-logout {
    color: #ff6b6b;
}

.ua-menu-item.ua-logout:hover {
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
}

.ua-menu-item.ua-logout .ua-menu-icon {
    color: #ff6b6b;
}

/* ==========================================================================
   メニュー内での調整（SWELLテーマ対応）
   ========================================================================== */

/* メニュー内でのラッパー */
.menu-item .ua-simple-account {
    display: flex;
    align-items: center;
    height: 100%;
}

/* SWELLグローバルナビゲーション対応 */
.c-gnav .unified-account-wrapper {
    display: flex;
    align-items: center;
    margin-left: auto;
    list-style: none;
    padding: 0;
}

.c-gnav .ua-account-toggle {
    height: auto;
    border-color: rgba(255, 255, 255, 0.2);
    color: inherit;
}

.c-gnav .ua-account-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ヘッダーが暗い場合の対応 */
.l-header--bg-dark .ua-account-toggle {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.l-header--bg-dark .ua-account-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.l-header--bg-dark .ua-account-name {
    color: #fff;
}

.l-header--bg-dark .ua-account-arrow {
    color: rgba(255, 255, 255, 0.8);
}

/* ==========================================================================
   PC/スマホ表示切り替え
   ========================================================================== */

/* デフォルト: PC用を表示、スマホ用を非表示 */
.ua-desktop-only {
    display: inline-block;
}

.ua-mobile-only {
    display: none !important;
}

/* ==========================================================================
   スマホ用メニューリンク
   ========================================================================== */

.ua-mobile-menu-links {
    flex-direction: column;
    width: 100%;
}

.ua-mobile-link {
    display: block;
    padding: 15px 24px;
    color: inherit;
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    transition: background 0.2s ease;
}

.ua-mobile-link:hover {
    background: rgba(0, 0, 0, 0.03);
    color: inherit;
    text-decoration: none;
}

.ua-mobile-link.ua-logout {
    color: #dc3545;
}

.ua-mobile-link.ua-logout:hover {
    background: rgba(220, 53, 69, 0.08);
    color: #dc3545;
}

/* ==========================================================================
   モバイル対応
   ========================================================================== */

@media (max-width: 959px) {
    /* PC/スマホ表示切り替え */
    .ua-desktop-only {
        display: none !important;
    }

    .ua-mobile-only {
        display: flex !important;
    }

    /* SWELLドロワーメニュー対応 */
    .c-drawerMenu .unified-account-wrapper {
        width: 100%;
        margin: 0;
    }

    .c-drawerMenu .ua-simple-account {
        width: 100%;
    }

    .c-drawerMenu .ua-account-toggle {
        width: 100%;
        padding: 12px 20px;
        border-radius: 0;
        border: none;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        justify-content: flex-start;
    }

    /* モバイルではドロップダウンを全幅に */
    .c-drawerMenu .ua-account-dropdown {
        position: static;
        width: 100%;
        box-shadow: none;
        border-radius: 0;
        margin-top: 0;
    }

    .c-drawerMenu .ua-account-dropdown[aria-hidden="false"] {
        transform: none;
    }

    .c-drawerMenu .ua-dropdown-header {
        background: rgba(0, 0, 0, 0.03);
    }

    .c-drawerMenu .ua-menu-item {
        padding: 12px 20px 12px 40px;
    }

    /* スマホ用メニューリンクのドロワーメニュー対応 */
    .c-drawerMenu .ua-mobile-menu-links {
        width: 100%;
    }

    .c-drawerMenu .ua-mobile-link {
        padding: 15px 24px;
    }
}

@media (max-width: 767px) {
    /* 小画面での調整 */
    .ua-account-name {
        display: none;
    }

    .ua-account-toggle {
        padding: 6px 10px;
    }

    .ua-account-dropdown {
        min-width: 200px;
    }
}

/* ==========================================================================
   アクセシビリティ
   ========================================================================== */

/* キーボードフォーカス時のスタイル */
.ua-account-toggle:focus-visible {
    outline: 2px solid #4A90E2;
    outline-offset: 2px;
}

.ua-menu-item:focus-visible {
    outline: 2px solid #4A90E2;
    outline-offset: -2px;
}

/* スクリーンリーダー用 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==========================================================================
   アニメーション
   ========================================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* アニメーション適用 */
.ua-account-dropdown[aria-hidden="false"] {
    animation: fadeIn 0.3s ease forwards;
}

.ua-account-dropdown[aria-hidden="true"] {
    animation: fadeOut 0.3s ease forwards;
}

/* ==========================================================================
   カスタマイズ用CSS変数
   ========================================================================== */

.ua-simple-account {
    --ua-primary-color: #4A90E2;
    --ua-danger-color: #dc3545;
    --ua-border-color: rgba(0, 0, 0, 0.1);
    --ua-hover-bg: rgba(0, 0, 0, 0.04);
    --ua-text-color: #333;
    --ua-text-muted: #666;
}

/* ダークモード対応（オプション） */
@media (prefers-color-scheme: dark) {
    .ua-simple-account {
        --ua-border-color: rgba(255, 255, 255, 0.1);
        --ua-hover-bg: rgba(255, 255, 255, 0.08);
        --ua-text-color: #fff;
        --ua-text-muted: rgba(255, 255, 255, 0.7);
    }

    .ua-account-dropdown {
        background: #1a1a1a;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    }

    .ua-dropdown-header {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }

    .ua-menu-divider {
        border-top-color: rgba(255, 255, 255, 0.1);
    }
}

/* ==========================================================================
   サイト情報メニュー（ガイドメニュー）
   ========================================================================== */

.ua-site-info {
    position: relative;
    display: inline-block;
}

/* サイト情報トグルボタン */
.ua-site-info-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: none;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 14px;
    color: inherit;
}

.ua-site-info-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ua-site-info-icon {
    width: 18px;
    height: 18px;
    color: inherit;
    opacity: 0.8;
}

.ua-site-info-label {
    font-weight: 400;
    color: inherit;
}

.ua-site-info-arrow {
    transition: transform 0.3s ease;
    color: inherit;
    opacity: 0.6;
}

.ua-site-info-toggle[aria-expanded="true"] .ua-site-info-arrow {
    transform: rotate(180deg);
}

/* サイト情報ドロップダウン */
.ua-site-info-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: #1a1a1a;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 9999;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ua-site-info-dropdown[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* サイト情報ドロップダウンのメニュースタイル */
.ua-site-info-dropdown .ua-dropdown-menu {
    padding: 8px 0;
}

/* アニメーション */
.ua-site-info-dropdown[aria-hidden="false"] {
    animation: fadeIn 0.3s ease forwards;
}

.ua-site-info-dropdown[aria-hidden="true"] {
    animation: fadeOut 0.3s ease forwards;
}

/* SWELLヘッダー対応 */
.c-gnav .ua-site-info-toggle {
    height: auto;
    color: inherit;
}

.l-header--bg-dark .ua-site-info-toggle {
    color: #fff;
}

.l-header--bg-dark .ua-site-info-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* メニュー内での調整 */
.menu-item .ua-site-info {
    display: flex;
    align-items: center;
    height: 100%;
}

/* モバイル対応 */
@media (max-width: 959px) {
    .ua-site-info.ua-desktop-only {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .ua-site-info-dropdown {
        min-width: 180px;
    }
}