/* ========================================
   暗号資産オプション価格比較ツール - モダンUIスタイル
   ======================================== */

/* カラー変数定義 */
:root {
    /* ライトテーマ */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #ec4899;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;

    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.7);

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;

    --border-color: #e2e8f0;
    --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);

    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
}

/* ダークテーマ */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-glass: rgba(15, 23, 42, 0.7);

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;

    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

/* ベーススタイル */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

/* 背景アニメーション */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at top left, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(236, 72, 153, 0.1) 0%, transparent 50%);
    z-index: -1;
    animation: gradientShift 20s ease infinite;
}

@keyframes gradientShift {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(-50px, -50px) scale(1.1);
    }

    66% {
        transform: translate(50px, 50px) scale(0.9);
    }
}

/* ナビゲーションバー */
.navbar {
    background: var(--bg-glass) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    transition: all 0.3s ease;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-brand i {
    -webkit-text-fill-color: var(--primary-color);
    margin-right: 0.5rem;
}

/* カードスタイル */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.card-header {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 1.25rem;
    font-weight: 600;
}

.card-header.bg-dark {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

.card-header.bg-success {
    background: var(--gradient-success) !important;
}

.card-body {
    padding: 1.5rem;
}

/* フォーム要素 */
.form-select,
.form-control {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.form-select:focus,
.form-control:focus {
    background: var(--bg-primary);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

/* ボタン */
.btn {
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.875rem;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

/* アラート */
.alert {
    border: none;
    border-radius: 0.75rem;
    padding: 1rem 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
    border-left: 4px solid var(--info-color);
}

/* テーブル */
.table {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.table thead th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    padding: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-color: var(--border-color);
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: var(--bg-secondary);
    transform: scale(1.01);
}

/* 価格マトリックス */
#priceMatrix {
    border-radius: 0.5rem;
    overflow: hidden;
}

#priceMatrix .sticky-col {
    background: var(--bg-tertiary);
    font-weight: 600;
    white-space: nowrap;
}

#priceMatrix td {
    font-family: 'Roboto Mono', monospace;
}

/* 価格表示 */
.price-bid {
    color: var(--success-color);
    font-weight: 600;
}

.price-ask {
    color: var(--danger-color);
    font-weight: 600;
}

.best-price {
    background: rgba(99, 102, 241, 0.1);
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

/* アービトラージカード */
.arbitrage-opportunity {
    background: var(--gradient-success);
    color: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
    animation: slideIn 0.5s ease;
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.2);
    transition: all 0.3s ease;
}

.arbitrage-opportunity:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(16, 185, 129, 0.3);
}

.arbitrage-opportunity::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: rotate 10s linear infinite;
}

.arbitrage-opportunity .badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.arbitrage-opportunity h5 {
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 1rem;
}

.arbitrage-opportunity h2 {
    font-weight: 800;
    letter-spacing: -1px;
    font-size: 2.5rem;
}

.arbitrage-opportunity strong {
    font-weight: 700;
}

.arbitrage-opportunity .text-muted {
    opacity: 0.9;
    color: rgba(255, 255, 255, 0.8) !important;
}

.arbitrage-opportunity .text-success {
    color: #d1fae5 !important;
}

.arbitrage-opportunity .text-danger {
    color: #fee2e2 !important;
}

.arbitrage-opportunity .text-primary {
    color: white !important;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ローディングスピナー */
.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.25rem;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* レスポンシブ */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .card {
        border-radius: 0.75rem;
    }

    .table {
        font-size: 0.85rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
}

/* チャートコンテナ */
.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
    padding: 1rem;
}

/* アニメーションクラス */
.fade-in {
    animation: fadeIn 0.5s ease;
}

.slide-up {
    animation: slideUp 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* テーマトグルボタン */
.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    z-index: 1000;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl);
}

/* Arbitrage Table Styles */
#arbitrageCard .table {
    margin-bottom: 0;
}

#arbitrageCard thead th {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    font-weight: 700;
    border-color: rgba(16, 185, 129, 0.2);
}

#arbitrageCard tbody tr {
    transition: all 0.2s ease;
}

#arbitrageCard tbody tr:hover {
    background: rgba(16, 185, 129, 0.05);
    transform: scale(1.01);
}

#arbitrageCard tbody td {
    vertical-align: middle;
}

#arbitrageCard .text-success {
    font-weight: 600;
}

#arbitrageCard .text-danger {
    font-weight: 600;
}

#arbitrageCard .text-primary {
    font-weight: 700;
}

/* Success badges in table */
#arbitrageTableBody .badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
}

/* Profit highlighting */
.profit-high {
    color: var(--success-color) !important;
    font-weight: 700 !important;
}

.profit-medium {
    color: var(--warning-color) !important;
    font-weight: 600 !important;
}

.profit-low {
    color: var(--text-secondary) !important;
}

/* ========================================
   モダンなプログレスバースタイル
   ======================================== */

/* プログレスバーコンテナ */
#streamProgress {
    position: relative;
    background: var(--bg-tertiary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

/* プログレスバー本体 */
#streamProgress .progress-bar {
    background: var(--gradient-primary);
    height: 100%;
    position: relative;
    overflow: hidden;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* グラデーションアニメーション */
#streamProgress .progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

/* 波紋エフェクト */
#streamProgress .progress-bar::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: translate(50%, -50%);
    animation: pulse 1s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* パーセンテージテキスト */
#streamProgress .progress-bar {
    font-weight: 600;
    font-size: 14px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
}

/* アニメーション定義 */
@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

@keyframes pulse {
    0% {
        transform: translate(50%, -50%) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translate(50%, -50%) scale(1.5);
        opacity: 0;
    }
    100% {
        transform: translate(50%, -50%) scale(1);
        opacity: 0.5;
    }
}

/* ダークモードでのプログレスバー */
[data-theme="dark"] #streamProgress {
    background: rgba(30, 41, 59, 0.5);
}

[data-theme="dark"] #streamProgress .progress-bar {
    background: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
    box-shadow: 0 2px 12px rgba(129, 140, 248, 0.6);
}

/* ステータスメッセージのスタイル */
#statusMessage {
    font-weight: 500;
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ローディングアイコンのアニメーション改善 */
#statusAlert .fa-spinner {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: spin 1s linear infinite, pulse-color 2s ease-in-out infinite;
}

@keyframes pulse-color {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.2);
    }
}

/* プログレスバーの高さ調整 */
#streamProgress {
    height: 24px !important;
    margin-top: 12px !important;
}

/* 完了時のアニメーション */
#streamProgress.complete .progress-bar {
    background: var(--gradient-success);
    box-shadow: 0 2px 12px rgba(16, 185, 129, 0.6);
}

/* エラー時のスタイル */
#streamProgress.error .progress-bar {
    background: var(--gradient-danger);
    box-shadow: 0 2px 12px rgba(239, 68, 68, 0.6);
}
