/* ===================================
   DVTV Timecard System - 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-block;
    padding: 8px 16px;
    border-radius: 4px;
    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-tc-form,
.dvtv-settings-form {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 20px;
}

/* --- モダンフォーム --- */
.dvtv-tc-form-modern {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    padding: 24px;
}

.dvtv-tc-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.dvtv-tc-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dvtv-tc-field label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dvtv-tc-field select,
.dvtv-tc-field input {
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    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-form-actions-center {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.dvtv-btn-lg {
    padding: 12px 32px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- 印刷/Excel/PDFボタン --- */
.dvtv-btn-print {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border-color: #4338ca;
    color: #fff;
}
.dvtv-btn-print:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
}

.dvtv-btn-excel {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-color: #15803d;
    color: #fff;
}
.dvtv-btn-excel:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.dvtv-btn-pdf {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-color: #b91c1c;
    color: #fff;
}
.dvtv-btn-pdf:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

/* --- 表示列設定（折りたたみ） --- */
.dvtv-tc-columns-section {
    margin-top: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}
.dvtv-tc-columns-section summary {
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 500;
    background: #f5f5f5;
    border-radius: 4px 4px 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(120px, 1fr));
    gap: 8px;
    padding: 12px;
}
.dvtv-tc-col-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: normal;
    font-size: 13px;
    white-space: nowrap;
}

/* --- 設定ページ --- */
.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 summary:hover {
    background: linear-gradient(to bottom, #f0f0f0, #e8e8e8);
}
.dvtv-settings-group[open] summary {
    border-bottom: 1px solid #ddd;
    border-radius: 6px 6px 0 0;
}

/* --- 設定グリッド --- */
.dvtv-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    padding: 16px;
}
.dvtv-settings-grid-dense {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    padding: 12px;
}

.dvtv-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dvtv-field label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}
.dvtv-field-money {
    min-width: 140px;
}

/* --- 入力フィールド --- */
.dvtv-input-time,
.dvtv-input-date {
    width: 100%;
    max-width: 150px;
}
.dvtv-input-number {
    width: 100%;
    max-width: 100px;
}
.dvtv-input-text {
    width: 100%;
}
.dvtv-input-select {
    width: 100%;
}
.dvtv-input-checkbox {
    width: 20px;
    height: 20px;
}

/* --- 複数曜日選択 --- */
.dvtv-weekday-multi {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.dvtv-weekday-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: normal;
}
.dvtv-weekday-checkbox input {
    display: none;
}
.dvtv-weekday-checkbox span {
    font-size: 13px;
    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: 90px;
    text-align: right;
}
.dvtv-money-unit {
    font-size: 12px;
    color: #666;
}

/* --- 集計テーブル --- */
.dvtv-tc-header {
    margin-bottom: 16px;
}
.dvtv-tc-header h3 {
    margin: 8px 0;
    font-size: 18px;
}

.dvtv-tc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
}
.dvtv-tc-table th,
.dvtv-tc-table td {
    border: 1px solid #ccc;
    padding: 6px 8px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}
.dvtv-tc-table th {
    background: #f2f2f2;
    font-weight: 600;
    font-size: 12px;
}
.dvtv-tc-table .dvtv-genba-col {
    text-align: left;
    white-space: normal;
    max-width: 200px;
}

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

/* --- サマリーテーブル --- */
.dvtv-tc-summary {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 13px;
}
.dvtv-tc-summary td {
    padding: 10px 12px;
    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: 24px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px dashed #ccc;
}
.dvtv-tc-details-section {
    flex: 1;
    min-width: 280px;
}
.dvtv-tc-details-section h4 {
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #0073aa;
    font-size: 15px;
}
.dvtv-tc-details-table {
    width: 100%;
    border-collapse: collapse;
}
.dvtv-tc-details-table th,
.dvtv-tc-details-table td {
    border: 1px solid #e0e0e0;
    padding: 8px 10px;
    text-align: left;
    font-size: 13px;
}
.dvtv-tc-details-table th {
    background: #f9f9f9;
    width: 45%;
    font-weight: 500;
}

/* --- 時給サマリー --- */
.dvtv-wage-summary {
    margin-top: 20px;
    padding: 16px;
    background: #f0f7ff;
    border: 1px solid #b3d7f0;
    border-radius: 6px;
}
.dvtv-wage-summary h4 {
    margin: 0 0 12px;
    font-size: 14px;
    color: #0073aa;
}
.dvtv-summary-table {
    width: 100%;
    max-width: 300px;
}
.dvtv-summary-table th,
.dvtv-summary-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #ddd;
    font-size: 13px;
}
.dvtv-summary-table th {
    text-align: left;
    font-weight: 500;
}
.dvtv-summary-table td {
    text-align: right;
    font-weight: 600;
}

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

/* --- 現場ツールチップ --- */
.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: 24px;
    border-radius: 12px;
    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: 12px;
    right: 16px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    line-height: 1;
}
.dvtv-dialog-close:hover {
    color: #000;
}
.dvtv-dialog h4 {
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #0073aa;
}
#dvtv-genba-dialog-text {
    white-space: pre-wrap;
    line-height: 1.6;
}

/* --- 設定フォームアクション --- */
.dvtv-settings-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    padding-top: 20px;
    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: 10pt;
    }
    .dvtv-tc-table th,
    .dvtv-tc-table td {
        padding: 4px;
    }
    .dvtv-row-holiday {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* --- レスポンシブ --- */
@media (max-width: 768px) {
    .dvtv-tc-form-row {
        flex-direction: column;
        align-items: stretch;
    }
    .dvtv-settings-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dvtv-settings-grid-dense {
        grid-template-columns: repeat(2, 1fr);
    }
    .dvtv-tc-table {
        font-size: 11px;
    }
    .dvtv-tc-table th,
    .dvtv-tc-table td {
        padding: 4px;
    }
}
