/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
}

/* 分类区域样式 */
.category-section {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.category-section h2 {
    margin-bottom: 15px;
    color: #34495e;
}

.categories {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.category-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-btn:hover {
    background-color: #e9ecef;
}

.category-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.add-category {
    display: flex;
    gap: 10px;
}

#new-category {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#add-category-btn {
    padding: 10px 20px;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#add-category-btn:hover {
    background-color: #219a52;
}

/* 龟列表网格样式 */
.turtle-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 1200px) {
    .turtle-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .turtle-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .turtle-grid {
        grid-template-columns: 1fr;
    }
}

.turtle-card {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.turtle-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 标签样式 */
.turtle-image {
    position: relative;
}

.name-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(0, 128, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 1;
}

.sold-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(128, 128, 128, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 1;
}

.price-tag {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background-color: rgba(255, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    z-index: 1;
}

.gender-tag {
    position: absolute;
    bottom: 10px;
    right: 10px;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    z-index: 1;
}

.gender-tag.gender-male {
    background-color: rgba(0, 123, 255, 0.8); /* 蓝色 - 代表公 */
}

.gender-tag.gender-female {
    background-color: rgba(255, 87, 34, 0.8); /* 粉色 - 代表母（少女色） */
}

.gender-tag.gender-unknown {
    background-color: rgba(128, 128, 128, 0.8); /* 灰色 - 代表未分 */
}

.notes-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.note-tag {
    background-color: #e3f2fd;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    color: #1976d2;
    border: 1px solid #bbdefb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.note-tag:hover {
    background-color: #bbdefb;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.turtle-image {
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    object-fit: cover;
    position: relative;
    overflow: hidden;
}

.turtle-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.turtle-info {
    padding: 15px;
}

.turtle-info h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.name-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.name-row h3 {
    margin: 0;
}

.price-right {
    margin: 0;
    font-size: 14px;
}

.detail-row.three-cols {
    display: flex;
    justify-content: space-between;
}

.detail-row.three-cols p:first-child {
    flex: 1;
    text-align: left;
}

.detail-row.three-cols p:nth-child(2) {
    flex: 1;
    text-align: center;
}

.detail-row.three-cols p:last-child {
    flex: 1;
    text-align: right;
}

.turtle-details {
    font-size: 14px;
    line-height: 1.5;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.detail-row p {
    flex: 1;
    margin: 0;
}

.turtle-details p {
    margin-bottom: 5px;
}

.turtle-details strong {
    color: #34495e;
}

.breeding-date {
    font-size: 16px;
    font-weight: bold;
    margin: 10px 0;
    color: #3498db;
}

/* 分页区域样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination button:hover:not(:disabled) {
    background-color: #f8f9fa;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-numbers {
    display: flex;
    gap: 5px;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-btn:hover {
    background-color: #f8f9fa;
}

.page-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .turtle-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .add-category {
        flex-direction: column;
    }
    
    #new-category {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .turtle-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 10px;
    }
}

/* 价格统计模块样式 */
.price-stats {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.price-stats h2 {
    margin-bottom: 15px;
    color: #34495e;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.stat-item {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.stat-item h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.stat-header h3 {
    margin: 0;
}

.stat-header #material-management-btn {
    padding: 4px 8px;
    font-size: 12px;
}

.stat-item p {
    font-size: 24px;
    font-weight: bold;
    color: #3498db;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* 通用提示弹窗样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: none;
    animation: slideIn 0.3s ease-out;
}

.notification-content {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    max-width: 400px;
    background-color: #fff;
}

.notification-icon {
    width: 24px;
    height: 24px;
    margin-right: 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.notification-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    margin-left: 12px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.notification-close:hover {
    background-color: #f0f0f0;
    color: #333;
}

/* 不同类型的弹窗样式 */
.notification.success .notification-icon {
    background-color: #d4edda;
    color: #155724;
}

.notification.success .notification-content {
    border-left: 4px solid #28a745;
}

.notification.error .notification-icon {
    background-color: #f8d7da;
    color: #721c24;
}

.notification.error .notification-content {
    border-left: 4px solid #dc3545;
}

.notification.info .notification-icon {
    background-color: #d1ecf1;
    color: #0c5460;
}

.notification.info .notification-content {
    border-left: 4px solid #17a2b8;
}

.notification.warning .notification-icon {
    background-color: #fff3cd;
    color: #856404;
}

.notification.warning .notification-content {
    border-left: 4px solid #ffc107;
}

/* 动画 */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.notification.slide-out {
    animation: slideOut 0.3s ease-in forwards;
}

/* 分类区域头部样式 */
.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#add-turtle-btn {
    padding: 8px 16px;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#add-turtle-btn:hover {
    background-color: #219a52;
}

#material-management-btn {
    padding: 8px 16px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#material-management-btn:hover {
    background-color: #2980b9;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.modal-header h2 {
    margin: 0;
    color: #34495e;
}

.modal-header button {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.modal-header button:hover {
    color: #333;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.total-amount {
    font-weight: bold;
    color: #34495e;
}

#total-material-amount {
    color: #e74c3c;
}

#add-material-btn {
    padding: 8px 16px;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#add-material-btn:hover {
    background-color: #219a52;
}

/* 物料分页样式 */
.material-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.material-pagination button {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.material-pagination button:hover:not(:disabled) {
    background-color: #f8f9fa;
}

.material-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.material-page-numbers {
    display: flex;
    gap: 5px;
}

.material-page-btn {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.material-page-btn:hover {
    background-color: #f8f9fa;
}

.material-page-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

/* 物料列表样式 */
.material-list {
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #3498db #f1f1f1;
}

/* 为WebKit浏览器添加滚动条样式 */
.material-list::-webkit-scrollbar {
    width: 8px;
}

.material-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.material-list::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 4px;
}

.material-list::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

/* 物料表格样式 */
.material-table {
    width: 100%;
    border-collapse: collapse;
}

.material-table th,
.material-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.material-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #34495e;
}

.material-table tr:hover {
    background-color: #f5f5f5;
}

.material-table td:last-child {
    display: flex;
    gap: 10px;
}

.material-actions {
    display: flex;
    gap: 10px;
}

.edit-btn, .delete-btn {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.edit-btn {
    background-color: #3498db;
    color: white;
}

.edit-btn:hover {
    background-color: #2980b9;
}

.delete-btn {
    background-color: #e74c3c;
    color: white;
}

.delete-btn:hover {
    background-color: #c0392b;
}

/* 表单样式 */
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #34495e;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

/* 图片上传和备注字段保持单独一行 */
.form-group.full-width {
    width: 100%;
    flex: none;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.form-actions {
    margin-top: 20px;
    text-align: right;
}

#save-material-btn,
#save-turtle-btn,
#save-edit-turtle-btn {
    padding: 12px 24px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#save-material-btn:hover,
#save-turtle-btn:hover,
#save-edit-turtle-btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* 日期输入框样式 */
input[type="date"] {
    cursor: pointer;
    position: relative;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    position: absolute;
    right: 10px;
    top: 0;
    bottom: 0;
    width: 20px;
    height: 20px;
    opacity: 1;
}

input[type="date"]::-moz-calendar-picker-indicator {
    cursor: pointer;
    position: absolute;
    right: 10px;
    top: 0;
    bottom: 0;
    width: 20px;
    height: 20px;
    opacity: 1;
}

/* 图片上传样式 */
.image-upload-container {
    margin-top: 10px;
}

.upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 20px;
    position: relative;
}

.upload-content {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

.upload-btn {
    width: 80px;
    height: 80px;
    border: 2px dashed #999;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-btn:hover {
    border-color: #4CAF50;
    color: #4CAF50;
}

.image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

.image-preview {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-image:hover {
    background: rgba(255, 0, 0, 1);
}

/* 暂无图片样式 */
.no-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    color: #6c757d;
    font-size: 16px;
    text-align: center;
    border: 1px dashed #dee2e6;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.no-image:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.no-image::before {
    content: "📷";
    font-size: 32px;
    margin-bottom: 8px;
}

/* 图片查看器样式 */
.image-viewer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.image-viewer.active {
    display: flex;
}

.image-viewer-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.image-viewer img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.image-viewer-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
}

.image-viewer-nav button {
    background-color: rgba(255, 255, 255, 0.3);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.image-viewer-nav button:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

.image-viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.3);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.image-viewer-close:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

.image-viewer-indicators {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.image-viewer-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.image-viewer-indicator.active {
    background-color: white;
    width: 20px;
    border-radius: 5px;
}

/* 图片卡片中的图片样式 */
.turtle-image img {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.turtle-image img:hover {
    transform: scale(1.05);
}