/* 现代化变量系统 */
:root {
    --primary: #ff6b35;
    --primary-light: #ff8c61;
    --primary-dark: #e55a2b;
    --secondary: #1e3a8a;
    --accent: #06d6a0;
    --gradient: linear-gradient(135deg, #ff6b35 0%, #ff8c61 100%);
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.15);
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-glass: rgba(255, 255, 255, 0.1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 10px;
    color: var(--text-primary);
    position: relative;
    overflow-x: hidden;
}

/* 背景装饰元素 */
.background-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}

.bg-circle:nth-child(1) {
    width: 300px;
    height: 300px;
    top: -150px;
    left: -150px;
}

.bg-circle:nth-child(2) {
    width: 200px;
    height: 200px;
    bottom: -100px;
    right: -100px;
}

/* 主要容器 */
.converter-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--glass-border);
    width: 100%;
    max-width: 500px;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.converter-container:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg), 0 20px 60px rgba(0, 0, 0, 0.2);
}

/* 装饰边框 */
.decorative-border {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient);
}

/* Report Header Styles - Shared between records.php and payins.php */
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 0;
}

.report-header h1 {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    text-align: center;
    margin: 0;
    background: linear-gradient(135deg, var(--primary), #e65c2e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.home-link-button {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 16px;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.home-link-button:hover {
    transform: scale(1.1);
    background: white;
    color: var(--primary);
}

.export-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 16px;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.export-btn:hover {
    transform: scale(1.1);
    background: white;
    color: var(--primary);
}

/* Records Container - Shared between records.php and payins.php */
.records-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    /*padding: 20px;*/
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--glass-border);
    width: 100%;
    /*max-width: 800px;*/
    margin-top: 0;
    /*margin: 0 10px;*/
}

/* Total Summary Single - Shared between records.php and payins.php */
.total-summary-single {
    display: flex;
    align-items: stretch;
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 0 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.summary-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    text-align: center;
}

.summary-item .label {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 6px;
}

.summary-item .value {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
}

.summary-item-total .value {
    color: #22c55e; /* Green for total amount */
}

.summary-separator {
    width: 1px;
    background-color: #e2e8f0;
}

/* Date Navigation Wrapper - Mobile Responsive */
.date-navigation-wrapper {
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    padding: 10px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border: 1px solid var(--glass-border);
    width: 100%;
    box-sizing: border-box;
}

.date-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.search-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.date-input {
    padding: 8px 12px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    min-width: 120px;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    min-width: 100px;
    flex: 1;
}

.nav-btn,
.today-action-btn,
.search-btn {
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-btn:hover,
.today-action-btn:hover,
.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.nav-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* 标题区域 */
.header-section {
    text-align: center;
    margin-bottom: 10px;
    position: relative;
}

.flag-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    opacity: 0.8;
}

/* 输入区域 */
.input-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 2px solid rgba(255, 107, 53, 0.1);
    transition: border-color 0.3s ease;
}

.input-section:focus-within {
    border-color: var(--primary);
}

.input-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.label-left {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.label-left i {
    color: var(--primary);
}

.label-right {
    font-size: 12px;
    color: var(--text-light);
    background: #f1f5f9;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease;
    border: 1px solid transparent;
    padding-left: 12px;
    overflow: hidden; /* Clip child corners */
}

.input-wrapper:focus-within {
    border-color: transparent;
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.6);
}

.input-wrapper:focus-within .currency-symbol i {
    color: #f97316;
}

.currency-symbol {
    color: #b6b6b6;
    font-size: 20px;
    margin-right: 8px;
    flex-shrink: 0;
}

.currency-symbol i {
    transition: color 0.2s ease;
}

#mxn-input {
    flex: 1 1 auto;
    border: none;
    background: transparent;
    outline: none !important;
    box-shadow: none !important;
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 16px 0;
    width: 100%;
}


#mxn-input::-webkit-outer-spin-button,
#mxn-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#mxn-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.1);
}

/* 货币代码标签 */
.currency-code {
    position: absolute;
    right: 75px; /* 按钮宽度120px + 20px间距 */
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    background: #f1f5f9;
    padding: 6px 12px;
    border-radius: 20px;
    z-index: 2;
}

/* 3%计算区域 */
.three-percent-section {
    padding: 10px 16px;
    background-color: #f7fafc; /* 柔和的灰色背景 */
    border-radius: 12px; /* 圆角 */
    border: 1px solid #e2e8f0; /* 浅灰色边框 */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/*.percent-badge {*/
/*    !* 再次调浅：更明亮的灰蓝色，接近中灰色调 *!*/
/*    background: rgba(55, 65, 85, 0.9);*/
/*    !* 字体颜色微调，保持最佳可读性 *!*/
/*    color: #f0f4f9;*/
/*    padding: 6px 16px;*/
/*    border-radius: var(--radius-sm);*/
/*    font-size: 14px;*/
/*    font-weight: 700;*/
/*    display: flex;*/
/*    align-items: baseline;*/
/*    !* 边框相应调浅以匹配 *!*/
/*    !*border: 1px solid rgba(255, 255, 255, 0.15);*!*/
/*}*/


.percent-badge {
    /* 浅灰色背景 */
    background: rgba(240, 240, 240, 0.95);
    /* 深黑色文字 */
    color: #222222;
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: baseline;
}

.three-percent-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.currency-unit {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 4px;
}

/* 主要按钮 */
.convert-button {
    position: absolute;
    right: 0px;
    top: 50%;
    transform: translateY(-50%);
    height: 44px; /* 设置固定高度 */
    width: 80px; /* 固定宽度 */
    padding: 0 10px; /* 移除垂直内边距 */
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.3);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* 添加间距 */
}

.convert-button:hover {
    box-shadow: 0 8px 30px rgba(255, 107, 53, 0.4); /* More pronounced shadow on hover */
}

.convert-button:active {
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3); /* 恢复部分阴影 */
}

/* 主操作按钮容器 */
.main-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end; /* 刷新按钮靠右 */
    gap: 16px;
    margin-bottom: 32px; /* 恢复下边距 */
}

.page-refresh-button {
    margin-left: auto; /* 将刷新按钮推到最右边 */
}

/* 页面刷新按钮 - 渐变图标风格 */
.page-refresh-button {
    flex-shrink: 0;
    width: 58px;
    height: 58px;
    background: transparent; /* 透明背景 */
    border: 1px solid var(--glass-border); /* 纤细的玻璃质感边框 */
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.page-refresh-button:hover {
    background: rgba(255, 107, 53, 0.1); /* 悬停时浮现淡橙色背景 */
    transform: rotate(360deg); /* 保留旋转动画 */
}

.page-refresh-button:active {
    background: rgba(255, 107, 53, 0.2); /* 点击时背景加深 */
    transform: scale(0.95) rotate(360deg); /* 增加一个轻微的缩放反馈 */
    transition-duration: 0.1s;
}

.page-refresh-button i {
    font-size: 24px; /* 稍微增大图标，使其更突出 */
    background: linear-gradient(135deg, var(--primary-light), var(--primary)); /* 应用主按钮的渐变 */
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent; /* Fallback */
    transition: transform 0.3s ease;
}

.convert-button i {
    margin-right: 12px;
    transition: transform 0.3s ease;
}

.convert-button:hover i {
    transform: rotate(15deg);
}

.view-records-button {
    display: block;
    width: 100%;
    padding: 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    margin-top: 24px; /* This is overridden for buttons in the flex container */
    box-shadow: 0 4px 20px rgba(6, 214, 160, 0.3);
}

.footer-buttons {
    display: flex;
    gap: 16px;
    margin-top: 18px;
}

.footer-buttons .view-records-button {
    margin-top: 0;
}

.view-records-button:hover {
    transform: translateY(-2px);
    background: #05b388; /* A slightly darker accent color for hover */
    box-shadow: 0 8px 30px rgba(6, 214, 160, 0.4);
}

.view-records-button[href="report.php"] {
    background: #3b82f6; /* A nice blue shade */
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.view-records-button[href="report.php"]:hover {
    background: #2563eb; /* A darker blue for hover */
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.4);
}

/* 图片记录按钮样式 - 紫色主题 */
.view-records-button[href="payins.php"] {
    background: #8b5cf6; /* A nice purple shade */
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.view-records-button[href="payins.php"]:hover {
    background: #7c3aed; /* A darker purple for hover */
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4);
}

/* OCR错误按钮样式 - 橙色主题 */
.view-records-button[href="ocr_err.php"] {
    background: #f97316; /* A nice orange shade */
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.3);
}

.view-records-button[href="ocr_err.php"]:hover {
    background: #ea580c; /* A darker orange for hover */
    box-shadow: 0 8px 30px rgba(249, 115, 22, 0.4);
}

.view-records-button i {
    margin-right: 10px;
}


/* 结果区域 */
.results-section {
    margin-top: 10px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.results-section.show {
    opacity: 1;
    transform: translateY(0);
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /*margin-bottom: 2px;*/
}

.section-title h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.refresh-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.refresh-btn:hover {
    color: var(--primary);
    background: rgba(255, 107, 53, 0.1);
}

/* 货币卡片 */
.currency-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 10px;
    margin-bottom: 2px;
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.currency-card:hover {
    transform: translateX(8px);
    border-color: rgba(255, 107, 53, 0.2);
    box-shadow: var(--shadow-md);
}

.records-table-wrapper {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.records-table .row-lowest,
.records-table .row-highest {
    position: relative;
    font-weight: bold;
}

/* The pseudo-element will be the background, so hide the cell's own background */
.records-table tbody .row-lowest td,
.records-table tbody .row-highest td {
    background-color: transparent !important;
    border-bottom-color: transparent; /* Hide the line separator for a cleaner look */
}

/* Create the background element */
.records-table .row-lowest::after,
.records-table .row-highest::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 12px; /* Increased radius */
    z-index: -1;
}

.records-table .row-lowest::after {
    background-color: #ffeeea; /* 柔和的玫瑰粉 */
}

.records-table .row-highest::after {
    background-color: #fef9c3; /* 淡雅的金色 */
}

/* Ensure the tr background is transparent to show the pseudo-element */
.records-table .row-lowest,
.records-table .row-highest,
.records-table .row-lowest:nth-child(odd),
.records-table .row-highest:nth-child(odd),
.records-table .row-lowest:hover,
.records-table .row-highest:hover {
    background-color: transparent !important;
}

.diff-tag {
    display: inline-block;
    padding: 6px;
    border-radius: 5px;
    font-size: 0.9em;
    font-weight: 600;
    line-height: 1.2;
    /*margin-left: 2px;*/
}

.diff-tag.diff-short {
    background-color: #f0fdf4;
    color: #15803d;
}

.diff-tag.diff-medium {
    background-color: #fef9c3;
    color: #854d0e;
}

.diff-tag.diff-long {
    background-color: #fff1f2;
    color: #991b1b;
}

.diff-tag.diff-neutral {
    background-color: #f3f4f6;
    color: #4b5563;
}

/* Back to Top Button */
#back-to-top-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    text-decoration: none;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s ease-in-out;
    z-index: 1000;
}

#back-to-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#back-to-top-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.currency-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--gradient);
}

.currency-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.currency-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1) 0%, rgba(30, 58, 138, 0.1) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.currency-details h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.currency-details .rate {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
    margin: 0;
}


.currency-amount {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
}

.currency-amount.usd {
    color: #10b981;
}

.currency-amount.cny {
    color: #ef4444;
}

/* 响应式辅助类 */
@media (max-width: 768px) {
    .mobile-hide {
        display: none !important;
    }
}