/* styles.css - 共通スタイルシート */

/* グローバル設定 */
* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    margin: 0;
    padding: 0;
}

h1 {
    text-align: center;
    color: #333;
}

/* エディタコンテナ */
.editor-container {
    display: flex;
    height: 100vh;
}

/* 入力エリアと出力エリアの共通スタイル */
#markdown-input,
#html-output {
    width: 50%;
    height: 100%;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    line-height: 1.6;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    overflow-y: auto;
}

/* 入力エリアのスタイル */
#markdown-input {
    resize: none;
}

#markdown-input:focus {
    outline: none;
    border-color: #00ff00;
}

/* 出力エリアのスタイル */
#html-output {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

#html-output h1,
#html-output h2,
#html-output h3 {
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

#html-output code {
    background-color: #333;
    color: #ccc;
    padding: 2px 4px;
    border-radius: 3px;
}

#html-output pre {
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
}

#html-output blockquote {
    border-left: 5px solid #ccc;
    padding-left: 10px;
    color: #666;
    margin-left: 0;
}

#html-output table {
    border-collapse: collapse;
    width: 100%;
}

#html-output th,
#html-output td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

#html-output th {
    background-color: #f2f2f2;
}

/* ツールバーパネル */
#toolbar-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.8);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    z-index: 1000;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

#toolbar-panel.collapsed {
    padding: 5px;
    width: auto;
    min-width: unset;
}

#toolbar-toggle {
    background: #333;
    color: white;
    border: none;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
    line-height: 1;
    align-self: flex-end;
}

#toolbar-toggle:hover {
    background: #555;
}

#toolbar-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: all 0.3s ease;
}

#toolbar-panel.expanded #toolbar-buttons {
    max-height: 100px;
    opacity: 1;
}

#toolbar-panel.collapsed #toolbar-buttons {
    margin-top: 0;
    display: none;
}

/* ツールバーボタン */
.toolbar-button {
    border: none;
    padding: 8px 14px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.toolbar-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

#print-button {
    background-color: #007bff;
    color: white;
}

#print-button:hover {
    background-color: #0056b3;
}

#data-button {
    background-color: #28a745;
    color: white;
}

#data-button:hover {
    background-color: #218838;
}

#new-tab-button {
    background-color: #6c757d;
    color: white;
    text-decoration: none;
    display: inline-block;
}

#new-tab-button:hover {
    background-color: #545b62;
    color: white;
}

#download-button {
    background-color: #17a2b8;
    color: white;
}

#download-button:hover {
    background-color: #138496;
}

#download-html-button {
    background-color: #fd7e14;
    color: white;
}

#download-html-button:hover {
    background-color: #dc6502;
}

/* データパネル */
#data-panel {
    position: fixed;
    top: 90px;
    right: 20px;
    width: 300px;
    max-height: 80vh;
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 999;
    display: none;
    overflow-y: auto;
}

#data-panel.show {
    display: block;
}

.data-panel-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.data-panel-content {
    padding: 15px;
}

.tab-info {
    background: #e8f5e8;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    border-left: 4px solid #28a745;
}

.tab-info h4 {
    margin: 0 0 5px 0;
    color: #155724;
    font-size: 14px;
}

.tab-id {
    font-family: monospace;
    font-weight: bold;
    color: #007bff;
}

.data-section {
    margin-bottom: 20px;
}

.data-section h4 {
    margin: 0 0 10px 0;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 13px;
}

.current-tab-data h4 {
    background: #e8f5e8;
    color: #155724;
}

.other-tab-data h4 {
    background: #f1f1f1;
    color: #666;
}

.data-item {
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 10px;
    background: #fafafa;
}

.data-item-title {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 14px;
}

.data-item-meta {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.data-item-preview {
    font-size: 12px;
    color: #888;
    line-height: 1.4;
    margin-bottom: 8px;
    max-height: 40px;
    overflow: hidden;
}

.data-item-actions {
    display: flex;
    gap: 5px;
}

/* ボタンスタイル */
.btn-small {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: white;
    cursor: pointer;
}

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

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

.btn-delete {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.btn-delete:hover {
    background: #c82333;
}

.control-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.btn {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 13px;
}

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

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

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

.btn-secondary:hover {
    background: #545b62;
}

/* 保存ダイアログ */
#save-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 1001;
    display: none;
    min-width: 300px;
}

#save-dialog.show {
    display: block;
}

.dialog-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
}

.dialog-backdrop.show {
    display: block;
}

.form-group {
    margin-bottom: 15px;
}

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

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Mermaidダイアグラム */
.mermaid * {
    font-size: 14px !important;
}

.mermaid text {
    font-size: 14px !important;
}

/* 印刷時のスタイル */
@media print {
    .editor-container {
        display: block !important;
    }
    
    #markdown-input,
    #print-button {
        display: none !important;
    }
    
    #html-output {
        width: 100% !important;
        height: auto !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        overflow: visible !important;
        font-size: 14pt !important;
    }
    
    #html-output h1 { font-size: 24pt !important; }
    #html-output h2 { font-size: 20pt !important; }
    #html-output h3 { font-size: 16pt !important; }
    #html-output h4 { font-size: 14pt !important; }
    #html-output h5 { font-size: 13pt !important; }
    #html-output h6 { font-size: 12pt !important; }
    
    #html-output code,
    #html-output pre {
        font-size: 12pt !important;
    }
    
    #html-output blockquote {
        font-size: 14pt !important;
    }
    
    .mermaid * {
        font-size: 14px !important;
    }

    .mermaid text {
        font-size: 14px !important;
    }
}