/**
 * TRON錢包手動歸集工具 - 樣式文件
 * ============================================================================
 */

/* 全局樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background: #f5f7fa;
}

/* ===== 登錄頁樣式 ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 24px;
    color: #333;
    margin-bottom: 8px;
}

.login-header .subtitle {
    color: #888;
    font-size: 14px;
}

.login-form {
    margin-bottom: 20px;
}

.login-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* ===== 表單控件 ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* ===== 按鈕樣式 ===== */
.btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

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

.btn-outline {
    background: transparent;
    border: 1px solid #ddd;
    color: #555;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* ===== 提示框 ===== */
.alert {
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 6px;
    border-left: 4px solid;
}

.alert-success {
    background: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

.alert-danger {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

/* ===== 導航欄 ===== */
.navbar {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand h1 {
    font-size: 20px;
    color: #333;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.navbar-text {
    color: #666;
    font-size: 14px;
}

/* ===== 主容器 ===== */
.dashboard-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-container {
    flex: 1;
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ===== 統計卡片 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    font-size: 48px;
    line-height: 1;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: #888;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #333;
}

.stat-warning .stat-value {
    color: #f59e0b;
}

.stat-success .stat-value {
    color: #10b981;
}

.stat-danger .stat-value {
    color: #ef4444;
}

/* ===== Tab標籤 ===== */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.3s;
    color: #666;
}

.tab-btn:hover {
    background: #f9fafb;
}

.tab-btn.active {
    background: white;
    border-color: #667eea;
    color: #667eea;
    border-bottom-color: white;
    position: relative;
    z-index: 1;
}

.tab-content {
    background: white;
    border-radius: 0 12px 12px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* ===== 面板 ===== */
.panel {
    padding: 30px;
}

.panel-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
}

.panel-header h3 {
    font-size: 20px;
    color: #333;
}

.panel-body {
    /* 內容區 */
}

/* ===== 表格 ===== */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table thead {
    background: #f9fafb;
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e5e7eb;
    font-size: 13px;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

/* 狀態標籤 */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-success {
    background: #d1fae5;
    color: #065f46;
}

.status-warning {
    background: #fef3c7;
    color: #92400e;
}

.status-danger {
    background: #fee2e2;
    color: #991b1b;
}

.status-info {
    background: #dbeafe;
    color: #1e40af;
}

/* ===== 錢包信息卡片 ===== */
.wallet-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.wallet-info-card {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
}

.wallet-info-card.balance-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.wallet-info-card.balance-card .info-label,
.wallet-info-card.balance-card .info-value {
    color: white;
}

.info-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
}

.info-value {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    word-break: break-all;
}

/* Gas費檢查 */
.gas-check {
    margin: 20px 0;
    padding: 16px;
    border-radius: 8px;
    font-weight: 500;
}

.gas-check.sufficient {
    background: #d1fae5;
    color: #065f46;
}

.gas-check.insufficient {
    background: #fee2e2;
    color: #991b1b;
}

/* 歸集操作按鈕 */
#collectionActions {
    margin-top: 30px;
    text-align: center;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
}

/* ===== 分頁 ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination button:hover {
    background: #f9fafb;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .page-info {
    padding: 8px 16px;
    color: #666;
}

/* ===== 模態框 ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.modal-header h3 {
    font-size: 18px;
    color: #333;
}

.modal-close {
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 24px;
}

/* 訂單詳情表格 */
.detail-table {
    width: 100%;
}

.detail-table tr {
    border-bottom: 1px solid #f3f4f6;
}

.detail-table td {
    padding: 12px 8px;
}

.detail-table td:first-child {
    font-weight: 600;
    color: #666;
    width: 30%;
}

.detail-table td:last-child {
    color: #333;
    word-break: break-all;
}

/* ===== 工具樣式 ===== */
.text-muted {
    color: #888;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* ===== Loading動畫 ===== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== 響應式設計 ===== */
@media (max-width: 768px) {
    .main-container {
        padding: 15px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-row .form-group {
        margin-bottom: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .wallet-info-grid {
        grid-template-columns: 1fr;
    }
    
    .navbar {
        padding: 15px;
    }
    
    .navbar-brand h1 {
        font-size: 16px;
    }
}

/* ===== 查詢結果樣式 ===== */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

.results-header h4 {
    font-size: 18px;
    color: #333;
}

#queryStats {
    color: #666;
    font-size: 14px;
}

/* 鏈接樣式 */
.link {
    color: #667eea;
    text-decoration: none;
    cursor: pointer;
}

.link:hover {
    text-decoration: underline;
}

/* 短地址顯示 */
.short-address {
    font-family: 'Courier New', monospace;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

/* ===== 新增功能樣式 ===== */

/* 手風琴面板 */
.accordion {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    background: white;
}

.accordion-header {
    padding: 15px 20px;
    background: #f9fafb;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    user-select: none;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.accordion-header:hover {
    background: #f3f4f6;
}

.accordion-header::after {
    content: '▼';
    font-size: 12px;
    transition: transform 0.2s;
}

.accordion.active .accordion-header::after {
    transform: rotate(-180deg);
}

.accordion-body {
    padding: 20px;
    display: none;
}

.accordion.active .accordion-body {
    display: block;
}

/* 服務狀態 */
.service-status {
    background: #f9fafb;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.status-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

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

.status-item > span:first-child {
    font-weight: 600;
    margin-right: 10px;
    min-width: 100px;
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-indicator.status-running {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
    animation: pulse-green 2s infinite;
}

.status-indicator.status-stopped {
    background: #ef4444;
}

.status-indicator.status-unknown {
    background: #6b7280;
}

@keyframes pulse-green {
    0%, 100% {
        box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
    }
    50% {
        box-shadow: 0 0 16px rgba(16, 185, 129, 0.9);
    }
}

/* 錢包配置 */
.wallet-config-row {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 10px;
}

.wallet-label {
    font-weight: 600;
    min-width: 100px;
}

.wallet-address {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    word-break: break-all;
    margin-right: 15px;
}

/* TG模板 */
.template-toggle {
    padding: 15px;
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    border-radius: 6px;
    margin-bottom: 20px;
}

.switch-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.switch-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
}

.switch-slider {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    background: #d1d5db;
    border-radius: 24px;
    margin-right: 12px;
    transition: background 0.2s;
}

.switch-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.switch-label input[type="checkbox"]:checked + .switch-slider {
    background: #10b981;
}

.switch-label input[type="checkbox"]:checked + .switch-slider::after {
    transform: translateX(24px);
}

.switch-text {
    font-weight: 500;
}

.template-vars {
    background: #eff6ff;
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 10px;
    margin-bottom: 15px;
    border-left: 3px solid #3b82f6;
}

.button-group {
    display: flex;
    gap: 10px;
}

.button-group button {
    flex: 1;
}

/* 測試工具 */
.test-panel {
    max-width: 800px;
}

.test-panel h4 {
    margin-bottom: 10px;
}

.test-panel .note {
    background: #fef3c7;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid #f59e0b;
}

.radio-group {
    display: flex;
    gap: 20px;
}

.radio-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.radio-group input[type="radio"] {
    margin-right: 5px;
}

.test-result-panel {
    background: #f0fdf4;
    border: 2px solid #10b981;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.test-result-panel h4 {
    color: #10b981;
    margin-bottom: 15px;
}

.test-step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
    padding: 8px;
    background: white;
    border-radius: 6px;
}

.test-step::before {
    content: "✓";
    color: #10b981;
    font-weight: bold;
    margin-right: 10px;
    font-size: 16px;
}

#testResultContent {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    background: white;
    padding: 15px;
    border-radius: 6px;
    max-height: 400px;
    overflow-y: auto;
}

/* 響應式調整 */
@media (max-width: 768px) {
    .wallet-config-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .wallet-label {
        margin-bottom: 5px;
    }
    
    .wallet-address {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .button-group {
        flex-direction: column;
    }
}

/* 模态框覆盖层 */
.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: 10000;
    animation: fadeIn 0.2s;
}

.modal-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s;
}

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

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    font-size: 28px;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #374151;
}

.modal-body {
    padding: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

