/* 
 * 公開画面用のスタイルシートです。
 * オピオイドの換算表やポップアップ表示に関連するスタイルを定義します。
 */

/* 基本スタイル */
body {
    font-family: Arial, sans-serif;
    background-color: #f9f9f9;
    color: #333;
}

/* フォームグループのスタイル */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: bold;
    color: #34495e;
    margin-bottom: 5px;
}

.form-group select,
.form-group input {
    width: 100%;
    max-width: 300px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
}

/* オピオイド換算計算機のスタイル */
.opioid-conversion-calculator {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

.opioid-conversion-calculator h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.opioid-conversion-calculator form {
    max-width: 500px;
}

.opioid-conversion-calculator label {
    font-weight: bold;
    color: #34495e;
    display: block;
    margin-bottom: 5px;
    margin-top: 15px;
}

.opioid-conversion-calculator select,
.opioid-conversion-calculator input {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    width: 100%;
    max-width: 300px;
    box-sizing: border-box;
}

.opioid-conversion-calculator button {
    background-color: #3498db;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
    margin-top: 15px;
}

.opioid-conversion-calculator button:hover {
    background-color: #2980b9;
}

/* タブ機能のスタイル */
.tabs-container {
    margin-bottom: 20px;
}

.tab-buttons {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 20px;
}

.tab-button {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-bottom: none;
    padding: 12px 24px;
    cursor: pointer;
    margin-right: 5px;
    border-radius: 8px 8px 0 0;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tab-button:hover {
    background: #e9ecef;
}

.tab-button.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

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

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

/* 複数薬剤セクションのスタイル */
.multiple-drugs-section {
    margin-bottom: 20px;
}

.multiple-drugs-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.drug-entries-container {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    background: #f8f9fa;
}

.drug-entry {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 15px;
    padding: 15px;
    position: relative;
}

.drug-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.drug-entry-title {
    font-weight: bold;
    color: #495057;
    font-size: 16px;
}

.remove-drug-button {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s ease;
}

.remove-drug-button:hover {
    background: #c82333;
}

.drug-entry-inputs {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 15px;
    align-items: end;
}

.add-drug-section {
    text-align: center;
    margin-bottom: 20px;
}

.add-drug-button {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s ease;
}

.add-drug-button:hover {
    background: #218838;
}

.multiple-conversion-summary {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.add-button {
    background-color: #27ae60;
    color: white;
}

.add-button:hover {
    background-color: #229954;
}

/* 薬剤合計表示のスタイル */
.drugs-summary {
    background: #e8f5e8;
    border: 1px solid #27ae60;
    border-radius: 4px;
    padding: 15px;
    margin: 15px 0;
}

.drugs-summary h4 {
    color: #27ae60;
    margin-top: 0;
    margin-bottom: 10px;
}

.drugs-summary-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.drugs-summary-list li {
    padding: 5px 0;
    border-bottom: 1px solid #d4edda;
}

.drugs-summary-list li:last-child {
    border-bottom: none;
    font-weight: bold;
    padding-top: 10px;
    margin-top: 5px;
    border-top: 2px solid #27ae60;
}

/* 単位表示のスタイル */
#dose-unit-from,
.dose-unit {
    font-weight: bold;
    color: #666;
    margin-left: 5px;
    font-size: 14px;
}

/* 換算結果のスタイル */
#conversion-result {
    margin-top: 20px;
    min-height: 30px;
}

.conversion-result {
    background: #e8f5e8;
    border: 2px solid #27ae60;
    border-radius: 4px;
    padding: 15px;
    margin-top: 15px;
}

.conversion-result.error {
    background: #fdf2f2;
    border-color: #e74c3c;
}

.conversion-result h3 {
    color: #27ae60;
    margin-top: 0;
    margin-bottom: 10px;
}

.conversion-result.error h3 {
    color: #e74c3c;
}

.conversion-note {
    font-size: 12px;
    color: #666;
    font-style: italic;
    margin-top: 10px;
    border-top: 1px solid #ddd;
    padding-top: 8px;
}

/* 警告表示のスタイル */
#conversion-warnings {
    margin-top: 15px;
}

#conversion-warnings h4 {
    color: #e67e22;
    margin-bottom: 10px;
    font-size: 16px;
}

.conversion-warning {
    background: #fef5e7;
    border: 2px solid #f39c12;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.4;
}

/* モルヒネ等価量表示のスタイル */
.morphine-equivalent-display {
    margin-top: 15px;
    background: #f8f9fa;
    border: 2px solid #6c757d;
    border-radius: 4px;
    padding: 15px;
}

.morphine-equivalent-display h3 {
    color: #495057;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 16px;
}

#morphine-equivalent {
    font-size: 14px;
    color: #495057;
}

/* オプトグループのスタイル改善 */
optgroup {
    font-weight: bold;
    color: #2c3e50;
}

option {
    font-weight: normal;
    color: #333;
}

/* 溶解組成設計のスタイル */
.solution-composer {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

.solution-composer h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.solution-composer form {
    max-width: 500px;
}

.solution-composer label {
    font-weight: bold;
    color: #34495e;
}

.solution-composer select,
.solution-composer input {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.solution-composer button {
    background-color: #e74c3c;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
    margin-top: 15px;
}

.solution-composer button:hover {
    background-color: #c0392b;
}

/* 組成計算結果のスタイル */
#solution-result {
    margin-top: 20px;
}

.solution-result {
    background: #fef9e7;
    border: 2px solid #f39c12;
    border-radius: 4px;
    padding: 15px;
    margin-top: 15px;
}

.solution-result h3 {
    color: #f39c12;
    margin-top: 0;
}

.solution-note {
    font-size: 12px;
    color: #666;
    font-style: italic;
    margin-top: 10px;
    border-top: 1px solid #ddd;
    padding-top: 8px;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.result-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #ddd;
    vertical-align: top;
}

.result-table td:first-child {
    font-weight: bold;
    background-color: #f8f9fa;
    width: 40%;
}

/* 換算表のスタイル */
.conversion-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.conversion-table th, .conversion-table td {
    border: 1px solid #ddd;
    padding: 8px;
}

.conversion-table th {
    background-color: #4CAF50;
    color: white;
}

/* ポップアップのスタイル */
.popup {
    display: none;
    position: fixed;
    z-index: 10000; /* より高いz-indexを設定 */
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    border: 1px solid #ccc;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); /* より強いシャドウ */
    padding: 20px;
    width: 300px;
    max-width: 90vw; /* レスポンシブ対応 */
    max-height: 80vh; /* 画面の高さを考慮 */
    overflow-y: auto; /* 内容が多い場合のスクロール */
    border-radius: 8px; /* 角丸 */
}

.popup.active {
    display: block;
}

.popup .close {
    cursor: pointer;
    float: right;
    font-size: 18px;
    font-weight: bold;
    color: #999;
    line-height: 1;
}

.popup .close:hover {
    color: #333;
}

/* ボタンスタイル */
.button {
    background-color: #4CAF50;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.button:hover {
    background-color: #45a049;
}

/* モーダル関連のスタイル */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.drug-info-modal {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    max-height: 90vh;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s ease;
}

.drug-info-modal.modal-show {
    opacity: 1;
    transform: scale(1);
}

.modal-header {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 24px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    font-weight: bold;
    color: #6c757d;
    cursor: pointer;
    padding: 8px 12px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.2s ease;
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background-color: #e9ecef;
    color: #495057;
    transform: scale(1.1);
}

.modal-close:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    background-color: #e9ecef;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 15px 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

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

.btn-primary {
    background-color: #007bff;
    color: white;
}

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

/* 薬剤情報の詳細スタイル */
.drug-info-grid {
    display: grid;
    gap: 20px;
}

.basic-info, .conversion-info, .clinical-notes, .safety-info, .dosage-guidelines {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
}

.basic-info h3, .conversion-info h3, .clinical-notes h3, .safety-info h3, .dosage-guidelines h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #495057;
    font-size: 18px;
}

.info-list {
    margin: 0;
    padding: 0;
}

.info-list dt {
    font-weight: bold;
    color: #495057;
    margin-top: 10px;
    margin-bottom: 5px;
}

.info-list dt:first-child {
    margin-top: 0;
}

.info-list dd {
    margin: 0 0 10px 15px;
    color: #6c757d;
}

.safety-list, .guideline-list {
    margin: 0;
    padding-left: 20px;
}

.safety-list li, .guideline-list li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .modal-container {
        padding: 10px;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-header h2 {
        font-size: 20px;
    }
    
    .modal-close {
        font-size: 28px;
        min-width: 44px;
        min-height: 44px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .modal-footer {
        padding: 12px 15px;
    }
}