/* FX補助ツール - メインスタイル */

/* リセット・基本設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* カラーパレット */
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    
    /* ニュートラルカラー */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* 背景色 */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-dark: #1e293b;
    --bg-darker: #0f172a;
    
    /* テキストカラー */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --text-white: #ffffff;
    
    /* ボーダー */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --border-dark: #cbd5e1;
    
    /* シャドウ */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* レイアウト */
    --header-height: 64px;
    --sidebar-width: 280px;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    
    /* フォント */
    --font-sans: 'Hiragino Sans', 'Yu Gothic UI', 'Meiryo UI', sans-serif;
    --font-mono: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
    
    /* トランジション */
    --transition: all 0.2s ease-in-out;
    --transition-fast: all 0.15s ease-in-out;
}

/* 基本設定 */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    overflow-x: hidden;
}

/* スクロールバー */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ヘッダー */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 24px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.version {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 12px;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.status-indicator {
    font-size: 8px;
    color: var(--success-color);
    animation: pulse 2s infinite;
}

.status-indicator.disconnected {
    color: var(--danger-color);
    animation: none;
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-controls {
    display: flex;
    gap: 8px;
}

/* メインコンテナ */
.main-container {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* サイドバー */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 0;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    border-right: 3px solid transparent;
}

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

.nav-item.active .nav-link {
    background: var(--bg-secondary);
    color: var(--primary-color);
    border-right-color: var(--primary-color);
    font-weight: 600;
}

.nav-link i {
    width: 20px;
    text-align: center;
}

/* シンボルセレクター */
.symbol-selector {
    padding: 24px;
    border-top: 1px solid var(--border-color);
}

.symbol-selector h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.symbol-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.symbol-item {
    display: block;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    margin-bottom: 8px;
}

.symbol-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.symbol-scenario {
    font-size: 0.8em;
    opacity: 0.8;
    margin-top: 4px;
}

.symbol-item:hover {
    background: var(--bg-tertiary);
}

.symbol-item.active {
    background: var(--primary-color);
    color: var(--text-white);
    border-color: var(--primary-dark);
}

.symbol-name {
    font-weight: 600;
}

.symbol-price {
    font-family: var(--font-mono);
    font-size: 12px;
}

/* メインコンテンツ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
    background: var(--bg-secondary);
}

/* セクション */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.section-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* カード */
.card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

.card-icon {
    color: var(--text-muted);
    font-size: 18px;
}

/* ボタン */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-200);
}

.btn-success {
    background: var(--success-color);
    color: var(--text-white);
}

.btn-warning {
    background: var(--warning-color);
    color: var(--text-white);
}

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

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* フォーム */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control,
.select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    background: var(--bg-primary);
}

.form-control:focus,
.select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

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

/* バッジ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
    background: var(--primary-color);
    color: var(--text-white);
}

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

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

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

/* リンク */
.link-sm {
    font-size: 12px;
    color: var(--primary-color);
    text-decoration: none;
}

.link-sm:hover {
    text-decoration: underline;
}

/* ユーティリティ */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}

.no-data {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
    font-style: italic;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--success-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-danger {
    color: var(--danger-color);
}

/* レスポンシブ */
@media (max-width: 1024px) {
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        transform: none;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-container {
        flex-direction: column;
    }
}

/* Alert Tabs Styling */
.alert-tabs {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 15px;
}

.tab-button {
    background: none;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-size: 0.9em;
    color: #6c757d;
    transition: all 0.3s ease;
}

.tab-button:hover {
    color: #007bff;
    background: #f8f9fa;
}

.tab-button.active {
    color: #007bff;
    border-bottom-color: #007bff;
    font-weight: bold;
}

.alert-tab-content {
    display: none;
}

.alert-tab-content.active {
    display: block;
}

.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.history-controls select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
}

.refresh-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.refresh-btn:hover {
    background: #0056b3;
}

.test-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    margin-left: 5px;
}

.test-btn:hover {
    background: #5a6268;
}

/* Alert History Styling */
.alert-history-item {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 10px;
    padding: 12px;
    background: white;
    transition: box-shadow 0.2s ease;
}

.alert-history-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.alert-history-item.resolved {
    background: #f8f9fa;
    border-left: 4px solid #28a745;
}

.alert-history-item.cancelled {
    background: #f8f9fa;
    border-left: 4px solid #6c757d;
}

.alert-history-item.active {
    border-left: 4px solid #007bff;
}

.alert-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.alert-history-title {
    font-weight: bold;
    color: #333;
}

.alert-history-status {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    text-transform: uppercase;
    font-weight: bold;
}

.alert-history-status.active {
    background: #007bff;
    color: white;
}

.alert-history-status.resolved {
    background: #28a745;
    color: white;
}

.alert-history-status.cancelled {
    background: #6c757d;
    color: white;
}

.alert-history-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: #6c757d;
    margin-bottom: 8px;
}

.alert-history-message {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 8px;
}

.alert-history-action {
    background: #e7f3ff;
    padding: 6px 8px;
    border-radius: 4px;
    border-left: 3px solid #007bff;
    font-size: 0.85em;
    margin-bottom: 8px;
}

.alert-history-technical {
    font-size: 0.75em;
    color: #888;
    font-style: italic;
}

/* Performance Stats Styling */
.performance-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #007bff;
}

.stat-label {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 5px;
}

.stat-card.positive .stat-value {
    color: #28a745;
}

.stat-card.negative .stat-value {
    color: #dc3545;
}

@media (max-width: 768px) {
    .header-container {
        padding: 0 16px;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .section-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    /* モバイル用通貨ペア選択 */
    .symbol-selector {
        margin-bottom: 15px;
    }
    
    .symbol-list {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: space-between;
    }
    
    .symbol-item {
        flex: 1;
        min-width: calc(50% - 4px);
        padding: 12px 8px;
        cursor: pointer;
        border: 2px solid transparent;
        border-radius: 8px;
        background: #f8f9fa;
        transition: all 0.3s ease;
        text-align: center;
    }
    
    .symbol-item:hover,
    .symbol-item.active {
        border-color: #007bff;
        background: #e3f2fd;
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0,123,255,0.2);
    }
    
    .symbol-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 4px;
    }
    
    .symbol-name {
        font-weight: bold;
        font-size: 0.9em;
        color: #333;
    }
    
    .symbol-price {
        font-size: 0.85em;
        color: #666;
        font-weight: 500;
    }
    
    .symbol-scenario {
        font-size: 0.75em;
        color: #888;
        line-height: 1.2;
        margin-top: 4px;
    }
    
    .scenario-text {
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}
