/* Custom styles for book management system */

body {
    background-color: #f8f9fa;
}

.navbar-brand {
    font-weight: bold;
}

.card {
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table {
    background-color: white;
}

.badge {
    font-size: 0.85em;
}

.btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Responsive table improvements */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: 0.375rem !important;
        margin-bottom: 0.25rem;
    }
}

/* Custom color for net investment */
.text-danger {
    color: #dc3545 !important;
}

.text-success {
    color: #198754 !important;
}

/* Form improvements */
.form-label {
    font-weight: 500;
    color: #495057;
}

/* Alert improvements */
.alert {
    border-radius: 8px;
}

/* Card hover effects */
.card:hover {
    transform: translateY(-2px);
    transition: transform 0.2s ease-in-out;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.card-body h3, .card-body h4 {
    margin-bottom: 0.5rem;
}

.card-text {
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* Button improvements */
.btn {
    border-radius: 6px;
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-danger:hover {
    transform: translateY(-1px);
    transition: transform 0.1s ease-in-out;
}

/* Loading states */
.btn:disabled {
    cursor: not-allowed;
}

/* Custom spacing */
.g-3 > * {
    padding: 0.75rem;
}

/* ==== 首页现代化样式 ==== */

/* 统计卡片样式 */
.stats-card {
    position: relative;
    background: white;
    border-radius: 16px;
    padding: 24px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    height: 120px;
}

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

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.stats-card-books {
    --primary-color: #4f46e5;
    --secondary-color: #7c3aed;
}

.stats-card-purchase {
    --primary-color: #059669;
    --secondary-color: #0d9488;
}

.stats-card-sale {
    --primary-color: #dc2626;
    --secondary-color: #ea580c;
}

.stats-card-expense {
    --primary-color: #b91c1c;
    --secondary-color: #dc2626;
}

.stats-card-profit {
    --primary-color: #059669;
    --secondary-color: #0891b2;
}

.stats-icon {
    font-size: 32px;
    position: absolute;
    top: 20px;
    right: 20px;
    opacity: 0.7;
}

.stats-content {
    position: relative;
    z-index: 1;
}

.stats-number {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    line-height: 1.1;
    margin-bottom: 4px;
}

.stats-label {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 2px;
}

.stats-subtitle {
    font-size: 12px;
    color: #9ca3af;
}

.stats-decoration {
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    opacity: 0.1;
}

/* 章节标题 */
.section-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0;
}

.section-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin-top: 4px;
}

/* 本月动态卡片 */
.monthly-overview-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.04);
    margin-bottom: 32px;
}

.monthly-stat-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.monthly-stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.monthly-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 16px;
    position: relative;
    z-index: 1;
}

.purchase-icon {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
}

.sale-icon {
    background: linear-gradient(135deg, #fce7f3, #fbcfe8);
    color: #be185d;
}

.limit-icon {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #d97706;
}

.monthly-stat-number {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    line-height: 1;
}

.monthly-stat-label {
    font-size: 14px;
    color: #6b7280;
    margin-top: 4px;
}

/* 进度条样式 */
.monthly-progress-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.progress-text {
    font-size: 14px;
    color: #6b7280;
}

.modern-progress {
    height: 8px;
    border-radius: 4px;
    background: #f3f4f6;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.modern-progress .progress-bar {
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    border-radius: 4px;
    transition: width 0.6s ease;
    position: relative;
}

.modern-progress .progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg,
        transparent 25%,
        rgba(255,255,255,0.15) 25%,
        rgba(255,255,255,0.15) 50%,
        transparent 50%,
        transparent 75%,
        rgba(255,255,255,0.15) 75%);
    background-size: 10px 10px;
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    0% { background-position-x: 10px; }
}

/* 快速添加区域样式 */
.quick-add-section {
    position: sticky;
    top: 20px;
}

.quick-add-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

/* 表单现代化样式 */
.modern-label {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    font-size: 14px;
}

.label-icon {
    margin-right: 8px;
    font-size: 16px;
}

.required-mark {
    color: #ef4444;
    margin-left: 4px;
}

.input-wrapper {
    position: relative;
    margin-bottom: 0;
}

.modern-input {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 16px;
    transition: all 0.3s ease;
    font-size: 14px;
    background: #fafafa;
    position: relative;
    z-index: 1;
}

.modern-input:focus {
    outline: none;
    border-color: #4f46e5;
    background: white;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-focus-border {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    border-radius: 1px;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.modern-input:focus + .input-focus-border {
    transform: scaleX(1);
}

.input-suffix {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-size: 14px;
    pointer-events: none;
}

/* 类型选择器样式 */
.type-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.type-option {
    position: relative;
}

.type-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.type-label {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.type-label:hover {
    border-color: #d1d5db;
    background: #f3f4f6;
}

.type-radio:checked + .type-label {
    border-color: #4f46e5;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
}

.type-icon {
    font-size: 24px;
    margin-right: 12px;
}

.type-content {
    flex: 1;
}

.type-title {
    font-weight: 600;
    color: #111827;
    font-size: 14px;
    line-height: 1.2;
}

.type-desc {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.type-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    position: relative;
    transition: all 0.3s ease;
}

.type-radio:checked + .type-label .type-indicator {
    border-color: #4f46e5;
    background: #4f46e5;
}

.type-radio:checked + .type-label .type-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* 状态提示样式 */
.status-alerts {
    margin-bottom: 16px;
}

.status-alert {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    animation: slideIn 0.3s ease;
}

.warning-alert {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
}

.info-alert {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border: 1px solid #3b82f6;
}

.alert-icon {
    font-size: 20px;
    margin-right: 12px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    color: #111827;
    font-size: 13px;
    line-height: 1.2;
}

.alert-desc {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 现代化按钮样式 */
.modern-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 48px;
}

.btn-icon {
    margin-right: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.btn-text {
    transition: all 0.3s ease;
}

.btn-loading {
    position: absolute;
    display: none;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.modern-submit-btn.loading {
    cursor: not-allowed;
    opacity: 0.8;
}

.modern-submit-btn.success {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: #059669;
}

.modern-submit-btn.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: #dc2626;
}

.modern-submit-btn:hover:not(:disabled):not(.loading) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* 快捷操作样式 */
.quick-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #f8fafc;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    color: #6b7280;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.quick-action-btn:hover {
    background: #f1f5f9;
    border-color: #9ca3af;
    color: #374151;
    text-decoration: none;
}

.action-icon {
    margin-right: 8px;
    font-size: 16px;
}

/* 图表区域样式 */
.chart-section {
    margin-top: 32px;
}

.section-header-with-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.section-header-left {
    flex: 1;
}

.chart-controls {
    margin-left: 20px;
}

.chart-tabs {
    display: flex;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.chart-tab {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chart-tab:hover {
    color: #374151;
    background: rgba(255, 255, 255, 0.5);
}

.chart-tab.active {
    background: white;
    color: #4f46e5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tab-icon {
    margin-right: 6px;
    font-size: 14px;
}

.chart-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.chart-container {
    position: relative;
    height: 400px;
    padding: 20px;
}

.chart-content {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.chart-content.show {
    opacity: 1;
    pointer-events: auto;
}

.chart-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
}

.chart-legend {
    display: flex;
    gap: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: #6b7280;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 8px;
}

.purchase-color {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
}

.sale-color {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.chart-tips {
    display: flex;
    gap: 12px;
}

.tip-item {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #9ca3af;
}

.tip-icon {
    margin-right: 4px;
    font-size: 14px;
}

/* 信息按钮样式 */
.info-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 2px solid #e0f2fe;
    background: linear-gradient(135deg, #e0f7fa, #b2ebf2);
    color: #0891b2;
    transition: all 0.3s ease;
}

.info-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.3);
}

.info-icon {
    font-size: 14px;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .stats-card {
        height: auto;
        min-height: 100px;
        padding: 20px 16px;
    }

    .stats-number {
        font-size: 24px;
    }

    .monthly-stat-item {
        padding: 12px;
    }

    .chart-container {
        height: 300px;
    }

    .section-header-with-controls {
        flex-direction: column;
        gap: 16px;
    }

    .chart-controls {
        margin-left: 0;
    }

    .chart-footer {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .quick-add-section {
        position: static;
        margin-top: 32px;
    }
}


/* ========== 趣味统计样式（更新版） ========== */
.fun-stats-section {
    margin-top: -16px;
    margin-bottom: 64px;
}

.fun-stats-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 24px;
}

.fun-stats-loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.fun-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.fun-stats-grid-more {
    display: none;
    margin-top: 0;
    animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fun-stat-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    min-width: 0;
    overflow: hidden;
}

.fun-stat-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.fun-stat-item .stat-icon {
    font-size: 36px;
    line-height: 1;
    flex-shrink: 0;
}

.fun-stat-item .stat-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.fun-stat-item .stat-label {
    font-size: 13px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.fun-stat-item .stat-value {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-all;
}

.fun-stat-item .stat-detail {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fun-stats-footer {
    text-align: center;
    padding-top: 12px;
    border-top: 2px dashed #e9ecef;
    display: none;
}

.btn-view-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-view-more:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-view-more .expand-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
}

/* 响应式优化 */
@media (max-width: 992px) {
    .fun-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .fun-stats-grid {
        grid-template-columns: 1fr;
    }

    .fun-stat-item {
        padding: 16px;
    }

    .fun-stat-item .stat-icon {
        font-size: 28px;
    }
}

/* 统计项右上角的查看更多按钮 */
.fun-stat-item {
    position: relative;
}

.stat-more-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.fun-stat-item:hover .stat-more-btn {
    opacity: 1;
}

.stat-more-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.stat-more-btn .more-icon {
    line-height: 1;
    transform: rotate(90deg);
}

/* TOP5模态框样式 */
.top5-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.top5-item:hover {
    background: #e9ecef;
    transform: translateX(4px);
}

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

.top5-rank {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
}

.top5-item:nth-child(1) .top5-rank {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
}

.top5-item:nth-child(2) .top5-rank {
    background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
}

.top5-item:nth-child(3) .top5-rank {
    background: linear-gradient(135deg, #CD7F32 0%, #B8860B 100%);
}

.top5-content {
    flex: 1;
    min-width: 0;
}

.top5-title {
    font-size: 15px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top5-author {
    font-size: 13px;
    color: #6c757d;
}

.top5-value {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}
