/* =========================================================================
   共通テーマ（AttendanceWebApp のデザインに準拠）
   -------------------------------------------------------------------------
   ★ 出所: AbicocoCoreWeb/wwwroot/css/theme.css からのコピー。
     配色トークンは theme-variables.css で定義。ここでは各コンポーネントの
     見た目のみを定義し、色はすべて var(--...) を参照します。
     → 色を変えたいときは theme-variables.css を編集してください。

   ★ 同期ルール: このファイルは AbicocoCoreWeb 側の正典のコピーです。
     見た目を変える場合は元（AbicocoCoreWeb/wwwroot/css/theme.css）も
     合わせて更新し、ドリフトさせないでください。
   ========================================================================= */

/* ===== ベース ===== */
body {
    font-family: var(--font-family-base);
    font-weight: 400;
    background: var(--bg-body);
    color: var(--text-secondary);
    font-size: 0.95rem;
}

p, div, span, td, th, li, label,
a:not(.btn):not(.navbar-brand):not(.nav-link):not(.dropdown-item) {
    color: var(--text-secondary);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
}

a {
    color: var(--primary-color);
}

a:hover {
    color: var(--primary-dark);
}

/* ===== ヘッダー & ナビゲーション ===== */
header {
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
    border-bottom: 3px solid var(--primary-color);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    margin-left: 0.5rem;
    margin-right: 0.5rem;
}

nav.navbar {
    background: transparent !important;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary-color);
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.navbar-brand:hover {
    color: var(--primary-dark);
    opacity: 0.9;
}

.navbar-nav .nav-item {
    margin: 0 0.15rem;
    position: relative;
}

.navbar-nav .nav-link {
    font-weight: 400;
    padding: 0.45rem 0.85rem !important;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.navbar-nav .nav-link:hover {
    background: var(--bg-section);
    color: var(--primary-color) !important;
}

.navbar-nav .nav-link.active {
    background: var(--bg-section);
    color: var(--primary-color) !important;
    font-weight: 600;
}

.navbar-toggler {
    border: 2px solid rgba(var(--primary-rgb), 0.5);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.2);
}

/* ドロップダウン */
.dropdown-menu {
    border: 1px solid var(--border-default);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    background: var(--bg-card);
    overflow: hidden;
    position: relative;
}

.dropdown-menu::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
}

.dropdown-item {
    padding: 0.55rem 1.25rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: var(--bg-section);
    color: var(--primary-color);
}

.dropdown-item.text-danger:hover {
    background: #fff5f5;
    color: var(--danger-color);
}

/* ===== 画面タイトル ===== */
.form-title {
    margin: 0 auto 1.5rem auto;
    padding: 1.2rem 0 0.4rem 0;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 1.6rem;
    position: relative;
    letter-spacing: 0.5px;
}

.form-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--border-light);
    border-radius: 2px;
}

/* ===== ボタン（Bootstrap の .btn-* を上書き） ===== */
.btn {
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: all 0.25s ease;
}

.btn:focus,
.btn:active:focus {
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.25);
}

.btn-primary,
.btn-primary:visited {
    color: #fff;
    background: var(--primary-color);
    border: none;
    box-shadow: 0 3px 8px rgba(var(--primary-rgb), 0.35);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    color: #fff;
    background: var(--primary-dark) !important;
    border: none;
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(var(--primary-rgb), 0.45);
}

.btn-secondary {
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 2px solid var(--border-default);
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active {
    color: var(--primary-color);
    background: var(--bg-section) !important;
    border-color: var(--primary-color) !important;
    transform: translateY(-2px);
}

.btn-outline-secondary {
    color: var(--text-secondary);
    border: 2px solid var(--border-default);
}

.btn-outline-secondary:hover {
    color: var(--primary-color);
    background: var(--bg-section);
    border-color: var(--primary-color);
}

.btn-danger {
    color: #fff;
    background: var(--danger-color);
    border: none;
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover,
.btn-danger:focus,
.btn-danger:active {
    color: #fff;
    background: var(--danger-dark) !important;
    border: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-sm {
    padding: 0.25rem 0.7rem;
    font-size: 0.8rem;
}

/* ===== フォームコントロール ===== */
.form-control,
.form-select {
    border: 2px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    background-color: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
}

.form-check-input {
    border: 2px solid var(--border-default);
    cursor: pointer;
}

.form-check-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.2);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ===== 入力エリア（フォームのセクション枠） ===== */
.input-area {
    background: var(--bg-card);
    padding: 1.6rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
    border: 1px solid var(--border-default);
    position: relative;
    overflow: hidden;
}

.input-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
}

.input-area-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border-light);
}

/* ===== 検索・絞り込みエリア ===== */
.search-condition-area {
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
}

.search-field-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: flex-end;
}

.search-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 200px;
    margin: 0;
}

.search-field-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ===== 操作ボタンエリア ===== */
.operation-btn-area {
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
}

.edit-operation-btn-area {
    margin-top: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

/* ===== テーブル ===== */
.table {
    border: none;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background-color: var(--bg-card);
}

.table thead {
    position: relative;
}

.table thead::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
    z-index: 1;
}

.table thead th {
    background: var(--bg-section);
    color: var(--text-primary);
    font-weight: 600;
    border-bottom: none;
    border-top: none;
    border-left: none;
    border-right: 1px solid var(--border-light);
    padding: 0.7rem 0.75rem;
    vertical-align: middle;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.table thead th:last-child {
    border-right: none;
}

.table tbody tr {
    transition: background 0.2s ease;
}

.table tbody tr:hover {
    background: var(--bg-section);
}

.table tbody td {
    padding: 0.6rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-right: 1px solid rgba(0, 0, 0, 0.02);
    font-size: 0.925rem;
    color: var(--text-secondary);
}

.table tbody td:last-child {
    border-right: none;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(var(--primary-rgb), 0.03);
}

.table-striped tbody tr:hover {
    background: var(--bg-section);
}

/* 空状態 */
.table-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 1.5rem 0;
}

/* ===== カード ===== */
.card {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
    overflow: hidden;
    position: relative;
}

.card-header {
    background: var(--bg-section);
    border-bottom: 1px solid var(--border-default);
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.85rem 1.25rem;
}

.card-body {
    padding: 1.25rem;
}

/* ===== バッジ ===== */
.badge {
    padding: 0.35rem 0.65rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    letter-spacing: 0.3px;
}

.badge-primary-soft {
    background: rgba(var(--primary-rgb), 0.12);
    color: var(--primary-dark);
}

/* ===== アラート ===== */
.alert {
    border: none;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    border-left: 5px solid;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background: #e8f5e9;
    border-left-color: var(--success-color);
    color: #1b5e20;
}

.alert-info {
    background: #e3f2fd;
    border-left-color: var(--info-color);
    color: #0d47a1;
}

.alert-warning {
    background: #fff8e1;
    border-left-color: var(--warning-color);
    color: #7c4a03;
}

.alert-danger {
    background: #fdecea;
    border-left-color: var(--danger-color);
    color: #7f1d1d;
}

/* ===== フッター ===== */
.footer {
    color: var(--text-muted);
}

/* ===== ユーティリティ ===== */
.disabled-link {
    pointer-events: none;
    cursor: not-allowed;
    opacity: 0.6;
    text-decoration: none;
}

/* ===== レスポンシブ ===== */
@media (max-width: 768px) {
    .form-title {
        font-size: 1.3rem;
    }

    .search-field-group {
        flex-direction: column;
        gap: 1rem;
    }

    .search-field {
        width: 100%;
        min-width: 0;
    }

    .edit-operation-btn-area {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .input-area {
        padding: 1rem;
    }
}
