/* Bulma の読み込み（ローカル同梱＝外部CDN依存を排除） */
@import url('vendor/bulma.min.css');

/* フォント（ローカル同梱）: Inter latin サブセット ＋ Material Symbols Outlined
   （ナビ10アイコンのみのサブセット・約15KB。CHeader が span.material-symbols-outlined を使用）。
   外部 Google Fonts への依存を排除＝全ページの描画ブロックを解消。 */
@import url('vendor/fonts/fonts.css');

/* 旧デザイン画面互換デザインCSS */
@import url('legacy.css');

/* カラーテーマ v2 - モダンIndigo/Slate */
:root {
    --primary: #4F46E5 !important;
    --primary-light: #6366F1 !important;
    --primary-dark: #3730A3 !important;
    --link: #4F46E5 !important;
    --link-hover: #3730A3 !important;
    --info: #0EA5E9 !important;
    --info-light: #38BDF8 !important;
    --info-dark: #0284C7 !important;
}

/* デザインシステム v2 */
:root {
    --primary-blue: #4F46E5;
    --hover-blue: #6366F1;
    --primary-blue-rgb: 79, 70, 229;
    --link-red: var(--danger);
    --hover-red: var(--danger-dark);
    --border-color: #E2E8F0;
    --background-light: #F8FAFC;
    --text-dark: #1E293B;
    --text-secondary: #64748B;
    --surface: #FFFFFF;
    --surface-hover: #F1F5F9;
    --success: #10B981;
    --warning: #F59E0B;
    --danger-v2: #EF4444;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Noto Sans JP', 'Meiryo UI', Meiryo, 'Segoe UI', system-ui, -apple-system, sans-serif !important;
    font-size: 100%;
    color: var(--text-dark);
    background-color: #F1F5F9;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.sectionTitle {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.75rem 1.25rem;
    margin: 1rem 0 0.5rem 0;
    color: var(--text-dark);
    position: relative;
    display: flex;
    align-items: center;
    border-left: 4px solid var(--primary-blue);
    background: var(--background-light);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* グラフコンテナのスタイル調整 */
#chart_div_monthly,
#chart_div_monthly_c,
#chart_div_monthly_p {
    margin: 0.5rem 0 1.5rem 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

/* 検索フォームのスタイル */
.infoSearchTable {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--background-light);
    margin: 20px 0;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border-collapse: collapse;
}

.infoSearchTable td {
    padding: 12px;
    vertical-align: middle;
    background: var(--surface);
    border: none;
}

.infoSearchTable tr {
    border: none;
}

/* 検索フォーム内の区切り線のスタイル */
.search-filters tr:not(:last-child) td {
    position: relative;
}

.search-filters tr:not(:last-child) td::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 12px;
    right: 12px;
    height: 1px;
    background: var(--border-color);
    opacity: 0.5;
}

/* 検索フォーム（ボタン配置部分）のスタイル */
.action-buttons td {
    padding: 16px !important;
    background: transparent !important;
}

.action-buttons {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* 現在の月のスタイル */
.infoSearchTable td.current-month {
    background: var(--primary-blue) !important;
}

.infoSearchTable td.current-month a {
    background: transparent;
    color: #FFFFFF;
    border-color: transparent;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(var(--primary-blue-rgb), 0.2);
}

.infoSearchTable td.current-month a:hover {
    background: var(--hover-blue);
    transform: translateY(-1px);
}

/* フォーム要素のスタイル */
input[type="text"],
input[type="tel"],
input[type="password"],
input[type="select"] {
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: all 0.2s ease;
    color: var(--text-dark);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="select"]:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(var(--primary-blue-rgb), 0.1);
    background: var(--surface);
}

/* 数値入力フィールドの共通スタイル */
.input_price,
.input_quantity {
    -moz-appearance: textfield;
    /* Firefox */
    appearance: textfield;
    text-align: right;
}

/* 数値入力の上下矢印を非表示 */
.input_price::-webkit-outer-spin-button,
.input_price::-webkit-inner-spin-button,
.input_quantity::-webkit-outer-spin-button,
.input_quantity::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* セレクトボックスの基本スタイルを統一 */
select,
.select select,
.textarea {
    width: 100% !important;
    max-width: 400px !important;
    min-width: auto !important;
    /* Bulmaの指定を上書き */
}

/* Bulmaのセレクトコンテナ */
.select {
    width: 100% !important;
    max-width: 400px !important;
    min-width: auto !important;
    /* Bulmaの指定を上書き */
    display: inline-block;
    position: relative;
}

/* カスタム矢印スタイルを統一 */
.select::after,
select+.select-arrow {
    content: '';
    position: absolute;
    right: 1.125em;
    top: 50%;
    transform: translateY(-50%) rotate(-45deg);
    width: 0.625em;
    height: 0.625em;
    border: 2px solid var(--primary-blue);
    border-top: 0;
    border-right: 0;
    pointer-events: none;
    z-index: 4;
}

/* フォーカス時のスタイル統一 */
select:focus,
.select select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(70, 161, 251, 0.1);
    background-color: #fff;
    outline: none;
}

/* ボタンのスタイル */
input[type="button"] {
    height: 36px;
    padding: 0 20px;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

/* プライマリボタン */
input[type="button"].btn-primary {
    background-color: var(--primary-blue);
    color: #fff;
}

input[type="button"].btn-primary:hover {
    background: var(--hover-blue);
    box-shadow: 0 2px 4px rgba(var(--primary-blue-rgb), 0.2);
}

/* デンジャーボタン */
input[type="button"].btn-danger {
    background-color: var(--danger-v2);
    color: #fff;
}

input[type="button"].btn-danger:hover {
    background-color: #DC2626;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

/* セカンダリボタン */
input[type="button"].btn-secondary {
    background-color: var(--surface);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

input[type="button"].btn-secondary:hover {
    background-color: var(--surface-hover);
    box-shadow: var(--shadow-sm);
}

/* チェックボックスのスタイル */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #94A3B8;
    border-radius: 4px;
    margin: 0 8px 0 0;
    position: relative;
    cursor: pointer;
    vertical-align: middle;
    transition: all 0.15s ease;
}

input[type="checkbox"]:checked {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

input[type="checkbox"]:hover {
    border-color: var(--primary-blue);
}

input[type="checkbox"]:focus {
    box-shadow: 0 0 0 3px rgba(var(--primary-blue-rgb), 0.15);
    outline: none;
}

/* ラジオボタンのスタイル */
.radio-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.radio-group label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #94A3B8;
    border-radius: 50%;
    margin-right: 0.5rem;
    position: relative;
    cursor: pointer;
    vertical-align: middle;
    transition: all 0.15s ease;
}

input[type="radio"]:checked {
    border-color: var(--primary-blue);
}

input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary-blue);
}

input[type="radio"]:hover {
    border-color: var(--primary-blue);
}

input[type="radio"]:focus {
    box-shadow: 0 0 0 3px rgba(var(--primary-blue-rgb), 0.15);
    outline: none;
}

/* ラジオボタンの無効化状態のスタイル */
.radio-label.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #6c757d;
}

.radio-label.is-disabled input[type="radio"] {
    cursor: not-allowed;
    border-color: #6c757d;
}

.radio-label.is-disabled input[type="radio"]:hover {
    border-color: #6c757d;
}

/* 営業ステータスのチェックボックス用スタイル */
input[name="search_sasalesstatus"] {
    margin-right: 4px;
    margin-left: 12px;
}

input[name="search_sasalesstatus"]:first-of-type {
    margin-left: 0;
}

/* 入力不可状態のスタイル */
input:disabled,
select:disabled,
textarea:disabled {
    background-color: #f5f5f5 !important;
    cursor: not-allowed;
    opacity: 0.7;
}

/* レスポンシブ対応 */
@media screen and (max-width: 768px) {
    .chart-container {
        padding: 10px;
        height: 300px;
    }

    .pageTitle {
        font-size: 1.5rem;
        padding: 0.75rem 1rem;
    }

    .pageTitleBelow {
        font-size: 0.8125rem;
        padding: 0.25rem 1rem;
    }

    .sectionTitle {
        font-size: 1.25rem;
        padding: 0.5rem 1rem;
    }

    .infoSearchTable td {
        padding: 8px;
    }

    input[type="text"],
    input[type="password"] {
        width: 100%;
        box-sizing: border-box;
    }
}

/* 警告・注意表示 */
.attention {
    color: var(--danger-v2);
    font-weight: 500;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.warning {
    background: #FFFBEB;
    padding: 10px 14px;
    border-left: 4px solid var(--warning);
    border-radius: var(--radius-sm);
    color: #92400E;
}

/* ユーティリティクラス（既存を維持） */
.hideClass {
    display: none;
}

.noWrap {
    white-space: nowrap;
}

/* フッターのスタイル更新 */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    padding: 0;
    background-color: var(--surface);
    color: var(--text-dark);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    padding: 0.5rem 0;
    min-height: 40px;
}

.info-register-box {
    max-width: 1200px;
    margin: 0 auto;
}

.info-register-box .label {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.info-register-box .columns {
    justify-content: center;
    margin: 0;
    align-items: center;
}

.info-register-box .button {
    min-width: 90px;
    transition: all 0.3s ease;
}

/* フッター内のボタンスタイル */
.info-register-box .current-month .button {
    background-color: var(--primary-blue);
    color: white;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
}

.info-register-box .button.is-light {
    background-color: var(--surface);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

/* モバイル対応 */
@media screen and (max-width: 768px) {
    .footer {
        padding: 0.75rem;
    }

    .info-register-box .button {
        min-width: 70px;
        padding: 0.5rem;
        font-size: 0.875rem;
    }

    .info-register-box input[type="month"] {
        min-width: 160px;
    }

}

/* メインコンテンツのスペーシング調整 */
.section {
    margin-top: 210px;
    /* ヘッダーの高さ分 */
    padding-bottom: 50px;
    /* フッターの高さ分を調整 */
}

/* 後方互換性のため */
.wrapthis {
    margin-top: 300px;
    /* ヘッダーの高さ分 */
}

/* ボタンの基本スタイル更新 */
input[type="button"] {
    background-color: var(--primary-blue);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 18px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* ホバー時のエフェクト */
input[type="button"]:hover {
    background-color: var(--primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* アクティブ（クリック）時のエフェクト */
input[type="button"]:active {
    background-color: var(--primary-dark);
    box-shadow: var(--shadow-sm);
    transform: translateY(0);
}

/* 削除ボタン用のスタイル */
input[type="button"][value*="削除"] {
    background-color: var(--danger-v2);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

input[type="button"][value*="削除"]:hover {
    background-color: #DC2626;
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.25);
}

/* 有効・無効切り替えボタン用のスタイル */
input[type="button"][value*="有効"],
input[type="button"][value*="無効"] {
    background-color: #64748B;
    box-shadow: 0 2px 4px rgba(100, 116, 139, 0.2);
}

input[type="button"][value*="有効"]:hover,
input[type="button"][value*="無効"]:hover {
    background-color: #475569;
    box-shadow: 0 4px 8px rgba(100, 116, 139, 0.25);
}

/* ページネーション関連のスタイル調整 */
.level-right {
    flex: 1;
    min-width: 0;
    padding-right: 0;
    /* 右側のpaddingを削除 */
}

.level-right .pagination {
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-right: 0;
    /* 右側のmarginを削除 */
    padding-right: 0;
    /* 右側のpaddingを削除 */
}

.pagination-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0;
    padding-right: 0;
}

.pagination-link {
    margin-right: 0;
}

/* モバイル: ドロップダウン表示、ボタン非表示 */
.pagination-mobile {
    display: none;
}

@media screen and (max-width: 768px) {
    .level.pagination-wrapper {
        flex-direction: column;
        gap: 0.5rem;
    }

    .level-right {
        width: 100%;
        margin-top: 0.5rem;
    }

    .level-right .pagination {
        justify-content: center;
    }

    .pagination-desktop {
        display: none !important;
    }

    .pagination-mobile {
        display: inline-block;
    }
}

#formErrors {
    margin-top: 15px;
    display: none;
    background-color: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 1em;
  }
  .valid-error {
    border: 1px solid var(--danger-v2) !important;
  }

  .is-hidden {
    display: none;
}