/* FXレバレッジ計算ツール - スタイルシート */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

/* ===== コンテナ ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    backdrop-filter: blur(10px);
}

/* ===== ヘッダー ===== */
h1 {
    text-align: center;
    color: #1e3c72;
    margin-bottom: 10px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 40px;
    font-size: 1.1em;
}

/* ===== エラーメッセージ ===== */
.error-container {
    background: #fee;
    border: 1px solid #f88;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: none;
}

.error-container.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

.error-message {
    color: #d00;
    font-weight: 500;
    margin: 5px 0;
}

/* ===== 入力セクション ===== */
.input-section {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* ===== タブ ===== */
.currency-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.tab {
    flex: 1;
    padding: 12px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tab:hover:not(.active) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    background: #f8f9fa;
}

.tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.tab:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* キーボードナビゲーション時のフォーカススタイル */
.tab:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* ===== 入力グリッド ===== */
.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.input-group {
    position: relative;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

input[type="number"], 
input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

input[type="number"]:focus, 
input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

/* 無効な入力値のスタイル */
input.invalid {
    border-color: #f44336;
    background-color: #fff5f5;
}

.unit {
    position: absolute;
    right: 15px;
    top: 42px;
    color: #6c757d;
    pointer-events: none;
}

/* ===== 通貨セクション ===== */
.currency-section {
    background: linear-gradient(145deg, #f5f7fa, #e1e5e9);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
}

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

.currency-title {
    font-size: 1.3em;
    font-weight: bold;
    color: #2c3e50;
}

.allocation-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.allocation-input input {
    width: 80px;
}

/* ===== 結果グリッド ===== */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.result-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.result-card h3 {
    color: #1e3c72;
    margin-bottom: 15px;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.leverage-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9em;
}

.result-item {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.result-label {
    color: #6c757d;
}

.result-value {
    font-weight: bold;
    color: #1e3c72;
}

/* lot数の強調表示 */
.lot-value {
    font-size: 1.2em;
    font-weight: bold;
    color: #667eea;
}

.lot-sub-value {
    font-size: 0.85em;
    color: #aaa;
    font-weight: normal;
    margin-left: 5px;
}

/* lot数を含む行の特別なスタイル */
.result-item:has(.lot-value) {
    padding: 12px 0;
    border-bottom: 2px solid #f0f0f0;
}

.highlight {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 3px 10px;
    border-radius: 5px;
}

/* ===== 安全性インジケーター ===== */
.safety-indicator {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    position: relative;
}

.safety-indicator::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.safety-high {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.safety-high::before {
    background-color: #38ef7d;
    box-shadow: 0 0 10px #38ef7d;
}

.safety-medium {
    background: linear-gradient(135deg, #f2994a 0%, #f2c94c 100%);
    color: white;
}

.safety-medium::before {
    background-color: #f2c94c;
    box-shadow: 0 0 10px #f2c94c;
}

.safety-low {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    color: white;
}

.safety-low::before {
    background-color: #f45c43;
    box-shadow: 0 0 10px #f45c43;
}

/* ===== 情報ボックス ===== */
.info-box {
    background: linear-gradient(135deg, #667eea20 0%, #764ba220 100%);
    border-left: 4px solid #667eea;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.info-box h4 {
    color: #667eea;
    margin-bottom: 10px;
}

/* ===== スワップ計算機 ===== */
.swap-calculator {
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    padding: 25px;
    border-radius: 15px;
    margin-top: 20px;
    border: 2px solid #e9ecef;
}

.swap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.swap-item {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.swap-amount {
    font-size: 1.8em;
    font-weight: bold;
    color: #11998e;
    margin-top: 5px;
}

.swap-period {
    color: #6c757d;
    font-size: 0.9em;
}

/* ===== 組み合わせ結果 ===== */
.combined-results {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    margin: 30px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.combined-results h3 {
    font-size: 1.5em;
    margin-bottom: 20px;
    text-align: center;
}

.combined-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.combined-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.combined-value {
    font-size: 1.5em;
    font-weight: bold;
    margin-top: 5px;
}

/* ===== 時系列セクション ===== */
.time-series-section {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    padding: 25px;
    border-radius: 15px;
    margin: 20px 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.currency-time-series {
    background: rgba(255, 255, 255, 0.5);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.currency-time-series h4 {
    margin: 0 0 15px 0;
    font-size: 1.1em;
}

.time-series-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.time-point {
    background: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.time-label {
    font-weight: bold;
    color: #1976d2;
    margin-bottom: 8px;
}

.losscut-price {
    font-size: 1.2em;
    font-weight: bold;
    color: #d32f2f;
}

.improvement {
    font-size: 0.9em;
    color: #388e3c;
    margin-top: 5px;
}

/* ===== 免責事項セクション ===== */
.disclaimer-section {
    background: linear-gradient(135deg, #fff3cd 0%, #f8d7da 100%);
    border: 2px solid #f5c6cb;
    border-radius: 15px;
    padding: 30px;
    margin-top: 40px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.disclaimer-section h3 {
    color: #721c24;
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 2px solid #f5c6cb;
    padding-bottom: 10px;
}

.disclaimer-content {
    color: #495057;
    line-height: 1.8;
}

.disclaimer-content p {
    margin: 20px 0 10px;
    font-weight: bold;
    color: #721c24;
}

.disclaimer-content ul {
    list-style-type: none;
    padding-left: 0;
}

.disclaimer-content li {
    margin: 10px 0;
    padding-left: 25px;
    position: relative;
}

.disclaimer-content li:before {
    content: "▶";
    position: absolute;
    left: 0;
    color: #dc3545;
    font-size: 0.8em;
}

.disclaimer-footer {
    margin-top: 25px !important;
    padding: 20px;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 10px;
    text-align: center;
    font-weight: normal !important;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

/* ===== ローディング状態 ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===== ツールチップ ===== */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.9em;
    line-height: 1.4;
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #555 transparent transparent transparent;
}

.tooltip:hover .tooltiptext,
.tooltip:focus .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* ===== アニメーション ===== */
.animate-in {
    animation: fadeInUp 0.5s ease-out;
}

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

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== レスポンシブデザイン ===== */
@media (max-width: 900px) {
    .single-currency-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    .input-grid {
        grid-template-columns: 1fr;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .currency-tabs {
        flex-direction: column;
    }
    
    .tab {
        width: 100%;
    }
    
    .disclaimer-modal-content {
        padding: 20px;
        margin: 10px;
    }
    
    .disclaimer-modal-header h2 {
        font-size: 1.5em;
    }
    
    .disclaimer-modal-body {
        max-height: 40vh;
    }
    
    .disclaimer-buttons {
        flex-direction: column;
    }
    
    .disclaimer-button {
        width: 100%;
    }
}

/* ===== 免責事項モーダル ===== */
.disclaimer-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    overflow-y: auto;
}

.disclaimer-modal.hidden {
    display: none;
}

.disclaimer-modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
}

.disclaimer-modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.disclaimer-modal-header h2 {
    color: #721c24;
    font-size: 2em;
    margin-bottom: 10px;
}

.disclaimer-modal-body {
    margin-bottom: 30px;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 10px;
}

.disclaimer-modal-body::-webkit-scrollbar {
    width: 8px;
}

.disclaimer-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.disclaimer-modal-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.disclaimer-modal-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.disclaimer-agreement {
    background: #f8f9fa;
    border: 2px solid #dc3545;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.disclaimer-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
}

.disclaimer-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
}

.disclaimer-checkbox label {
    flex: 1;
    cursor: pointer;
    font-weight: 600;
    color: #495057;
    line-height: 1.5;
}

.disclaimer-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.disclaimer-button {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

.disclaimer-button-accept {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.disclaimer-button-accept:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.disclaimer-button-accept:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(17, 153, 142, 0.3);
}

.disclaimer-button-decline {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    color: white;
}

.disclaimer-button-decline:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(235, 51, 73, 0.3);
}

.disclaimer-modal-content .disclaimer-content {
    color: #495057;
    line-height: 1.8;
}

.disclaimer-modal-content .disclaimer-content p {
    margin: 20px 0 10px;
    font-weight: bold;
    color: #721c24;
}

.disclaimer-modal-content .disclaimer-content ul {
    list-style-type: none;
    padding-left: 0;
}

.disclaimer-modal-content .disclaimer-content li {
    margin: 10px 0;
    padding-left: 25px;
    position: relative;
}

.disclaimer-modal-content .disclaimer-content li:before {
    content: "▶";
    position: absolute;
    left: 0;
    color: #dc3545;
    font-size: 0.8em;
}

/* メインコンテンツのぼかし効果 */
.container.blurred {
    filter: blur(5px);
    pointer-events: none;
    user-select: none;
}

/* ===== 印刷用スタイル ===== */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .container {
        box-shadow: none;
        padding: 20px;
        max-width: 100%;
    }
    
    .input-section,
    .currency-tabs,
    .loading-overlay {
        display: none !important;
    }
    
    .result-card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    .disclaimer-section {
        page-break-before: always;
    }
}