﻿
/* 案件列表 Fieldset */
.fieldset-caselist {
    border-left-color: #8b5cf6;
    background-color: #fafbff;
    width: 95%;
    max-width: 1500px;
    margin: 25px auto;
}

.fieldset-caselist legend {
    background-color: #ede9fe;
    color: #5b21b6;
    font-size: 20px;
    padding: 10px 24px;
    font-weight: bold;
}

/* 表格容器 */
.fieldset-caselist .table-wrapper {
    overflow-x: auto;
    margin: 10px 0;
}

/* 案件列表表格 */
.caselist-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    overflow: hidden;
}

/* 表頭樣式 */
.caselist-table thead {
    background: linear-gradient(135deg, #c4b5fd 0%, #ddd6fe 100%);
    color: #5b21b6;
}

.caselist-table th {
    padding: 16px 12px;
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    border-right: 1px solid rgba(139, 92, 246, 0.2);
    white-space: nowrap;
}

.caselist-table th:last-child {
    border-right: none;
}

/* 欄位寬度 */
.caselist-table .col-num {
    min-width: 100px;
}
.caselist-table .col-date {
    min-width: 110px;
}
.caselist-table .col-driver {
    min-width: 90px;
}
.caselist-table .col-carno {
    min-width: 100px;
}
.caselist-table .col-level {
    min-width: 80px;
}
.caselist-table .col-summary {
    min-width: 400px;
    max-width: 600px;
}
.caselist-table .col-duty {
    min-width: 70px;
}
.caselist-table .col-point {
    min-width: 70px;
}
.caselist-table .col-status {
    min-width: 100px;
}
.caselist-table .col-action {
    min-width: 80px;
}

/* 表身樣式 */
.caselist-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.2s;
}

.caselist-table tbody tr:hover {
    background-color: #faf5ff;
    transform: scale(1.001);
}

/* 已結案 */
.caselist-table .case-closed {
    background-color: #f0fdf4;
}

.caselist-table .case-closed:hover {
    background-color: #dcfce7;
}

/* 進行中 */
.caselist-table .case-open {
    background-color: #fffbeb;
}

.caselist-table .case-open:hover {
    background-color: #fef3c7;
}

/* 儲存格樣式 */
.caselist-table td {
    padding: 14px 12px;
    text-align: center;
    font-size: 15px;
    color: #374151;
}

.caselist-table .cell-num {
    font-weight: 600;
    color: #6366f1;
}

.caselist-table .cell-date {
    color: #6b7280;
    font-family: 'Courier New', monospace;
}

.caselist-table .cell-summary {
    text-align: left;
    padding-left: 16px;
    line-height: 1.5;
    color: #4b5563;
}

/* 案等徽章 */
.caselist-table .badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
}

.caselist-table .level-a1 {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.caselist-table .level-a2 {
    background-color: #fed7aa;
    color: #9a3412;
    border: 1px solid #fdba74;
}

.caselist-table .level-a3 {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* 狀態徽章 */
.caselist-table .status-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.caselist-table .status-closed {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.caselist-table .status-open {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde047;
}

/* 編輯按鈕 */
.caselist-table .btn-edit , .caselist-table .btn-read{
    padding: 6px 16px;
    background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.2);
}

.caselist-table .btn-edit:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.3);
}

.caselist-table .btn-edit:active {
    transform: translateY(0);
}

/* 響應式設計 */
@media (max-width: 1200px) {
    .fieldset-caselist {
        width: 98%;
    }

    .caselist-table {
        font-size: 14px;
    }

    .caselist-table th,
    .caselist-table td {
        padding: 10px 8px;
        font-size: 14px;
    }

    .caselist-table .col-summary {
        min-width: 300px;
    }
}


/* 案件詳細資料 Fieldset */
.fieldset-casedetail {
    border-left-color: #f59e0b;
    background-color: #fffbf5;
    width: 95%;
    max-width: 1500px;
    margin: 25px auto;
}

.fieldset-casedetail legend {
    background-color: #fef3c7;
    color: #92400e;
    font-size: 22px;
    padding: 12px 24px;
    font-weight: bold;
}

/* 區塊樣式 */
.detail-section {
    background-color: white;
    margin: 20px 0;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.section-title {
    font-size: 19px;
    font-weight: bold;
    color: #374151;
    margin: 0 0 16px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #f3f4f6;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 16px;
}

.section-header .section-title {
    margin: 0;
    padding: 0;
    border: none;
    flex: 1;
}

/* 基本資訊網格 */
.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.info-item label {
    font-size: 15px;
    color: #6b7280;
    font-weight: 600;
}

.info-item .value {
    font-size: 17px;
    color: #1f2937;
    padding: 8px 12px;
    background-color: #f9fafb;
    border-radius: 6px;
}

.info-item .value-primary {
    font-size: 20px;
    color: #3b82f6;
    font-weight: bold;
    padding: 8px 12px;
    background-color: #eff6ff;
    border-radius: 6px;
}

.info-item .value-meta {
    font-size: 16px;
    color: #9ca3af;
    font-style: italic;
    padding: 8px 12px;
    background-color: #f9fafb;
    border-radius: 6px;
}

.info-item .value-highlight {
    font-size: 19px;
    color: #dc2626;
    font-weight: bold;
    padding: 8px 12px;
    background-color: #fef2f2;
    border-radius: 6px;
}

/* 徽章樣式 */
.badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: bold;
    text-align: center;
}

.level-badge {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.duty-badge {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde047;
}

.base-badge {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fac3c3;
}

.status-badge {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

/* 人員資訊網格 */
.people-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.people-column {
    background-color: #fafbff;
    padding: 16px;
    border-radius: 8px;
    border: 2px solid;
}

.column-ours {
    border-color: #3b82f6;
}

.column-other {
    border-color: #f59e0b;
}

.column-third {
    border-color: #8b5cf6;
}

.column-title {
    font-size: 18px;
    font-weight: bold;
    margin: 0 0 14px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid currentColor;
}

.column-ours .column-title {
    color: #3b82f6;
}

.column-other .column-title {
    color: #f59e0b;
}

.column-third .column-title {
    color: #8b5cf6;
}

.people-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-row {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 10px;
    align-items: start;
}

.info-row.full {
    grid-template-columns: 100px 1fr;
}

.info-row label {
    font-size: 15px;
    color: #6b7280;
    font-weight: 600;
    padding-top: 4px;
}

.info-row span {
    font-size: 16px;
    color: #1f2937;
    background-color: white;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

/* 事件敘述 */
.narrative-content {
    font-size: 17px;
    color: #374151;
    line-height: 1.8;
    padding: 16px;
    background-color: #f9fafb;
    border-radius: 6px;
    border-left: 4px solid #f59e0b;
}

/* 處置記錄 */
.process-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.process-item {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 12px;
    padding: 12px;
    background-color: #f0fdf4;
    border-radius: 6px;
    border-left: 4px solid #10b981;
    cursor: pointer;
    transition: all 0.2s;
}

.process-item:hover {
    background-color: #dcfce7;
    transform: translateX(4px);
}

.process-date {
    font-size: 15px;
    font-weight: 600;
    color: #065f46;
}

.process-note {
    font-size: 16px;
    color: #374151;
    line-height: 1.6;
}

.process-input {
    margin-top: 16px;
    padding: 16px;
    background-color: #eff6ff;
    border-radius: 6px;
    border: 2px dashed #3b82f6;
}

.input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.input-row label {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.input-row input[type="date"] {
    padding: 8px 12px;
    font-size: 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

.process-input textarea {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
}

.error-msg {
    color: #dc2626;
    font-size: 15px;
    font-weight: 600;
}

/* 按鈕樣式 */
.btn-add, .btn-closure, .btn-print {
    padding: 8px 18px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-add {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    color: white;
}

.btn-add:hover {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.btn-closure {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    color: white;
}

.btn-closure:hover {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

.btn-print {
    background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
    color: white;
}

.btn-print:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.3);
}

.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.btn-save, .btn-delete {
    padding: 10px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-save {
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    color: white;
}

.btn-save:hover {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-delete {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    color: white;
}

.btn-delete:hover {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

/* 附件清單 */
.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.attachment-item {
    padding: 8px 16px;
    background-color: #eff6ff;
    color: #1e40af;
    border: 1px solid #93c5fd;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 600;
}

/* 結案表單 */
.closure-form {
    padding: 20px;
    background-color: #fafbff;
    border-radius: 8px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.form-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-item.full {
    grid-column: 1 / -1;
}

.form-item label {
    font-size: 15px;
    color: #374151;
    font-weight: 600;
}

.form-item input {
    padding: 10px 12px;
    font-size: 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: white;
}

.form-item input:disabled {
    background-color: #f3f4f6;
    color: #6b7280;
}

.textarea-display {
    padding: 12px;
    font-size: 16px;
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    min-height: 80px;
    line-height: 1.6;
    color: #374151;
}

.btn-save-closure {
    padding: 12px 32px;
    font-size: 17px;
    font-weight: bold;
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-save-closure:hover {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(16, 185, 129, 0.4);
}

/* 照片展示 */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.photo-item {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.photo-item:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.photo-item img {
    width: 100%;
    height: auto;
    display: block;
}

/* 響應式設計 */
@media (max-width: 1200px) {
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .people-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .info-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .photo-gallery {
        grid-template-columns: 1fr;
    }
}
/* 編輯模式樣式 */
.cell-editor {
    background-color: #fffbeb !important;
    padding: 4px !important;
}

.edit-label {
    display: block;
    font-size: 12px;
    color: #92400e;
    margin-bottom: 4px;
}

.edit-input, .edit-select {
    width: 100%;
    padding: 6px 8px;
    font-size: 15px;
    border: 2px solid #f59e0b;
    border-radius: 4px;
    background-color: white;
}

.edit-input:focus, .edit-select:focus {
    outline: none;
    border-color: #d97706;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.edit-highlight {
    background-color: #fef3c7 !important;
    border-left: 4px solid #f59e0b !important;
}

/* 結案編輯的 textarea */
.closure-textarea {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #f59e0b;
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.6;
}

.closure-textarea:focus {
    outline: none;
    border-color: #d97706;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

/* 編輯中的高亮提示 */
@keyframes highlight-pulse {
    0%, 100% {
        background-color: #fef3c7;
    }
    50% {
        background-color: #fde68a;
    }
}

.cell-editor {
    animation: highlight-pulse 1s ease-in-out;
}


/* 統計表格 Fieldset */
.fieldset-statistics {
    border-left-color: #a5b4fc;
    background: linear-gradient(to bottom, #ffffff, #fafbff);
    max-width: 1200px;
}

.fieldset-statistics legend {
    background-color: #e0e7ff;
    color: #6366f1;
    font-size: 22px;  /* 18 + 4 */
    padding: 10px 20px;
}

/* 表格容器 */
.table-wrapper {
    overflow-x: auto;
    margin: 10px 0;
}

/* 統計表格基本樣式 */
.statistics-table {
    width: 85%;
    border-collapse: collapse;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

/* 表頭樣式 */
.statistics-table thead {
    background: linear-gradient(135deg, #a5b4fc 0%, #c7d2fe 100%);
    color: #3730a3;
}

.statistics-table th {
    padding: 14px 12px;
    text-align: center;
    font-weight: bold;
    font-size: 18px;  /* 14 + 4 */
    border-right: 1px solid rgba(255, 255, 255, 0.5);
}

.statistics-table th:last-child {
    border-right: none;
}

.statistics-table .header-main {
    min-width: 180px;
    text-align: left;
    padding-left: 20px;
}

.statistics-table .header-year {
    min-width: 80px;
}

.statistics-table .header-total {
    min-width: 100px;
    background-color: rgba(99, 102, 241, 0.15);
}

/* 表身樣式 */
.statistics-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s;
}

.statistics-table tbody tr:hover {
    background-color: #fafbff;
}

/* 進行中案件 - 淺黃色 */
.statistics-table .status-open {
    background-color: #fffbeb;
}

.statistics-table .status-open:hover {
    background-color: #fef3c7;
}

/* 已結案案件 - 淺綠色 */
.statistics-table .status-closed {
    background-color: #f0fdf4;
}

.statistics-table .status-closed:hover {
    background-color: #dcfce7;
}

/* 儲存格樣式 */
.statistics-table td {
    padding: 12px;
    text-align: center;
    font-size: 18px;  /* 14 + 4 */
}

.statistics-table .cell-label {
    text-align: left;
    padding-left: 20px;
    font-weight: 500;
    color: #4b5563;
}

.statistics-table .cell-data {
    color: #6b7280;
    font-weight: 500;
}

.statistics-table .cell-total {
    font-weight: bold;
    color: #374151;
    background-color: #f0f4ff;
}

/* 總計行樣式 - 改為淺色 */
.statistics-table .row-total {
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    color: #1e40af;
    font-weight: bold;
    font-size: 19px;  /* 15 + 4 */
}

.statistics-table .row-total td {
    border-top: 2px solid #93c5fd;
}

.statistics-table .row-total:hover {
    background: linear-gradient(135deg, #bfdbfe 0%, #c7d2fe 100%);
}

.statistics-table .cell-label-total {
    text-align: left;
    padding-left: 20px;
}

.statistics-table .cell-data-total {
    font-weight: 600;
}

.statistics-table .cell-grand-total {
    font-size: 20px;  /* 16 + 4 */
    font-weight: bold;
    background-color: #dbeafe;
    color: #1e40af;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .fieldset-statistics {
        width: 95%;
    }

    .statistics-table {
        font-size: 16px;  /* 12 + 4 */
    }

    .statistics-table th,
    .statistics-table td {
        padding: 8px 6px;
    }

    .statistics-table .header-main,
    .statistics-table .cell-label {
        min-width: 120px;
        font-size: 16px;  /* 12 + 4 */
    }
}

/* 數字高亮效果 */
.statistics-table .cell-data:hover,
.statistics-table .cell-total:hover {
    background-color: #eff6ff;
    cursor: pointer;
}
