/* 全体のスタイル */
body {
    background-color: #f0f2f5;
}

/* ヘッダー */
header {
    border-bottom: 1px solid #dee2e6;
}

.logo-container img {
    max-height: 30px;
}

.current-time {
    font-size: 0.9rem;
    color: #666;
}

/* サイドバー */
.sidebar {
    min-height: calc(100vh - 60px);
    border-right: 1px solid #dee2e6;
    padding-top: 1rem;
    transition: all 0.3s ease;
}

.sidebar .list-group-item {
    border: none;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar .list-group-item.active {
    background-color: dodgerblue;
    border-color: dodgerblue;
}

/* 閉じるボタン（モバイル用サイドバー制御） */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: dodgerblue;
    color: white;
    border: none;
    font-size: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    cursor: pointer;
}

/* 共通コンテナ */
.container-fluid {
    padding: 1rem;
}

/* 共通のカード */
.card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-header {
    /*background-color: #f8f9fa;*/
    background-color: rgb(206, 235, 245);
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* 共通フォーム要素 */
.form-label {
    font-size: 0.9rem;
    color: #333;
    font-weight: 600;
}

.form-control, .form-select {
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 16px; /* iOS自動ズーム防止のため16px以上に設定 */
}

.form-control:focus, .form-select:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* すべての入力要素のフォントサイズをiOS対応 */
input, textarea, select {
    font-size: 16px !important;
}

/* 共通ボタン */
.btn {
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.btn-success {
    background-color: #28a745;
    border-color: #28a745;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #218838;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #c82333;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* 共通テーブル */
.table {
    font-size: 0.9rem;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    border-top: none;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
}

.table td {
    vertical-align: middle;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 200px;
}

.table-responsive {
    border-radius: 4px;
}

/* 総件数（共通） */
.totalRows {
    min-width: 140px;
    white-space: nowrap;
    margin-right: 0.5rem;
}

/* パスワード入力欄のアイコン（共通） */
.password-field-container {
    position: relative;
}

.password-toggle-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #6c757d;
    z-index: 10;
}

.password-toggle-icon:hover {
    color: #343a40;
}

/* 共通のアラート */
.alert {
    border-radius: 4px;
    font-size: 0.9rem;
}

/* 共通のモーダル */
.modal-content {
    border-radius: 8px;
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
}

/* エラーメッセージ共通 */
.error-message {
    color: #e53935;
    font-weight: 500;
    min-height: 20px;
}

.text-danger {
    color: #dc3545 !important;
}

/* 成功メッセージ共通 */
.text-success {
    color: #28a745 !important;
}

/* 共通のレスポンシブ対応（768px以下） */
@media (max-width: 768px) {
    /* サイドバーのレスポンシブ対応 */
    .sidebar-toggle {
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .sidebar {
        position: fixed;
        left: -100%;
        top: 60px;
        width: 250px !important;
        height: calc(100% - 60px);
        z-index: 1001;
        background-color: #fff;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        min-height: auto;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    main.col-10 {
        width: 100% !important;
        margin-left: 0 !important;
        flex: 0 0 100%;
        max-width: 100%;
        transition: margin-left 0.3s ease;
    }
    
    /* 共通のレスポンシブ調整 */
    .container-fluid {
        padding: 0.75rem 0.5rem;
    }
    
    .card-body {
        padding: 1rem 0.75rem;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
    
    .fs-5 {
        font-size: 1rem !important;
    }
    
    /* フォーム要素のレスポンシブ */
    .form-label {
        font-size: 0.85rem;
    }
    
    /* ボタンのレスポンシブ */
    .btn {
        font-size: 0.85rem;
        padding: 0.375rem 0.75rem;
    }
    
    .btn-sm {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* テーブルのスクロール対応 */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table td {
        max-width: 150px;
    }
    
    /* モーダルのレスポンシブ */
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
      /* 検索メニューのボタン配置（モバイル対応） */
    .card-body .d-flex.justify-content-between,
    .card .d-flex.justify-content-between {
        flex-direction: column !important;
        gap: 1rem;
        align-items: stretch;
    }
    
    .card-body .d-flex.justify-content-between > div,
    .card .d-flex.justify-content-between > div {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
        width: 100%;
    }
    
    /* 新規追加・CSVダウンロードボタンを上に配置 */
    .card-body .d-flex.justify-content-between > div:last-child,
    .card .d-flex.justify-content-between > div:last-child {
        order: 1;
    }
    
    /* 検索・リセットボタンを下に配置 */
    .card-body .d-flex.justify-content-between > div:first-child,
    .card .d-flex.justify-content-between > div:first-child {
        order: 2;
    }
    
    /* mt-3クラスがついている検索ボタンエリアも対応 */
    .mt-3.d-flex.justify-content-between {
        flex-direction: column !important;
        gap: 1rem;
        margin-top: 1rem !important;
    }
    
    .mt-3.d-flex.justify-content-between > div {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
        width: 100%;
    }
    
    .mt-3.d-flex.justify-content-between > div:last-child {
        order: 1;
    }
    
    .mt-3.d-flex.justify-content-between > div:first-child {
        order: 2;
    }
      /* 検索フォーム内のボタンサイズ調整 */
    .card .btn {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
        white-space: nowrap;
        min-width: 120px;
        flex: 1;
        max-width: 200px;
    }
    
    .card .btn .bi {
        margin-right: 0.25rem;
    }
    
    /* 検索・リセットボタンの特別なスタイル */
    .card .btn-primary,
    .card .btn-secondary {
        margin-bottom: 0.25rem;
    }
    
    /* 新規追加・CSVダウンロードボタンの特別なスタイル */
    .card .btn-success {
        margin-bottom: 0.25rem;
    }
    
    /* モバイル時の検索条件フォームの調整 */
    .card .row.g-3 > div {
        margin-bottom: 0.75rem;
    }
    
    .card .form-label {
        margin-bottom: 0.25rem;
        font-size: 0.9rem;
    }
    
    .card .form-control, .card .form-select {
        font-size: 0.9rem;
    }
    
    /* input-group内の検索ボタンの調整 */
    .card .input-group .btn {
        min-width: auto;
        flex: 0 0 auto;
        max-width: none;
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }
    
    /* ユーザー選択コンテナの調整 */
    .user-select-container {
        width: 100%;
    }
    
    .user-select-container .d-flex {
        /*flex-direction: column;*/
        gap: 0.5rem;
    }
    
    .user-select-container .form-control,
    .user-select-container .btn {
        width: 100%;
    }
    
    /* 検索条件フォームのinput-groupの調整 */
    .card .input-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .card .input-group .form-select,
    .card .input-group .form-control {
        border-radius: 0.375rem !important;
        border: 1px solid #ced4da !important;
    }
    
    .card .input-group .btn {
        border-radius: 0.375rem !important;
        border-top-left-radius: 0.375rem !important;
        border-bottom-left-radius: 0.375rem !important;
    }
}

/* デスクトップ用のスタイル（768px以上） */
@media (min-width: 769px) {
    /* input-groupの通常スタイルを維持 */
    .card .input-group {
        flex-direction: row;
        gap: 0;
    }
    
    .card .input-group .form-select,
    .card .input-group .form-control {
        border-top-right-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }
    
    .card .input-group .btn {
        border-top-left-radius: 0 !important;
        border-bottom-left-radius: 0 !important;
        border-left: 0;
    }
    
    .user-select-container .d-flex {
        flex-direction: row;
        gap: 0;
    }
    
    .user-select-container .form-control,
    .user-select-container .btn {
        width: auto;
    }
}

/* 追加のモバイル対応 */
@media (max-width: 768px) {
    /* メインコンテンツエリアの調整 */
    main.col-10.ms-auto {
        margin-left: 0 !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    /* カードヘッダーのタイトル調整 */
    .card-header h5.mb-0 {
        font-size: 0.95rem;
        margin-bottom: 0 !important;
    }
    
    /* 全体的なスペーシング調整 */
    .container-fluid .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    /* フォームコントロールの基本サイズ統一 */
    .form-control,
    .form-select {
        font-size: 0.85rem;
        /*padding: 0.375rem 0.5rem;*/
        line-height: 1.5;
    }
    
    /* Bootstrapのカラムクラスをモバイルで強制的に100%幅にする */
    .col-md-3,    
    .col-md-6,
    .col-lg-4 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        margin-bottom: 0.75rem;
    }
    
    .col-lg-4:last-child {
        margin-bottom: 0;
    }

    /* 検索付きプルダウンのinput-groupを8:2の割合で1行配置 */
    .card .input-group {
        flex-direction: row !important;
        gap: 0 !important;
    }
    
    /* プルダウン部分を80%幅に設定 */
    .card .input-group .form-select {
        flex: 0 0 80% !important;
        max-width: 80% !important;
        border-top-right-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        border-right: 0 !important;
    }
    
    /* 検索ボタンを20%幅に設定 */
    .card .input-group .btn {
        flex: 0 0 20% !important;
        max-width: 20% !important;
        border-top-left-radius: 0 !important;
        border-bottom-left-radius: 0 !important;
        border-left: 0 !important;
        font-size: 0.8rem !important;
        padding: 0.375rem 0.25rem !important;
    }
    
    /* 検索ボタンのアイコンのみ表示（テキストは非表示） */
    .card .input-group .btn .bi {
        margin-right: 0 !important;
    }
}

/* ========================================
   iOS自動ズーム防止
   ======================================== */

/* すべての入力要素にiOS対応のフォントサイズを適用 */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
textarea,
select {
    font-size: 16px !important;
}

/* 特定のクラスも対象に含める */
.form-control,
.form-select {
    font-size: 16px !important;
}

/* 検索入力フィールド */
input[type="search"] {
    -webkit-appearance: none;
    appearance: none;
    font-size: 16px !important;
}