/* マニュアル管理システム CSS */

.dashboard-section {
    margin-bottom: 2rem;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
}

.recent-updates {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.recent-updates h3 {
    margin-bottom: 1rem;
}

.navigation-section {
    margin-bottom: 2rem;
}

.navigation-container {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.company-list,
.category-list,
.manual-list {
    flex: 1;
    min-width: 250px;
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.company-item,
.category-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #f5f5f5;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, border 0.2s;
    border: 2px solid transparent;
}

.company-item:hover,
.category-item:hover {
    background: #e0e0e0;
}

.company-item.selected,
.category-item.selected {
    background: #007bff;
    color: white;
    border-color: #0056b3;
    font-weight: bold;
}

.manual-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.manual-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.manual-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    border-color: #007bff;
}

.manual-card h4 {
    margin-bottom: 0.5rem;
    color: #333;
}

.manual-card .meta {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.manual-card .meta.location-info {
    color: #28a745;
    font-weight: 500;
}

.manual-card .actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.manual-card .btn-edit,
.manual-card .btn-delete {
    padding: 0.25rem 0.75rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.manual-card .btn-edit {
    background: #007bff;
    color: white;
}

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

.btn-create {
    padding: 0.5rem 1rem;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

.btn-create:hover {
    background: #218838;
}

.search-section {
    margin-bottom: 2rem;
}

.search-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.search-container input,
.search-container select {
    flex: 1;
    min-width: 150px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.search-container button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: #007bff;
    color: white;
}

.search-container button:hover {
    background: #0056b3;
}

.search-help {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.manual-list-flat {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* モーダル */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #ddd;
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
    border-radius: 8px 8px 0 0;
}

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    position: sticky;
    top: 0;
    z-index: 11;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.form-group {
    margin-bottom: 1rem;
}

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 会社・カテゴリ横並びコンパクト表示 */
.form-row-compact {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group-compact {
    flex: 1;
    min-width: 0;
}

.form-group-compact label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: bold;
    font-size: 0.85rem;
    color: #666;
}

.form-group-compact select {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.form-group-compact #btn-add-category {
    padding: 0.4rem 0.6rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
}

.form-group-compact #btn-add-category:hover {
    background: #5a6268;
}

#manual-content-editor {
    min-height: 300px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* エディタ下部のフローティングバー */
.editor-footer-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    position: sticky;
    bottom: 0;
    background: white;
    padding: 1rem;
    border-top: 1px solid #ddd;
    margin: 0 -1.5rem -1.5rem -1.5rem;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    z-index: 20;
}

.editor-footer-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.editor-footer-left label {
    font-weight: bold;
    white-space: nowrap;
    margin: 0;
}

.editor-footer-left select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 150px;
}

.editor-footer-right {
    display: flex;
    gap: 0.5rem;
}

.editor-footer-right button {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

#btn-save-manual {
    background: #007bff;
    color: white;
}

#btn-save-manual:hover {
    background: #0056b3;
}

#btn-cancel-manual {
    background: #6c757d;
    color: white;
}

#btn-cancel-manual:hover {
    background: #5a6268;
}

.manual-meta {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
    font-size: 0.9rem;
    color: #666;
}

.manual-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
    position: sticky;
    bottom: 0;
    background: white;
    padding: 1rem 0;
    border-top: 1px solid #ddd;
    z-index: 10;
}

.manual-actions button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: #007bff;
    color: white;
}

.manual-actions button:hover {
    background: #0056b3;
}

.version-item {
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: #f5f5f5;
    border-radius: 4px;
    cursor: pointer;
}

.version-item:hover {
    background: #e0e0e0;
}

.version-item.selected {
    background: #007bff;
    color: white;
}

.template-item {
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: #f5f5f5;
    border-radius: 4px;
    cursor: pointer;
}

.template-item:hover {
    background: #e0e0e0;
}

/* Quill エディタのカスタマイズ */
#manual-content-editor {
    position: relative;
}

.ql-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: white;
    border-top: 1px solid #ccc;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ql-container {
    border-bottom: 1px solid #ccc;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    min-height: 300px;
    max-height: 600px;
    overflow-y: auto;
}

.ql-editor {
    min-height: 300px;
}

/* Quill ツールバーボタンのアクティブ状態を視覚的に改善 */
.ql-toolbar .ql-formats button.ql-active,
.ql-toolbar .ql-formats button:hover {
    background-color: #e8f4fd !important;
}

.ql-toolbar .ql-formats button.ql-active {
    background-color: #007bff !important;
    color: white !important;
}

.ql-toolbar .ql-formats button.ql-active svg {
    fill: white !important;
    stroke: white !important;
}
