/* ===================================
   DVTV Timecard System v2.0 - Styles
   =================================== */

/* --- 共通 --- */
.dvtv-tc-wrap, .dvtv-settings-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    max-width: 100%;
}

/* --- ボタン --- */
.dvtv-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    color: #333;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.dvtv-btn:hover { background: #e8e8e8; }
.dvtv-btn-primary { background: #0073aa; border-color: #005a87; color: #fff; }
.dvtv-btn-primary:hover { background: #005a87; }
.dvtv-btn-lg { padding: 12px 28px; font-size: 15px; }

/* --- 出力ボタン --- */
.dvtv-btn-print { background: linear-gradient(135deg, #6366f1, #4f46e5); border-color: #4338ca; color: #fff; }
.dvtv-btn-print:hover { background: linear-gradient(135deg, #4f46e5, #4338ca); }
.dvtv-btn-excel { background: linear-gradient(135deg, #22c55e, #16a34a); border-color: #15803d; color: #fff; }
.dvtv-btn-excel:hover { background: linear-gradient(135deg, #16a34a, #15803d); }
.dvtv-btn-pdf { background: linear-gradient(135deg, #ef4444, #dc2626); border-color: #b91c1c; color: #fff; }
.dvtv-btn-pdf:hover { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.dvtv-btn-yayoi { background: linear-gradient(135deg, #f59e0b, #d97706); border-color: #b45309; color: #fff; }
.dvtv-btn-yayoi:hover { background: linear-gradient(135deg, #d97706, #b45309); }

/* --- フォーム --- */
.dvtv-tc-form, .dvtv-settings-form {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}
.dvtv-tc-form-modern {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    padding: 24px;
}
.dvtv-tc-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.dvtv-tc-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dvtv-tc-field label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 4px;
}
.dvtv-tc-field select, .dvtv-tc-field input {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    background: #fff;
}
.dvtv-tc-field select:focus, .dvtv-tc-field input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.dvtv-icon { font-style: normal; }

/* --- 計算基準切替 --- */
.dvtv-tc-calc-mode-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
}
.dvtv-tc-toggle-btns {
    display: flex;
    gap: 4px;
}
.dvtv-toggle-btn {
    padding: 8px 20px;
    border: 2px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.dvtv-toggle-btn:first-child { border-radius: 6px 0 0 6px; }
.dvtv-toggle-btn:last-child { border-radius: 0 6px 6px 0; }
.dvtv-toggle-btn.active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}
.dvtv-toggle-btn:hover:not(.active) {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.dvtv-tc-calc-mode-display {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}
.dvtv-tc-calc-mode-display strong {
    color: #0073aa;
}

/* --- アクションボタン --- */
.dvtv-tc-form-actions-center {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

/* --- 表示列設定 --- */
.dvtv-tc-columns-section {
    margin-top: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
}
.dvtv-tc-columns-section summary {
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 500;
    background: #f5f5f5;
    border-radius: 6px 6px 0 0;
}
.dvtv-tc-columns-section[open] summary {
    border-bottom: 1px solid #ddd;
}
.dvtv-tc-columns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 6px;
    padding: 12px;
}
.dvtv-tc-col-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: normal;
    font-size: 12px;
    white-space: nowrap;
}

/* --- 集計テーブル --- */
.dvtv-tc-header {
    margin-bottom: 12px;
}
.dvtv-tc-header h3 {
    margin: 4px 0;
    font-size: 16px;
}
.dvtv-tc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: #fff;
}
.dvtv-tc-table th, .dvtv-tc-table td {
    border: 1px solid #ccc;
    padding: 4px 6px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}
.dvtv-tc-table th {
    background: #f0f0f0;
    font-weight: 600;
    font-size: 11px;
}
.dvtv-tc-table .dvtv-genba-col {
    text-align: left;
    white-space: normal;
    max-width: 150px;
}

/* --- 休日行 --- */
.dvtv-row-holiday { background-color: #fff5f5 !important; }
.dvtv-row-holiday td { color: #c00; }

/* --- 届出あり表示 --- */
.dvtv-has-todoke {
    color: #0066cc;
    font-weight: bold;
}

/* --- サマリーテーブル --- */
.dvtv-tc-summary {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 12px;
}
.dvtv-tc-summary td {
    padding: 8px 10px;
    background: #e8f4fc;
    border: 1px solid #b3d7f0;
    white-space: nowrap;
}
.dvtv-tc-summary strong { color: #0073aa; }

/* --- 詳細セクション --- */
.dvtv-tc-details-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 2px dashed #ccc;
}
.dvtv-tc-details-section {
    flex: 1;
    min-width: 260px;
}
.dvtv-tc-details-section h4 {
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #0073aa;
    font-size: 14px;
}
.dvtv-tc-details-table {
    width: 100%;
    border-collapse: collapse;
}
.dvtv-tc-details-table th, .dvtv-tc-details-table td {
    border: 1px solid #e0e0e0;
    padding: 6px 8px;
    text-align: left;
    font-size: 12px;
}
.dvtv-tc-details-table th {
    background: #f9f9f9;
    width: 45%;
    font-weight: 500;
}

/* --- ボタン群 --- */
#dvtv-tc-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
}

/* --- 休憩時間表示（基本のみ=薄い、記録あり=濃い） --- */
.dvtv-break-basic {
    color: #aaa;
}
.dvtv-break-recorded {
    color: #333;
    font-weight: 600;
}

/* --- 現場ツールチップ --- */
.dvtv-genba-text {
    cursor: pointer;
    border-bottom: 1px dotted #666;
}
.dvtv-genba-text:hover { color: #0073aa; }

/* --- ダイアログ --- */
.dvtv-dialog {
    position: fixed;
    z-index: 10000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}
.dvtv-dialog-content {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}
.dvtv-dialog-close {
    position: absolute;
    top: 10px; right: 14px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    line-height: 1;
}
.dvtv-dialog-close:hover { color: #000; }
.dvtv-dialog h4 {
    margin: 0 0 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid #0073aa;
}
#dvtv-genba-dialog-text {
    white-space: pre-wrap;
    line-height: 1.6;
}

/* --- 設定ページ --- */
.dvtv-settings-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #0073aa;
}
.dvtv-user-select {
    min-width: 250px;
    padding: 8px 12px;
    font-size: 15px;
}
.dvtv-status {
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 4px;
}
.dvtv-status.loading { color: #666; background: #f0f0f0; }
.dvtv-status.success { color: #155724; background: #d4edda; }
.dvtv-status.error { color: #721c24; background: #f8d7da; }

.dvtv-settings-group {
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 12px;
    background: #fff;
}
.dvtv-settings-group summary {
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    background: linear-gradient(to bottom, #f8f8f8, #f0f0f0);
    border-radius: 6px 6px 0 0;
    user-select: none;
}
.dvtv-settings-group[open] summary {
    border-bottom: 1px solid #ddd;
}
.dvtv-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    padding: 14px;
}
.dvtv-settings-grid-dense {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.dvtv-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.dvtv-field label {
    font-size: 11px;
    color: #666;
    font-weight: 500;
}
.dvtv-input-time, .dvtv-input-date { width: 100%; max-width: 140px; }
.dvtv-input-number { width: 100%; max-width: 90px; }
.dvtv-input-text, .dvtv-input-select { width: 100%; }
.dvtv-input-checkbox { width: 18px; height: 18px; }

.dvtv-weekday-multi { display: flex; gap: 3px; flex-wrap: wrap; }
.dvtv-weekday-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: normal;
}
.dvtv-weekday-checkbox input { display: none; }
.dvtv-weekday-checkbox span { font-size: 12px; font-weight: 600; }
.dvtv-weekday-checkbox:hover { border-color: #0073aa; background: #f0f7ff; }
.dvtv-weekday-checkbox:has(input:checked) { background: #0073aa; border-color: #0073aa; color: #fff; }

.dvtv-money-wrap { display: flex; align-items: center; gap: 4px; }
.dvtv-input-money { width: 80px; text-align: right; }
.dvtv-money-unit { font-size: 11px; color: #666; }

.dvtv-settings-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

/* --- 印刷用 --- */
@media print {
    .dvtv-tc-form, .dvtv-settings-form, #dvtv-tc-buttons, .dvtv-tc-details-wrap { display: none !important; }
    .dvtv-tc-table { font-size: 9pt; }
    .dvtv-tc-table th, .dvtv-tc-table td { padding: 3px; }
    .dvtv-row-holiday { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* --- レスポンシブ --- */
@media (max-width: 768px) {
    .dvtv-tc-form-grid { grid-template-columns: repeat(2, 1fr); }
    .dvtv-settings-grid { grid-template-columns: repeat(2, 1fr); }
    .dvtv-tc-table { font-size: 10px; }
    .dvtv-tc-table th, .dvtv-tc-table td { padding: 3px; }
    .dvtv-tc-calc-mode-section { flex-direction: column; align-items: flex-start; }
    #dvtv-tc-buttons { flex-direction: column; }
    #dvtv-tc-buttons .dvtv-btn { width: 100%; justify-content: center; }
}

/* ===================================
   給与明細スタイル
   =================================== */
.dvtv-salary-slip {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}
.dvtv-salary-header {
    border-bottom: 2px solid #0073aa;
    padding-bottom: 12px;
    margin-bottom: 20px;
}
.dvtv-salary-header h3 {
    margin: 0 0 8px;
    font-size: 18px;
    color: #0073aa;
}
.dvtv-salary-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: #666;
}
.dvtv-salary-meta span {
    padding: 4px 8px;
    background: #f5f5f5;
    border-radius: 4px;
}
.dvtv-salary-sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.dvtv-salary-section {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}
.dvtv-salary-section h4 {
    margin: 0;
    padding: 10px 14px;
    background: linear-gradient(to bottom, #f8f8f8, #f0f0f0);
    font-size: 14px;
    border-bottom: 1px solid #e0e0e0;
}
.dvtv-salary-table {
    width: 100%;
    border-collapse: collapse;
}
.dvtv-salary-table th, .dvtv-salary-table td {
    padding: 8px 12px;
    border: 1px solid #e8e8e8;
    font-size: 13px;
}
.dvtv-salary-table th {
    background: #fafafa;
    font-weight: 500;
    text-align: left;
    width: 16%;
}
.dvtv-salary-table td {
    width: 17%;
}
.dvtv-salary-table .text-right {
    text-align: right;
}
.dvtv-salary-subtotal {
    background: #f5f9fc !important;
}
.dvtv-salary-subtotal th {
    background: #e8f4fc !important;
    text-align: right;
}
.dvtv-salary-total {
    background: linear-gradient(135deg, #0073aa, #005a87);
    border-color: #005a87;
}
.dvtv-salary-total h4 {
    display: none;
}
.dvtv-salary-total .dvtv-salary-table {
    background: transparent;
}
.dvtv-salary-total .dvtv-salary-table th,
.dvtv-salary-total .dvtv-salary-table td {
    border-color: rgba(255,255,255,0.2);
    color: #fff;
    padding: 16px 20px;
    font-size: 16px;
}
.dvtv-salary-total .dvtv-salary-table th {
    background: transparent;
    font-size: 14px;
}
.dvtv-net-pay {
    font-size: 24px;
    font-weight: bold;
}
.dvtv-salary-details {
    margin-top: 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
}
.dvtv-salary-details summary {
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 500;
    background: #f5f5f5;
}
.dvtv-salary-details[open] summary {
    border-bottom: 1px solid #ddd;
}
.dvtv-details-table {
    font-size: 12px;
}
.dvtv-details-table th {
    width: 30%;
}
.dvtv-field-desc {
    display: block;
    font-size: 10px;
    color: #888;
    margin-top: 2px;
}

/* 給与ボタン群 */
#dvtv-salary-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
}

/* 給与明細印刷用 */
@media print {
    .dvtv-salary-slip {
        border: none;
        padding: 0;
    }
    .dvtv-salary-details {
        display: none;
    }
    #dvtv-salary-buttons {
        display: none !important;
    }
    #dvtv-salary-form {
        display: none !important;
    }
}

/* ===================================
   インライン編集機能
   =================================== */

/* 編集可能セル */
.dvtv-editable {
    cursor: pointer;
    position: relative;
}
.dvtv-editable:hover {
    background: #bbdefb !important;
}

/* 変更済みセル（背景赤） */
.dvtv-override {
    background: #ffebee !important;
}
.dvtv-override:hover {
    background: #ef9a9a !important;
}

/* セル内の値 */
.dvtv-cell-value {
    display: inline-block;
}

/* 元に戻すボタン */
.dvtv-reset-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    margin-left: 4px;
    border: none;
    border-radius: 50%;
    background: #f44336;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.dvtv-reset-btn:hover {
    opacity: 1;
}

/* 編集中のインプット */
.dvtv-edit-input {
    width: 100%;
    max-width: 80px;
    padding: 2px 4px;
    border: 2px solid #2196f3;
    border-radius: 3px;
    font-size: 13px;
    text-align: center;
    outline: none;
}
.dvtv-edit-input:focus {
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

/* 時間入力 */
.dvtv-edit-input[type="time"] {
    max-width: 100px;
}

/* テキスト入力（現場など） */
.dvtv-edit-input.dvtv-edit-text {
    max-width: 150px;
    text-align: left;
}

/* 編集ツールチップ */
.dvtv-edit-tooltip {
    position: fixed;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    z-index: 10000;
    pointer-events: none;
}

/* 現場ダイアログ編集用 */
.dvtv-genba-dialog-content {
    min-width: 300px;
}
.dvtv-genba-dialog-text {
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
    margin-bottom: 15px;
    min-height: 40px;
    word-break: break-all;
}
.dvtv-genba-dialog-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}
.dvtv-genba-dialog-input {
    width: 100%;
    padding: 8px;
    border: 2px solid #2196f3;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
}
.dvtv-genba-dialog-input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}
.dvtv-genba-dialog-original {
    margin-bottom: 10px;
    color: #666;
}
.dvtv-genba-dialog-original span {
    color: #333;
    background: #e0e0e0;
    padding: 2px 6px;
    border-radius: 3px;
}

