/* Dashboard 樣式 - 白色主題 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    color: #1f2937;
    overflow-x: hidden;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* 側邊欄樣式 */
.sidebar {
    width: 280px;
    background: #f8fafc;
    border-right: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.sidebar-header h2 {
    color: #3b82f6;
    font-size: 1.25rem;
    font-weight: 700;
}

.sidebar-header span {
    color: #1f2937;
}

.sidebar-nav {
    padding: 1.5rem 0;
}

.sidebar-nav h3 {
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 1.5rem 1rem 1.5rem;
}

.sidebar-nav ul {
    list-style: none;
    margin-bottom: 2rem;
}

.nav-item a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: #6b7280;
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-item a:hover {
    background: #f1f5f9;
    color: #1f2937;
}

.nav-item.active a {
    background: #3b82f6;
    color: white;
}

.nav-item i {
    width: 20px;
    margin-right: 0.75rem;
    font-size: 1rem;
}

/* 主要內容區域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: auto;
    background: #ffffff;
}

/* 頂部導航 */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
}

.header-left h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.header-left p {
    color: #6b7280;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.credits-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #374151;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.help-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.help-btn:hover {
    background: #e5e7eb;
    color: #1f2937;
}

/* 工具欄 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
}

.filter-input {
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #1f2937;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    width: 300px;
}

.filter-input::placeholder {
    color: #9ca3af;
}

.toolbar-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.upload-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.upload-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.view-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-btn:hover {
    background: #e5e7eb;
    color: #1f2937;
}

/* 文檔表格 */
.documents-table {
    flex: 1;
    padding: 2rem;
    overflow-x: auto;
    background: #ffffff;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

thead {
    background: #f8fafc;
}

th {
    text-align: left;
    padding: 1rem;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

td {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.document-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.document-info i {
    color: #ef4444;
    font-size: 1.5rem;
}

.document-info strong {
    color: #1f2937;
    display: block;
}

.document-info small {
    color: #6b7280;
    font-size: 0.875rem;
}

.period-info strong {
    color: #1f2937;
    display: block;
}

.period-info small {
    color: #6b7280;
}

.reconciliation {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.reconciliation-fraction {
    color: #1f2937;
    font-weight: 600;
}

.progress-bar {
    width: 100px;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #3b82f6;
    transition: width 0.3s ease;
}

.status-indicator {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.status-indicator.in-progress {
    background: #fef3c7;
    color: #92400e;
}

.balance-info div {
    margin-bottom: 0.25rem;
    color: #374151;
}

.balance-info strong {
    color: #1f2937;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-badge.success {
    background: #dcfce7;
    color: #10b981;
}

.status-badge.review {
    background: #fef3c7;
    color: #f59e0b;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #6b7280;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #f3f4f6;
    color: #1f2937;
}

/* 分頁控制 */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.pagination-info {
    color: #6b7280;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rows-select {
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #1f2937;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

.page-info {
    color: #374151;
}

.page-buttons {
    display: flex;
    gap: 0.25rem;
}

.page-btn {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #6b7280;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    background: #f3f4f6;
    color: #1f2937;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 模態框樣式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #ffffff;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    color: #1f2937;
    font-size: 1.25rem;
}

.close-btn {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.modal-body {
    padding: 2rem;
}

.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.upload-area:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.upload-area i {
    font-size: 3rem;
    color: #3b82f6;
    margin-bottom: 1rem;
}

.upload-area h4 {
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.upload-area p {
    color: #6b7280;
}

.browse-files-btn {
    background: none;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    text-decoration: underline;
}

.browse-files-btn:hover {
    color: #2563eb;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
    }
    
    .top-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .toolbar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .filter-input {
        width: 100%;
    }
    
    .toolbar-actions {
        justify-content: space-between;
    }
    
    .documents-table {
        padding: 1rem;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    .pagination {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

/* 加載動畫 */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.2), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    to {
        left: 100%;
    }
}

/* 拖放狀態 */
.upload-area.dragover {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: scale(1.02);
}

/* 選中狀態 */
.document-row.selected {
    background: #eff6ff;
}

/* 懸停效果 */
.document-row:hover {
    background: #f9fafb;
}

/* 滾動條樣式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f9fafb;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}
