/* 里民信箱頁面專用樣式 */

/* 頂部導航區 */
.mailbox-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    max-width: 480px;
    margin: 0 auto;
}

.back-btn, .add-btn {
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.3s;
    flex-shrink: 0;
}

.back-btn:hover, .add-btn:hover {
    background-color: rgba(255,255,255,0.2);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--white);
    margin: 0;
    flex: 1;
    text-align: center;
}

/* 主要內容 */
.mailbox-main {
    max-width: 480px;
    margin: 0 auto;
    padding-bottom: 40px;
}

/* 統計資訊區 */
.stats-section {
    padding: 20px;
    background: var(--white);
}

.stats-container {
    display: flex;
    gap: 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--border-radius);
    padding: 20px;
}

.stat-item {
    flex: 1;
    text-align: center;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 篩選器區 */
.filter-section {
    padding: 0 20px 20px 20px;
    background: var(--white);
    border-bottom: 1px solid var(--background-secondary);
}

.filter-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filter-container::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    background: var(--background-secondary);
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.3s;
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--primary-color);
    color: var(--white);
}

/* 回報列表區 */
.reports-section {
    background: var(--background-primary);
    min-height: 400px;
}

.reports-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 回報項目 */
.report-item {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s;
    border-left: 4px solid transparent;
    position: relative;
}

.report-item:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.report-item.pending {
    border-left-color: #ff9f43;
}

.report-item.replied {
    border-left-color: #2ed573;
}

.report-item.canceled {
    border-left-color: #747d8c;
    opacity: 0.7;
}

.report-item.has-unread {
    position: relative;
}

.report-item.has-unread::after {
    content: '';
    position: absolute;
    top: 16px;
    right: 16px;
    width: 8px;
    height: 8px;
    background: #ff4757;
    border-radius: 50%;
}

/* 回報項目頭部 */
.report-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.report-status {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.report-status.pending {
    background: #fff3cd;
    color: #856404;
}

.report-status.replied {
    background: #d4edda;
    color: #155724;
}

.report-status.canceled {
    background: #f8d7da;
    color: #721c24;
}

.report-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* 回報內容 */
.report-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.report-location {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.report-content-preview {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0 0 12px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 回報元數據 */
.report-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--background-secondary);
}

.report-photos-count {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.report-reply-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 500;
}

/* 空狀態 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    color: var(--text-secondary);
    margin: 0 auto 20px auto;
    opacity: 0.5;
}

.empty-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.empty-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 24px 0;
}

.empty-action-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-radius: 25px;
    color: var(--white);
    cursor: pointer;
    padding: 12px 24px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
}

.empty-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

/* 模態框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

/* 回報詳細模態框 */
.report-detail-modal {
    width: 100%;
    max-width: 500px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--background-secondary);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.3s;
}

.close-btn:hover {
    background: var(--background-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

/* 回報詳細內容 */
.detail-section {
    margin-bottom: 24px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-value {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.detail-content {
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    padding: 16px;
    line-height: 1.6;
}

/* 照片網格 */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.photo-item {
    aspect-ratio: 1;
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s;
}

.photo-item:hover {
    transform: scale(1.05);
}

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

/* 回覆區域 */
.replies-section {
    border-top: 1px solid var(--background-secondary);
    margin-top: 24px;
    padding-top: 24px;
}

.reply-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 16px;
}

.reply-item:last-child {
    margin-bottom: 0;
}

.reply-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.reply-author {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
}

.reply-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.reply-content {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin: 0;
}

.reply-photos {
    margin-top: 12px;
}

/* 撤銷確認模態框 */
.cancel-modal {
    text-align: center;
    padding: 32px 24px;
    max-width: 400px;
    width: 100%;
}

.modal-icon {
    margin: 0 auto 16px auto;
}

.modal-icon.warning {
    color: #ff9f43;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 20px 24px;
    border-top: 1px solid var(--background-secondary);
    margin-top: 20px;
}

.modal-btn {
    padding: 10px 24px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    min-width: 80px;
}

.cancel-btn {
    background: var(--background-secondary);
    color: var(--text-secondary);
}

.cancel-btn:hover {
    background: #dee2e6;
    color: var(--text-primary);
}

.confirm-btn {
    background: #ff4757;
    color: var(--white);
}

.confirm-btn:hover {
    background: #ff3742;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Toast 通知 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success-color, #2ed573);
    color: var(--white);
    padding: 15px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    max-width: 90%;
    min-width: 200px;
}

.toast.show {
    opacity: 1;
    visibility: visible;
}

.toast.error {
    background: #ff4757;
}

.toast.info {
    background: #3742fa;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-message {
    font-size: 0.9rem;
    font-weight: 500;
}

/* 載入骨架屏 */
.loading-skeleton {
    background: var(--background-secondary);
    border-radius: var(--border-radius);
    position: relative;
    overflow: hidden;
}

.loading-skeleton::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255,255,255,0.6), 
        transparent
    );
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

.skeleton-report {
    padding: 20px;
    margin-bottom: 16px;
}

.skeleton-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.skeleton-status {
    width: 60px;
    height: 20px;
}

.skeleton-date {
    width: 80px;
    height: 16px;
}

.skeleton-title {
    height: 20px;
    width: 80%;
    margin-bottom: 8px;
}

.skeleton-content {
    height: 16px;
    width: 100%;
    margin-bottom: 6px;
}

.skeleton-content:last-child {
    width: 60%;
}

/* 響應式設計 */
@media (max-width: 480px) {
    .header-container {
        padding: 12px 15px;
    }
    
    .stats-container {
        gap: 12px;
        padding: 16px;
    }
    
    .stat-number {
        font-size: 1.3rem;
    }
    
    .filter-section {
        padding: 0 15px 15px 15px;
    }
    
    .reports-container {
        padding: 15px;
        gap: 12px;
    }
    
    .report-item {
        padding: 16px;
    }
    
    .modal-content {
        max-width: 95vw;
        margin: 0 10px;
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-actions {
        flex-direction: column;
        padding: 16px 20px;
    }
    
    .modal-btn {
        width: 100%;
    }
}

/* 暗色主題支援 */
@media (prefers-color-scheme: dark) {
    .stats-container {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }
    
    .reply-item {
        background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    }
}

/* 高對比模式支援 */
@media (prefers-contrast: high) {
    .report-item {
        border: 2px solid var(--text-primary);
    }
    
    .filter-btn {
        border: 1px solid var(--text-secondary);
    }
    
    .filter-btn.active {
        border-color: var(--primary-color);
    }
}
