/* ==============================
   全サイト共通スタイル
   ------------------------------
   ・基盤（body / a / button / メッセージ）
   ・サイト横断で使う汎用UI部品
     （ヘッダー / ボタン / テーブル / フォーム /
       詳細カード / ページネーション / ファイルDLリンク）
   管理者・パートナー・CTI DL・OTGUARDサポートの
   全サイトで読み込む。
============================== */

/* ------------------------------
   基盤
------------------------------ */

body {
    margin: 0;
    font-family: "Yu Gothic UI", "Meiryo", sans-serif;
    background: #f5f6f8;
    color: #333;
}

a {
    color: #1565c0;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button {
    cursor: pointer;
}

.error {
    color: #c62828;
    background: #ffebee;
    border: 1px solid #ef9a9a;
    padding: 10px;
    border-radius: 4px;
}

.description {
    line-height: 1.7;
}

/* ------------------------------
   サイトヘッダー
------------------------------ */

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 24px 32px;
    background: #fff;
    border-bottom: 1px solid #ddd;
}

.site-header h1 {
    margin: 0 0 6px;
    font-size: 26px;
}

.site-header p {
    margin: 0;
    color: #666;
}

.logout-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 120px;
    padding: 10px 16px;
    background: #555;
    color: #fff;
    border-radius: 6px;
    font-weight: bold;
    white-space: nowrap;
}

.logout-button:hover {
    background: #333;
    text-decoration: none;
}

.site-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px;
}

/* ------------------------------
   操作ボタン
------------------------------ */

.page-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.button-primary,
.button-secondary,
.button-danger {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 140px;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
    transition: .2s;
    box-sizing: border-box;
}

.button-primary {
    background: #1976d2;
    color: #fff;
    border: 1px solid #1976d2;
}

.button-primary:hover {
    background: #1565c0;
    border-color: #1565c0;
    text-decoration: none;
}

.button-secondary {
    background: #fff;
    color: #333;
    border: 1px solid #ccc;
}

.button-secondary:hover {
    background: #f5f5f5;
    text-decoration: none;
}

.button-danger {
    background: #c62828;
    color: #fff;
    border: 1px solid #c62828;
}

.button-danger:hover {
    background: #b71c1c;
    border-color: #b71c1c;
}

/* ------------------------------
   一覧テーブル
------------------------------ */

.table-wrap {
    overflow-x: auto;
}

.list-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.list-table th,
.list-table td {
    padding: 14px;
    border-bottom: 1px solid #ddd;
    text-align: left;
    vertical-align: middle;
}

.list-table th {
    background: #f5f6f8;
    font-weight: bold;
}

.list-table tr:hover {
    background: #fafafa;
}

.list-table .empty {
    color: #777;
    text-align: center;
}

/* ------------------------------
   詳細画面
------------------------------ */

.detail-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 24px;
}

.detail-card dl {
    margin: 0;
}

.detail-card dt {
    margin-top: 18px;
    font-weight: bold;
    color: #555;
}

.detail-card dt:first-child {
    margin-top: 0;
}

.detail-card dd {
    margin: 6px 0 0;
}

/* ------------------------------
   登録・編集フォーム
------------------------------ */

.edit-form {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 24px;
}

.form-row {
    margin-bottom: 20px;
}

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

.form-row input,
.form-row select,
.form-row textarea {
    width: 100%;
    max-width: 500px;
    padding: 11px;
    font-size: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    background: #fff;
}

.form-row textarea {
    min-height: 120px;
    resize: vertical;
}

.form-row-checkbox {
    margin-bottom: 20px;
}

.form-row-checkbox label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.form-row-checkbox input {
    max-width: 500px;
    padding: 11px;
    font-size: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    background: #fff;
}

.readonly-value {
    max-width: 500px;
    padding: 11px;
    background: #f5f6f8;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.form-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 30px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.check-label {
    display: block;
    margin: 6px 0;
    font-weight: normal;
}

.check-label input {
    width: auto;
    max-width: none;
    margin: 0 6px 0 0;
}

.search-form {
    margin-bottom: 24px;
}

.result-count {
    margin: 20px 0 12px;
    color: #555;
    font-size: 14px;
}

/* ------------------------------
   ページネーション
------------------------------ */

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}

.pagination a,
.pagination .current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    font-weight: bold;
}

.pagination a:hover {
    background: #f0f7ff;
    border-color: #90caf9;
    text-decoration: none;
}

.pagination .current {
    background: #1976d2;
    border-color: #1976d2;
    color: #fff;
}

/* ------------------------------
   ファイルダウンロードリンク
------------------------------ */

.file-download-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.file-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
}

/* ------------------------------
   メッセージ・補足
------------------------------ */

.notice {
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 6px;
    color: #795548;
}

.field-note,
.form-note {
    margin: 6px 0 0;
    font-size: 13px;
    color: #666;
}

/* ------------------------------
   レスポンシブ（共通部品）
------------------------------ */

@media (max-width: 768px) {

    .site-header {
        display: block;
        padding: 20px;
    }

    .site-header h1 {
        font-size: 22px;
    }

    .logout-button {
        width: 100%;
        margin-top: 16px;
        box-sizing: border-box;
    }

    .site-main {
        padding: 20px;
    }

    .page-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .page-actions a,
    .page-actions button {
        width: 100%;
    }

    .form-buttons {
        flex-direction: column;
    }

    .form-buttons button {
        width: 100%;
    }

    .list-table,
    .list-table thead,
    .list-table tbody,
    .list-table tr,
    .list-table th,
    .list-table td {
        display: block;
    }

    .list-table thead {
        display: none;
    }

    .list-table tr {
        margin-bottom: 16px;
        border: 1px solid #ddd;
        border-radius: 8px;
        overflow: hidden;
        background: #fff;
    }

    .list-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 16px;
        border-bottom: 1px solid #eee;
    }

    .list-table td:last-child {
        border-bottom: none;
    }

    .list-table td::before {
        content: attr(data-label);
        font-weight: bold;
        color: #666;
        flex-shrink: 0;
    }

    .detail-card,
    .edit-form {
        padding: 18px;
    }

    .form-row input,
    .form-row select,
    .form-row textarea,
    .readonly-value {
        max-width: 100%;
    }
}
