/* 随礼记账系统 - 自定义样式 */

/* ==================== 基础样式 ==================== */
:root {
    --primary-color: #4a90e2;
    --primary-dark: #357abd;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-bg: #f8f9fa;
    --dark-text: #333;
    --border-color: #dee2e6;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.16);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding-top: 70px;
    padding-bottom: 80px;
    color: var(--dark-text);
}

/* ==================== 导航栏 ==================== */
.navbar {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--primary-color) !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-brand .logo-icon {
    width: 32px;
    height: 32px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    color: var(--secondary-color);
    font-size: 0.9rem;
    font-weight: 500;
}

/* ==================== 底部导航 ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    border-top: 1px solid var(--border-color);
}

.nav-item-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 0;
    text-decoration: none;
    color: var(--secondary-color);
    transition: var(--transition);
    cursor: pointer;
}

.nav-item-wrapper:hover {
    color: var(--primary-color);
    background: rgba(74, 144, 226, 0.05);
}

.nav-item-wrapper.active {
    color: var(--primary-color);
    font-weight: 600;
}

.nav-item-icon {
    width: 24px;
    height: 24px;
    opacity: 0.8;
    transition: var(--transition);
}

.nav-item-wrapper.active .nav-item-icon {
    opacity: 1;
    transform: scale(1.1);
}

.nav-item-text {
    font-size: 0.75rem;
    text-align: center;
}

/* ==================== 卡片样式 ==================== */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    overflow: hidden;
    background: white;
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    font-weight: 600;
    padding: 1rem 1.5rem;
    border: none;
}

.card-title {
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.card-body {
    padding: 1.5rem;
}

/* ==================== 统计卡片 ==================== */
.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card.danger::before {
    background: linear-gradient(90deg, #dc3545, #c82333);
}

.stat-card.success::before {
    background: linear-gradient(90deg, #28a745, #218838);
}

.stat-card.info::before {
    background: linear-gradient(90deg, #17a2b8, #138496);
}

.stat-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    opacity: 0.9;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--secondary-color);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-text);
    margin: 0;
}

.stat-value.text-danger {
    color: var(--danger-color) !important;
}

.stat-value.text-success {
    color: var(--success-color) !important;
}

/* ==================== 按钮样式 ==================== */
.btn {
    border-radius: 8px;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #2c5f8f);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #218838);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #218838, #1e7e34);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333, #bd2130);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-outline-secondary {
    border: 2px solid var(--secondary-color);
    color: var(--secondary-color);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--secondary-color);
    color: white;
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
}

/* ==================== 表单样式 ==================== */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 0.6rem 1rem;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.25);
}

.form-label {
    font-weight: 500;
    color: var(--dark-text);
    margin-bottom: 0.5rem;
}

/* ==================== 表格样式 ==================== */
.table-responsive {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    font-weight: 600;
    border: none;
    padding: 1rem;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: rgba(74, 144, 226, 0.05);
}

.table td {
    padding: 1rem;
    vertical-align: middle;
}

.table-striped tbody tr:nth-of-type(odd) {
    background: rgba(0, 0, 0, 0.02);
}

/* ==================== 进度条样式 ==================== */
.progress {
    height: 12px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
    transition: width 0.6s ease;
}

.progress-bar.bg-danger {
    background: linear-gradient(90deg, #dc3545, #c82333);
}

/* ==================== 警告框样式 ==================== */
.alert {
    border-radius: var(--border-radius);
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 500;
}

.alert-success {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1), rgba(40, 167, 69, 0.2));
    color: #155724;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(220, 53, 69, 0.2));
    color: #721c24;
}

.alert-info {
    background: linear-gradient(135deg, rgba(23, 162, 184, 0.1), rgba(23, 162, 184, 0.2));
    color: #0c5460;
}

/* ==================== 登录页面样式 ==================== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-card {
    max-width: 450px;
    width: 100%;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 2rem;
    text-align: center;
}

.login-header h4 {
    margin: 0;
    font-weight: 700;
}

.login-body {
    padding: 2rem;
    background: white;
}

/* ==================== 图表容器 ==================== */
.chart-container {
    position: relative;
    height: 300px;
    padding: 1rem;
}

/* ==================== 响应式设计 ==================== */
@media (min-width: 768px) {
    body {
        padding-top: 80px;
        padding-bottom: 0;
    }

    .bottom-nav {
        position: static;
        box-shadow: none;
        border-top: none;
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 2rem;
    }

    .nav-item-wrapper {
        flex-direction: row;
        gap: 8px;
        padding: 1rem;
    }

    .nav-item-icon {
        width: 20px;
        height: 20px;
    }

    .nav-item-text {
        font-size: 1rem;
    }

    .chart-container {
        height: 400px;
    }
}

@media (max-width: 767px) {
    .stat-value {
        font-size: 1.5rem;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
    }

    .card-body {
        padding: 1rem;
    }

    .table {
        font-size: 0.875rem;
    }

    .table td, .table th {
        padding: 0.75rem 0.5rem;
    }
}

/* ==================== 动画效果 ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-up {
    animation: slideInUp 0.4s ease-out;
}

/* ==================== 工具提示 ==================== */
.tooltip-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    background: var(--info-color);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    cursor: help;
    margin-left: 5px;
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--secondary-color);
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1.1rem;
    font-weight: 500;
}

/* ==================== 容器 ==================== */
.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ==================== 预算进度 ==================== */
.budget-progress-wrapper {
    margin-top: 1rem;
}

.budget-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.budget-info-label {
    color: var(--secondary-color);
}

.budget-info-value {
    font-weight: 600;
}

/* ==================== Toast通知 ==================== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    max-width: 350px;
}

.toast-item {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 10px;
    overflow: hidden;
    transition: var(--transition);
}

.toast-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
}

.toast-message {
    flex: 1;
    margin-right: 1rem;
    font-weight: 500;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--secondary-color);
    cursor: pointer;
    transition: var(--transition);
}

.toast-close:hover {
    color: var(--dark-text);
}

.toast-info {
    border-left: 4px solid var(--info-color);
}

.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-danger {
    border-left: 4px solid var(--danger-color);
}

.toast-warning {
    border-left: 4px solid var(--warning-color);
}

/* ==================== 输入高亮动画 ==================== */
.highlight-input {
    animation: highlightPulse 1s ease-in-out;
}

@keyframes highlightPulse {
    0%, 100% {
        border-color: var(--border-color);
        background: white;
    }
    50% {
        border-color: var(--success-color);
        background: rgba(40, 167, 69, 0.1);
    }
}

/* ==================== 加载动画 ==================== */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15rem;
}

/* ==================== 按钮组样式 ==================== */
.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.btn-group .btn:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* ==================== 响应式表格增强 ==================== */
@media (max-width: 767px) {
    .toast-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* ==================== 平滑滚动 ==================== */
html {
    scroll-behavior: smooth;
}
