/* ========== Modern Accounting App Styles ========== */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Arial, sans-serif;
    font-size: 14px;
    color: #2c3e50;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e9f0 100%);
    min-height: 100vh;
    line-height: 1.6;
}

a {
    color: #4a90e2;
    text-decoration: none;
    transition: all 0.25s ease;
}
a:hover { color: #2c5f9e; text-decoration: none; }

/* ---------- Navigation Bar ---------- */
.navbar {
    max-width: 1100px;
    margin: 12px auto 0;
    padding: 0 16px;
}
.navbar-inner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px -6px rgba(102, 126, 234, 0.4);
    flex-wrap: wrap;
    gap: 4px;
}
.navbar a {
    color: #fff;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    font-size: 13px;
}
.navbar a:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.navbar .user-label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    padding: 4px 12px;
    font-size: 13px;
}

/* ---------- Main Container ---------- */
.container {
    max-width: 1100px;
    margin: 10px auto;
    padding: 0 16px;
}

/* ---------- Card ---------- */
.card {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 14px 16px;
    margin-bottom: 12px;
    transition: box-shadow 0.3s ease;
}
.card:hover { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); }

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-title::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 14px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

.welcome-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 10px;
    padding: 10px 18px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 6px 20px -6px rgba(102, 126, 234, 0.4);
}

/* ---------- Statistics Grid ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}
.stat-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 10px 8px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    border-top: 2px solid transparent;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}
.stat-card.income { border-top-color: #3498db; }
.stat-card.expense { border-top-color: #e74c3c; }
.stat-card.balance { border-top-color: #2ecc71; }
.stat-label {
    font-size: 12px;
    color: #7f8c8d;
    font-weight: 500;
    margin-bottom: 3px;
}
.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
}
.stat-value.income { color: #3498db; }
.stat-value.expense { color: #e74c3c; }
.stat-value.balance { color: #2ecc71; }

/* ---------- Modern Table ---------- */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.data-table thead th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #495057;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 9px 12px;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
}
.data-table tbody td {
    padding: 7px 12px;
    text-align: center;
    border-bottom: 1px solid #f0f2f5;
    font-size: 13px;
    color: #495057;
    transition: background 0.2s ease;
}
.data-table tbody tr:hover td {
    background: #f8f9ff;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.tag-income {
    display: inline-block;
    padding: 2px 8px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.tag-expense {
    display: inline-block;
    padding: 2px 8px;
    background: #ffebee;
    color: #c62828;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.action-link {
    color: #667eea;
    margin: 0 2px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 5px;
    transition: all 0.2s ease;
    font-size: 12px;
}
.action-link:hover {
    background: #eef2ff;
    color: #764ba2;
}

/* ---------- Stats Table (for index.php top section) ---------- */
.stats-table {
    margin-bottom: 0;
}
.stats-table .row-label {
    font-weight: 600;
    font-size: 13px;
    text-align: center;
    padding: 9px 12px;
}
.stats-table .row-label.expense { color: #e74c3c; }
.stats-table .row-label.income { color: #2980b9; }
.stats-table .row-label.balance { color: #27ae60; }
.stats-table td {
    text-align: center;
    padding: 8px 12px;
    font-size: 15px;
}
.stats-summary {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f2f5;
    font-weight: 600;
    color: #2c3e50;
    font-size: 13px;
    text-align: center;
}

/* ---------- Pagination ---------- */
.pagination {
    text-align: center;
    margin-top: 10px;
    padding: 8px 0;
    color: #7f8c8d;
    font-weight: 500;
    font-size: 13px;
}
.pagination a, .pagination span {
    display: inline-block;
    padding: 4px 10px;
    margin: 0 2px;
    border-radius: 5px;
    font-weight: 500;
    font-size: 12px;
    transition: all 0.2s ease;
}
.pagination a {
    background: #f8f9fa;
    color: #4a90e2;
    text-decoration: none;
}
.pagination a:hover {
    background: #667eea;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.3);
}
.pagination .current {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.3);
}
.pagination .ellipsis {
    color: #95a5a6;
    padding: 4px 2px;
    font-weight: 400;
}

/* ---------- Forms ---------- */
.modern-form {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    max-width: 460px;
    margin: 20px auto;
}
.modern-form h2 {
    font-size: 18px;
    color: #2c3e50;
    margin-bottom: 18px;
    font-weight: 700;
    text-align: center;
}
.form-group {
    margin-bottom: 14px;
}
.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: #495057;
    font-size: 13px;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.25s ease;
    background: #f8fafc;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 7px 18px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    font-family: inherit;
}
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.35);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(102, 126, 234, 0.5);
    color: #fff;
}
.btn-secondary {
    background: #f1f3f5;
    color: #495057;
}
.btn-secondary:hover {
    background: #e9ecef;
    color: #2c3e50;
    transform: translateY(-1px);
}
.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: #fff;
    box-shadow: 0 3px 10px rgba(238, 90, 111, 0.35);
}
.btn-danger:hover {
    transform: translateY(-1px);
    color: #fff;
}
.form-actions {
    text-align: center;
    margin-top: 16px;
}

/* ---------- Two-Column Form Layout ---------- */
.form-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 12px;
}
.form-grid-2col .card {
    margin-bottom: 0;
}
.card-title.income-title::before {
    background: linear-gradient(180deg, #3498db 0%, #1abc9c 100%);
}
.card-title.expense-title::before {
    background: linear-gradient(180deg, #e74c3c 0%, #c0392b 100%);
}

/* ---------- Inline Forms (for tianjia.php) ---------- */
.modern-form-inline {
    width: 100%;
}
.modern-form-inline .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}
.modern-form-inline .form-group {
    flex: 1 1 140px;
    margin-bottom: 0;
    min-width: 120px;
}
.modern-form-inline .form-actions-inline {
    flex: 0 0 auto;
    margin-bottom: 0;
}
.modern-form-inline input[type="submit"] {
    margin-bottom: 0;
}

/* ---------- Login Page ---------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-attachment: fixed;
}
.login-card {
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    animation: fadeInUp 0.5s ease-out;
}
.login-card h1 {
    font-size: 22px;
    color: #2c3e50;
    margin-bottom: 6px;
    text-align: center;
    font-weight: 700;
}
.login-card .subtitle {
    text-align: center;
    color: #8492a6;
    font-size: 13px;
    margin-bottom: 20px;
}
.login-section {
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px dashed #e1e8ed;
}
.login-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.login-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.login-section-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}
.login-link {
    color: #667eea;
    font-weight: 500;
    font-size: 12px;
    display: inline-block;
    margin-top: 6px;
}
.login-link:hover { text-decoration: underline; }

/* ---------- Alerts ---------- */
.alert {
    padding: 9px 14px;
    border-radius: 8px;
    margin: 8px 0;
    font-weight: 500;
    font-size: 13px;
    animation: fadeIn 0.4s ease;
}
.alert-success {
    background: #e6f7ed;
    color: #1e8449;
    border-left: 3px solid #2ecc71;
}
.alert-error {
    background: #fdecea;
    color: #c0392b;
    border-left: 3px solid #e74c3c;
}
.alert-info {
    background: #e8f4fd;
    color: #2874a6;
    border-left: 3px solid #3498db;
}

/* ---------- Footer ---------- */
.footer {
    text-align: center;
    padding: 14px;
    color: #95a5a6;
    font-size: 12px;
    margin-top: 20px;
}

/* ---------- Animations ---------- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(25px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---------- Page Transitions ---------- */
.fade-in {
    animation: fadeIn 0.5s ease;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .navbar-inner { padding: 10px; gap: 6px; }
    .navbar a, .navbar .user-label { padding: 6px 10px; font-size: 13px; }
    .card { padding: 16px; }
    .login-card { padding: 28px 22px; }
    .data-table { font-size: 13px; }
    .data-table thead th, .data-table tbody td { padding: 10px 8px; }
    .form-grid-2col { grid-template-columns: 1fr; }
    .modern-form-inline .form-row { flex-direction: column; }
    .modern-form-inline .form-group { flex: 1 1 100%; min-width: 100%; }
    .modern-form-inline .form-actions-inline { width: 100%; }
    .modern-form-inline .form-actions-inline .btn { width: 100%; }
}
