/* =========================================================
   Jimoto Medical Standalone
   ダッシュボードCSSと競合しない独立クラス設計
========================================================= */

.jm-medical-section {
    margin: 24px 0;
    padding: 20px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.08);
    box-sizing: border-box;
}

.jm-medical-header {
    margin-bottom: 16px;
}

.jm-medical-label {
    display: inline-block;
    margin: 0 0 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef5ff;
    color: #00377F;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
}

.jm-medical-title {
    font-size: 22px;
    font-weight: 800;
    color: #222;
    line-height: 1.4;
}

.jm-medical-lead {
    margin: 8px 0 0;
    color: #555;
    line-height: 1.7;
}

.jm-medical-toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px 18px;
    margin: 16px 0;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #dbe5f2;
    border-radius: 12px;
    box-sizing: border-box;
}

.jm-medical-toolbar-label {
    font-weight: 800;
    color: #333;
    line-height: 2.4;
}

.jm-medical-sort-buttons,
.jm-medical-category-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.jm-medical-sort-btn,
.jm-medical-category-btn {
    border: none;
    border-radius: 999px;
    padding: 8px 14px;
    background: #e8eef7;
    color: #00377F;
    font-weight: 800;
    cursor: pointer;
    line-height: 1.5;
}

.jm-medical-sort-btn.is-active,
.jm-medical-category-btn.is-active {
    background: #00377F;
    color: #fff;
}

.jm-medical-output {
    min-height: 40px;
}

.jm-medical-loading,
.jm-medical-error,
.jm-medical-empty,
.jm-medical-cache-note {
    padding: 12px;
    border-radius: 12px;
    background: #f8fafc;
    color: #444;
    line-height: 1.6;
}

.jm-medical-cache-note {
    margin-bottom: 12px;
    font-size: 13px;
    background: #f0fdf4;
    color: #166534;
}

.jm-medical-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
}

.jm-medical-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    box-sizing: border-box;
}

.jm-medical-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(0,0,0,0.06);
    border-color: #cbd5e1;
}

.jm-medical-card-title {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.5;
    color: #222;
}

.jm-medical-category-tag {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin: 0 0 10px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef5ff;
    color: #00377F;
    font-size: 12px;
    font-weight: 800;
}

.jm-medical-meta {
    margin: 0;
    padding: 0;
    list-style: none;
    color: #444;
    line-height: 1.85;
    font-size: 14px;
}

.jm-medical-meta a {
    color: #00377F;
    font-weight: 700;
    text-decoration: none;
}

.jm-medical-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
}

.jm-medical-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 999px;
    background: #eef5ff;
    color: #00377F;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.jm-medical-action-link:hover {
    background: #dbeafe;
    color: #00295f;
    text-decoration: none;
}

/* モーダル内でも病院プラグイン自身のCSSだけで2列表示を維持 */
.jimoto-modal-body .jm-medical-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

@media (max-width: 760px) {
    .jm-medical-section {
        padding: 16px;
    }

    .jm-medical-toolbar {
        display: block;
    }

    .jm-medical-toolbar-label {
        margin: 8px 0 6px;
        line-height: 1.6;
    }

    .jm-medical-sort-buttons,
    .jm-medical-category-buttons {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: stretch;
        gap: 8px;
    }

    .jm-medical-sort-btn,
    .jm-medical-category-btn {
        width: 100%;
        padding: 10px 12px;
    }

    .jm-medical-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .jm-medical-action-link {
        text-align: center;
    }
}

@media (max-width: 520px) {
    .jm-medical-list,
    .jimoto-modal-body .jm-medical-list {
        grid-template-columns: 1fr;
    }
}
