/**
 * Bootstrap風統一テーマ - 読んで (Yonde)
 * 全てのPHPページで使用される共通スタイル
 */

/* ===== ベースリセット ===== */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #212529;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
}

/* ===== コンテナシステム ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.container-fluid {
    width: 100%;
    padding: 0 15px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col {
    flex: 1;
    padding: 0 15px;
}

.col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 0 15px;
}

.col-md-8 {
    flex: 0 0 66.666667%;
    max-width: 66.666667%;
    padding: 0 15px;
}

.col-md-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
    padding: 0 15px;
}

/* ===== カード ===== */
.card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card-header {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 15px 20px;
    font-weight: 600;
    color: #495057;
    border-radius: 8px 8px 0 0;
}

.card-body {
    padding: 20px;
}

.card-footer {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 15px 20px;
    border-radius: 0 0 8px 8px;
}

.card-title {
    margin: 0 0 15px 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
}

.card-text {
    color: #6c757d;
    margin-bottom: 10px;
}

/* ===== ボタン ===== */
.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 8px 16px;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 4px;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
    text-decoration: none;
    color: #212529;
}

.btn:hover {
    text-decoration: none;
    /* transform: translateY(-1px); */ /* 重複削除 - cmn.cssで統一 */
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

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

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

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

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

.btn-success {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

.btn-success:hover {
    background: #1e7e34;
    border-color: #1e7e34;
    color: white;
}

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

.btn-danger:hover {
    background: #bd2130;
    border-color: #bd2130;
    color: white;
}

.btn-warning {
    background: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #d39e00;
    border-color: #d39e00;
    color: #212529;
}

.btn-info {
    background: #17a2b8;
    border-color: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #117a8b;
    border-color: #117a8b;
    color: white;
}

.btn-light {
    background: #f8f9fa;
    border-color: #f8f9fa;
    color: #212529;
}

.btn-light:hover {
    background: #dae0e5;
    border-color: #dae0e5;
    color: #212529;
}

.btn-dark {
    background: #343a40;
    border-color: #343a40;
    color: white;
}

.btn-dark:hover {
    background: #1d2124;
    border-color: #1d2124;
    color: white;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 3px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 6px;
}

/* ===== フォーム ===== */
.form-control {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #495057;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 4px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

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

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 16px 12px;
    padding-right: 32px;
}

/* ===== テーブル ===== */
.table {
    width: 100%;
    margin-bottom: 20px;
    background: transparent;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px;
    vertical-align: top;
    border-bottom: 1px solid #dee2e6;
    text-align: left;
}

.table th {
    font-weight: 600;
    color: #495057;
    background: #f8f9fa;
}

.table-striped tbody tr:nth-of-type(odd) {
    background: rgba(0, 0, 0, 0.05);
}

.table-hover tbody tr:hover {
    background: rgba(0, 0, 0, 0.075);
}

/* ===== アラート ===== */
.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-success {
    color: #155724;
    background: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background: #f8d7da;
    border-color: #f5c6cb;
}

.alert-warning {
    color: #856404;
    background: #fff3cd;
    border-color: #ffeaa7;
}

.alert-info {
    color: #0c5460;
    background: #d1ecf1;
    border-color: #bee5eb;
}

/* ===== バッジ ===== */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 12px;
}

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

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

.badge-success {
    color: white;
    background: #28a745;
}

.badge-danger {
    color: white;
    background: #dc3545;
}

.badge-warning {
    color: #212529;
    background: #ffc107;
}

.badge-info {
    color: white;
    background: #17a2b8;
}

/* ===== ナビゲーション ===== */
.navbar {
    background: white;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 10px 0;
    margin-bottom: 20px;
}

.nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
}

.nav-item {
    margin-right: 10px;
}

.nav-link {
    display: block;
    padding: 8px 16px;
    text-decoration: none;
    color: #495057;
    border-radius: 4px;
    transition: all 0.15s ease-in-out;
}

.nav-link:hover {
    color: #007bff;
    background: #f8f9fa;
    text-decoration: none;
}

.nav-link.active {
    color: #007bff;
    font-weight: 600;
}

/* ===== ページネーション ===== */
.pagination {
    display: flex;
    padding: 0;
    margin: 20px 0;
    border-radius: 4px;
    list-style: none;
}

.page-item {
    margin: 0 2px;
}

.page-link {
    position: relative;
    display: block;
    padding: 8px 12px;
    margin-left: -1px;
    line-height: 1.25;
    color: #007bff;
    text-decoration: none;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.page-link:hover {
    color: #0056b3;
    background: #e9ecef;
    border-color: #dee2e6;
    text-decoration: none;
}

.page-item.active .page-link {
    color: white;
    background: #007bff;
    border-color: #007bff;
}

/* ===== モーダル ===== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-dialog {
    position: relative;
    width: auto;
    max-width: 500px;
    margin: 20px;
}

.modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

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

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-body {
    padding: 20px;
}

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

/* ===== ユーティリティクラス ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-muted { color: #6c757d; }
.text-primary { color: #007bff; }
.text-success { color: #28a745; }
.text-danger { color: #dc3545; }
.text-warning { color: #ffc107; }
.text-info { color: #17a2b8; }

.bg-primary { background: #007bff; }
.bg-secondary { background: #6c757d; }
.bg-success { background: #28a745; }
.bg-danger { background: #dc3545; }
.bg-warning { background: #ffc107; }
.bg-info { background: #17a2b8; }
.bg-light { background: #f8f9fa; }
.bg-dark { background: #343a40; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.mb-5 { margin-bottom: 40px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mt-5 { margin-top: 40px; }

.p-0 { padding: 0; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.p-4 { padding: 32px; }
.p-5 { padding: 40px; }

.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }
.d-none { display: none; }

.justify-content-start { justify-content: flex-start; }
.justify-content-end { justify-content: flex-end; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }

.align-items-start { align-items: flex-start; }
.align-items-end { align-items: flex-end; }
.align-items-center { align-items: center; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* ===== レスポンシブ ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    .col-md-6,
    .col-md-8,
    .col-md-4 {
        flex: 1;
        max-width: 100%;
        margin-bottom: 20px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
}