/**
 * Social9 共通スタイル
 * 仕様書: 11_UIレイアウト.md, 33_画面デザイン詳細.md
 */
@import url('components/line-icons.css');

/* =====================================================
   CSS変数（テーマカラー）
   ===================================================== */
:root {
    /* プライマリカラー */
    --primary: #667eea;
    --primary-dark: #5a6fd6;
    --primary-light: #818cf8;
    --primary-bg: rgba(102, 126, 234, 0.1);
    
    /* セカンダリカラー */
    --secondary: #764ba2;
    --secondary-dark: #6b4190;
    
    /* グラデーション */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-soft: linear-gradient(135deg, #667eea22 0%, #764ba222 100%);
    
    /* テキストカラー */
    --text-primary: #1a1a2e;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --text-light: #a0aec0;
    
    /* 背景カラー */
    --bg-primary: #ffffff;
    --bg-secondary: #f7fafc;
    --bg-tertiary: #edf2f7;
    --bg-dark: #1a1a2e;
    
    /* ボーダー */
    --border-light: #e2e8f0;
    --border-medium: #cbd5e0;
    
    /* ステータスカラー */
    --success: #48bb78;
    --success-bg: #c6f6d5;
    --warning: #ed8936;
    --warning-bg: #feebc8;
    --error: #f56565;
    --error-bg: #fed7d7;
    --info: #4299e1;
    --info-bg: #bee3f8;
    
    /* 投資家用カラー */
    --investor-gold: #c9a227;
    --investor-gold-light: #f0e6cc;
    
    /* テキスト（ショートハンド） */
    --text: #1a1a2e;
    
    /* シャドウ */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* ボーダー半径 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* トランジション */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* フォントサイズ */
    --font-xs: 11px;
    --font-sm: 13px;
    --font-md: 15px;
    --font-lg: 18px;
    --font-xl: 24px;
    --font-2xl: 32px;
    
    /* スペーシング */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
}

/* ダークテーマ */
[data-theme="dark"] {
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #a0aec0;
    --text-light: #718096;
    
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    
    --border-light: #2d3748;
    --border-medium: #4a5568;
}

/* =====================================================
   リセット & ベース
   ===================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--user-font, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Meiryo', sans-serif);
    font-size: var(--font-base, var(--font-md));
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    min-height: 100vh;
}

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

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* =====================================================
   タイポグラフィ
   ===================================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: var(--font-2xl); }
h2 { font-size: var(--font-xl); }
h3 { font-size: var(--font-lg); }
h4 { font-size: var(--font-md); }

p {
    margin-bottom: var(--space-4);
}

/* =====================================================
   ボタン
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-size: var(--font-md);
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-light);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover:not(:disabled) {
    background: var(--primary-bg);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #e53e3e;
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-sm);
}

.btn-lg {
    padding: var(--space-4) var(--space-6);
    font-size: var(--font-lg);
}

.btn-full,
.btn-block {
    width: 100%;
}

/* =====================================================
   フォーム
   ===================================================== */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-md);
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-input::placeholder {
    color: var(--text-light);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.form-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.form-error {
    color: var(--error);
    font-size: var(--font-sm);
    margin-top: var(--space-1);
}

/* =====================================================
   カード
   ===================================================== */
.card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.card-header {
    padding: var(--space-5);
    border-bottom: 1px solid var(--border-light);
}

.card-body {
    padding: var(--space-5);
}

.card-footer {
    padding: var(--space-5);
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

/* =====================================================
   アラート・通知
   ===================================================== */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.alert-success {
    background: var(--success-bg);
    color: #276749;
}

.alert-warning {
    background: var(--warning-bg);
    color: #975a16;
}

.alert-error {
    background: var(--error-bg);
    color: #c53030;
}

.alert-info {
    background: var(--info-bg);
    color: #2b6cb0;
}

/* =====================================================
   アバター
   ===================================================== */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
    overflow: hidden;
}

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

.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl { width: 80px; height: 80px; font-size: 28px; }

/* オンラインインジケーター */
.avatar-wrapper {
    position: relative;
    display: inline-block;
}

.avatar-wrapper .online-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
}

.avatar-wrapper .online-indicator.online { background: var(--success); }
.avatar-wrapper .online-indicator.away { background: var(--warning); }
.avatar-wrapper .online-indicator.offline { background: var(--text-light); }

/* =====================================================
   バッジ
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: var(--font-xs);
    font-weight: 500;
    border-radius: var(--radius-full);
}

.badge-primary {
    background: var(--primary);
    color: white;
}

.badge-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-success {
    background: var(--success-bg);
    color: #276749;
}

.badge-warning {
    background: var(--warning-bg);
    color: #975a16;
}

.badge-error {
    background: var(--error-bg);
    color: #c53030;
}


/* =====================================================
   モーダル
   ===================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    padding: var(--space-5);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-tertiary);
}

.modal-body {
    padding: var(--space-5);
    overflow-y: auto;
    max-height: calc(90vh - 150px);
}

.modal-footer {
    padding: var(--space-5);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* =====================================================
   ユーティリティ
   ===================================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: var(--font-sm); }
.text-bold { font-weight: 600; }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.hidden { display: none !important; }
.visible { display: block !important; }

/* =====================================================
   レスポンシブ
   ===================================================== */
@media (max-width: 768px) {
    :root {
        --font-md: 14px;
        --font-lg: 16px;
        --font-xl: 20px;
        --font-2xl: 28px;
    }
    
    .btn {
        padding: var(--space-3) var(--space-4);
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    /* タッチ操作・フォーム（全デバイス表示計画） */
    button, a.btn, .btn,
    input[type="submit"], input[type="button"], input[type="reset"] {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    input[type="text"], input[type="email"], input[type="password"], input[type="search"],
    textarea, select {
        font-size: 16px;
        min-height: 44px;
    }
    textarea { min-height: 44px; }
}

/* =====================================================
   アニメーション
   ===================================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fadeIn { animation: fadeIn var(--transition-normal); }
.animate-slideUp { animation: slideUp var(--transition-normal); }
.animate-pulse { animation: pulse 2s infinite; }

/* =====================================================
   ローディング
   ===================================================== */
.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* =====================================================
   多言語入力フィールド（i18n）
   ===================================================== */
.i18n-input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.i18n-input-group .form-group.i18n-field {
    margin-bottom: 0;
}

.i18n-input-group .form-group.i18n-field label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    margin-bottom: 6px;
    color: #1a1a2e;
}

.i18n-input-group .form-group.i18n-field input,
.i18n-input-group .form-group.i18n-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #ffffff;
    color: #1a1a2e;
}

.i18n-input-group .form-group.i18n-field input:focus,
.i18n-input-group .form-group.i18n-field textarea:focus {
    outline: none;
    border-color: var(--primary, #667eea);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.i18n-input-group .form-group.i18n-field input::placeholder,
.i18n-input-group .form-group.i18n-field textarea::placeholder {
    color: #a0aec0;
    font-style: italic;
}

.i18n-input-group .required {
    color: #e53e3e;
    font-weight: bold;
}

/* コンパクトモード（横並び） */
@media (min-width: 768px) {
    .i18n-input-group.horizontal {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .i18n-input-group.horizontal .form-group.i18n-field {
        flex: 1;
        min-width: 200px;
    }
}

/* =====================================================
   アプリメニュー
   ===================================================== */
.app-menu-container {
    position: relative;
    display: inline-block;
}

.app-btn {
    position: relative;
}

.app-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 280px;
    background: var(--bg-primary, #ffffff);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    z-index: 1000;
    transition: all 0.2s ease;
    z-index: 1000;
    overflow: hidden;
}

.app-dropdown.active {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.app-dropdown-header {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #718096);
    background: var(--bg-secondary, #f7fafc);
    border-bottom: 1px solid var(--border-light, #e2e8f0);
}

.app-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--text-primary, #1a1a2e);
    transition: all 0.15s ease;
    border-bottom: 1px solid var(--border-light, #e2e8f0);
}

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

.app-item:hover:not(.disabled) {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
}

.app-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.app-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-radius: 12px;
    flex-shrink: 0;
}

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

.app-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.app-desc {
    display: block;
    font-size: 12px;
    color: var(--text-muted, #718096);
}

.app-badge-inline {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 700;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ダークモード対応 */
.dark .app-dropdown,
[data-theme="dark"] .app-dropdown {
    background: #1e293b;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.dark .app-dropdown-header,
[data-theme="dark"] .app-dropdown-header {
    background: #0f172a;
    border-color: #334155;
    color: #94a3b8;
}

.dark .app-item,
[data-theme="dark"] .app-item {
    color: #f1f5f9;
    border-color: #334155;
}

.dark .app-item:hover:not(.disabled),
[data-theme="dark"] .app-item:hover:not(.disabled) {
    background: rgba(99, 102, 241, 0.15);
}
