/* yossy-portal-v2 共通スタイル */

:root {
    /* カラー */
    --color-bg: #f8f8f6;
    --color-surface: #ffffff;
    --color-border: #e8e8e4;
    --color-text: #121212;
    --color-text-muted: #6b6b6b;
    --color-primary: #D97757;
    --color-primary-hover: #C4674A;
    --color-secondary: #6b6b6b;
    --color-success: #16a34a;
    --color-error: #dc2626;
    --color-warning: #d97706;
    --color-danger: #dc2626;
    --color-bg-secondary: #f3f4f6;
    --color-bg-card: #ffffff;
    --color-text-secondary: #475569;

    /* スペーシング */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* タイポグラフィ */
    --font-family: system-ui, "Segoe UI", "Hiragino Sans", "Noto Sans CJK JP", sans-serif;
    --font-family-serif: Georgia, "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", serif;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --line-height: 1.5;

    /* 形状 */
    --border-radius: 0.5rem;
    --border-radius-lg: 0.75rem;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
    --shadow-md: 0 2px 8px 0 rgb(0 0 0 / 0.08);

    /* ダークモード */
    color-scheme: light dark;
}

/* OSがダーク設定 & 手動でlightを指定していない場合 */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-bg: #1f1f1e;
        --color-surface: #2d2d2c;
        --color-border: #3d3d3c;
        --color-text: #f8f8f6;
        --color-text-muted: #a0a09c;
        --color-primary: #E08B6D;
        --color-primary-hover: #D97757;
        --color-danger: #ef4444;
        --color-bg-secondary: #2a2a29;
        --color-bg-card: #2a2a29;
        --color-text-secondary: #94a3b8;
    }
}

/* 手動でダークモードを指定 */
:root[data-theme="dark"] {
    --color-bg: #1f1f1e;
    --color-surface: #2d2d2c;
    --color-border: #3d3d3c;
    --color-text: #f8f8f6;
    --color-text-muted: #a0a09c;
    --color-primary: #E08B6D;
    --color-primary-hover: #D97757;
    --color-danger: #ef4444;
    --color-bg-secondary: #2a2a29;
    --color-bg-card: #2a2a29;
    --color-text-secondary: #94a3b8;
}

/* ベースリセット・スタイル */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-family: var(--font-family-serif);  /* デフォルトはセリフ体 */
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

/* UIパーツはサンセリフ */
button,
input,
select,
textarea,
label,
nav,
[type="submit"],
[type="button"],
[type="reset"],
.btn,
.nav,
.navbar {
    font-family: var(--font-family);
}

h1 {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.5rem;
    margin-bottom: var(--spacing-lg);
}

/* モバイルナビゲーション */
.navbar-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--color-text);
    font-family: var(--font-family);
}

.navbar-hamburger svg {
    display: block;
    width: 24px;
    height: 24px;
}

.navbar-mobile-menu {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: var(--spacing-sm) var(--spacing-md);
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.navbar-mobile-menu.open {
    display: block;
}


@media (max-width: 767px) {
    .navbar-hamburger {
        display: flex;
        align-items: center;
    }

    .navbar {
        position: relative;
    }
}

/* ナビゲーションバー：Yossyロゴ */
.navbar-logo {
    vertical-align: middle;
    display: block;
}

[data-theme="dark"] .navbar-logo {
    filter: invert(1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .navbar-logo {
        filter: invert(1);
    }
}

/* ペンギンローディング：ホップ（短い待機） */
@keyframes hop-tilt {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    15% { transform: translateY(-8px) rotate(-8deg); }
    30% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(0) rotate(0deg); }
    65% { transform: translateY(-8px) rotate(8deg); }
    80% { transform: translateY(0) rotate(0deg); }
}
.yossy-loading-hop {
    animation: hop-tilt 2.4s ease-in-out infinite;
    transform-origin: bottom center;
}

/* ペンギンローディング：ワドル（長い待機） */
@keyframes waddle-smooth {
    0% { transform: rotate(-6deg) translateY(-2px); }
    50% { transform: rotate(6deg) translateY(-2px); }
    100% { transform: rotate(-6deg) translateY(-2px); }
}
.yossy-loading-waddle {
    animation: waddle-smooth 1.4s ease-in-out infinite;
    transform-origin: bottom center;
}

/* ローディングインジケーター */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: var(--color-text-muted);
}

/* ローディング共通コンポーネント（portal-loading.js）。画像パスは JS 側の ASSET に一本化する */
.portal-loading-inline {
    display: inline-block;
    width: 1.1em;
    height: 1.1em;
    margin-right: 6px;
    vertical-align: -0.15em;
}
.portal-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    background: var(--color-bg);
    color: var(--color-text-muted);
}

/* エンプティステート */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-muted);
}
.empty-state img {
    margin-bottom: 1rem;
    opacity: 0.7;
}

/* ログイン画面ロゴ */
.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.login-logo-img {
    display: inline-block;
}

[data-theme="dark"] .login-logo-img {
    filter: invert(1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .login-logo-img {
        filter: invert(1);
    }
}

/* サービスドロップダウン */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-trigger {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    font-family: var(--font-family);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    transition: background-color 0.15s;
}

.nav-dropdown-trigger:hover {
    background: var(--color-bg-secondary);
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 4px 0;
    min-width: 160px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.nav-dropdown-menu.open {
    display: block;
}

.nav-dropdown-item {
    display: block;
    padding: 8px 16px;
    font-size: 0.875rem;
    color: var(--color-text);
    text-decoration: none;
    transition: background-color 0.1s;
}

.nav-dropdown-item:hover {
    background: var(--color-bg-secondary);
    text-decoration: none;
}

.nav-dropdown-item.active {
    color: var(--color-text);
    font-weight: 500;
    background: var(--color-bg-secondary);
}

[data-theme="dark"] .nav-dropdown-menu {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .nav-dropdown-menu {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

@media (max-width: 767px) {
    .nav-dropdown {
        display: none;
    }
}

/* モバイルナビ：サービス一覧 */
.mobile-nav-services {
    display: none;
}

@media (max-width: 767px) {
    .mobile-nav-services {
        display: block;
    }
}

.mobile-nav-divider {
    height: 1px;
    background: var(--color-border);
    margin: 8px 0;
}

.mobile-nav-link {
    display: block;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-family: var(--font-family);
    color: var(--color-text);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.mobile-nav-logout {
    font-size: 0.9rem;
    font-family: var(--font-family);
}

.mobile-nav-link:hover {
    background: var(--color-bg-secondary);
    text-decoration: none;
}

.mobile-nav-link.active {
    color: var(--color-text);
    font-weight: 500;
    background: var(--color-bg-secondary);
}

.mobile-nav-username {
    display: block;
    padding: 10px 16px;
    font-size: 0.85rem;
    font-family: var(--font-family);
    color: var(--color-text-muted);
    font-weight: 500;
}

/* ===== Toast通知 ===== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 360px;
    animation: toast-in 0.3s ease-out;
    border: 1px solid;
}

.toast-success {
    background: var(--color-bg-card);
    color: var(--color-success);
    border-color: var(--color-success);
}

.toast-error {
    background: var(--color-bg-card);
    color: var(--color-danger);
    border-color: var(--color-danger);
}

.toast-info {
    background: var(--color-bg-card);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    margin-left: auto;
    opacity: 0.6;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    opacity: 1;
}

.toast.toast-out {
    animation: toast-out 0.2s ease-in forwards;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(20px); }
}

@media (max-width: 767px) {
    .toast-container {
        right: 50%;
        transform: translateX(50%);
        width: calc(100% - 2rem);
        max-width: 360px;
    }
}

/* ===== テーブル横スクロール ===== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ===== タップターゲット最小サイズ ===== */
.btn-sm {
    min-height: 36px;
    min-width: 36px;
    padding: 6px 14px;
}

.modal-close,
[class*="-close"] {
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
