/* 修繕系統專用樣式 */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0;
}

.checkbox-item {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    padding: 8px 15px;
    border-radius: 4px;
    border: 1px solid #ddd;
    transition: all 0.3s;
}

.checkbox-item:hover {
    background: #e9ecef;
    border-color: #2c5aa0;
}

.checkbox-item input {
    margin-right: 8px;
    cursor: pointer;
}

.checkbox-item label {
    cursor: pointer;
    user-select: none;
}

.category-group {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #2c5aa0;
    transition: all 0.3s;
}

.category-group:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.category-group h4 {
    margin-top: 0;
    color: #2c5aa0;
    border-bottom: 2px solid #eee;
    padding-bottom: 8px;
}

.photo-upload-area {
    border: 2px dashed #ddd;
    padding: 30px 20px;
    text-align: center;
    border-radius: 8px;
    margin: 15px 0;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.3s;
}

.photo-upload-area.required {
    border-color: #e74c3c;
}

.photo-upload-area:hover {
    border-color: #2c5aa0;
    background: #f0f8ff;
}

.photo-upload-area.dragover {
    border-color: #2c5aa0;
    background: #e6f3ff;
    transform: scale(1.02);
}

.photo-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.photo-preview-item {
    width: 120px;
    height: 120px;
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.photo-preview-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview-item .remove-photo {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.photo-preview-item .remove-photo:hover {
    background: rgba(192, 57, 43, 1);
    transform: scale(1.1);
}

.form-row-3 {
    display: flex;
    gap: 20px;
}

.form-row-3 .form-group {
    flex: 1;
}

.address-same-checkbox {
    display: flex;
    align-items: center;
    margin-top: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
}

.address-same-checkbox input {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
}

.address-same-checkbox label {
    cursor: pointer;
}

.required-field::after {
    content: " *";
    color: #e74c3c;
}

.form-hint {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    font-style: italic;
}

.photo-count {
    font-size: 0.8rem;
    color: #666;
    margin-top: 5px;
}

.required-note {
    color: #e74c3c;
    font-size: 0.9rem;
    margin-top: 5px;
}

@media (max-width: 768px) {
    .form-row-3 {
        flex-direction: column;
        gap: 10px;
    }
    
    .checkbox-group {
        flex-direction: column;
    }
    
    .photo-preview-item {
        width: 100px;
        height: 100px;
    }
}

.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: bold;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.community-select-container {
    position: relative;
}

.community-other-input {
    margin-top: 10px;
    display: none;
}

.community-other-input.show {
    display: block;
}

.house-number-select {
    display: none;
    margin-top: 10px;
}

.house-number-select.show {
    display: block;
}

.house-number-select select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.loading-house-numbers {
    color: #666;
    font-style: italic;
}

/* 調整報修日期和社區在同一行 */
.date-community-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.date-community-row .form-group {
    flex: 1;
}

.date-field {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.warranty-info-row {
    margin-top: 15px;
    padding: 15px;
    background: #f0f8ff;
    border-radius: 6px;
    border-left: 4px solid #2c5aa0;
}

.warranty-info-row h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #2c5aa0;
}

.warranty-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.warranty-item {
    background: white;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.warranty-item label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.warranty-item input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 1rem;
    font-weight: bold;
    color: #2c5aa0;
}

.readonly-field {
    background-color: #f8f9fa !important;
    cursor: not-allowed;
}

.error-border {
    border-color: #e74c3c !important;
}


/* 姓名驗證訊息樣式 */
.name-validation-message {
    margin-top: 5px;
    font-size: 0.9rem;
    padding: 5px 10px;
    border-radius: 4px;
    display: none;
}

.name-validation-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.name-validation-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.name-validation-message.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 輸入框驗證狀態樣式 */
input.success {
    border-color: #28a745 !important;
    background-color: #f0fff4 !important;
}

input.error {
    border-color: #dc3545 !important;
    background-color: #fff0f0 !important;
}

/* 添加姓名驗證訊息樣式 */
.name-hint {
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

/* 保固資訊標題樣式 */
.warranty-info-row h4 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.warranty-info-row h4 i {
    color: #28a745;
}

/* 照片上傳區域樣式修正 */
.photo-upload-area {
    cursor: pointer !important;
}

/* 確保移除按鈕可以點擊 */
.photo-preview-item {
    position: relative;
}

.photo-preview-item .remove-photo {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    z-index: 1000;
    pointer-events: auto !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s;
}

.photo-preview-item .remove-photo:hover {
    background: rgba(192, 57, 43, 1);
    transform: scale(1.1);
}

/* 確保圖片不會阻擋點擊 */
.photo-preview-item img {
    pointer-events: none;
}

/* 確保照片上傳區域可以點擊 */
#photoUploadArea {
    cursor: pointer !important;
    position: relative;
    z-index: 10;
}

/* 確保上傳區域內的所有元素不會阻擋點擊 */
#photoUploadArea * {
    pointer-events: none;
}

/* 恢復移除按鈕的點擊功能 */
#photoUploadArea .remove-photo,
.photo-preview-item .remove-photo {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* 確保檔案輸入在視覺上隱藏但功能正常 */
#photos {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* 表格樣式 */
.dynamic-table {
    overflow-x: auto;
    margin-bottom: 20px;
}

.dynamic-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.dynamic-table th {
    background: #2c5aa0;
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: bold;
    border-bottom: 2px solid #1c3a6e;
}

.dynamic-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.dynamic-table tr:hover {
    background-color: #f5f9ff;
}

.dynamic-table tr:last-child td {
    border-bottom: none;
}

/* 按鈕樣式 */
.btn {
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background-color: #2c5aa0;
    color: white;
}

.btn-primary:hover {
    background-color: #1c3a6e;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.8rem;
}

.btn-pdf {
    background-color: #e74c3c;
    color: white;
}

.btn-pdf:hover {
    background-color: #c0392b;
}

.btn-view {
    background-color: #17a2b8;
    color: white;
}

.btn-view:hover {
    background-color: #138496;
}
