:root {
    --primary-color: #FF6B9D;
    --primary-dark: #E85A8A;
    --secondary-color: #4ECDC4;
    --accent-color: #FFE66D;
    --bg-primary: #FFF5F7;
    --bg-secondary: #FFFFFF;
    --text-primary: #2D3748;
    --text-secondary: #718096;
    --border-color: #E2E8F0;
    --shadow-sm: 0 2px 8px rgba(255, 107, 157, 0.08);
    --shadow-md: 0 4px 16px rgba(255, 107, 157, 0.12);
    --shadow-lg: 0 8px 32px rgba(255, 107, 157, 0.16);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background: linear-gradient(135deg, #FFF5F7 0%, #FFE8EE 50%, #FFF0F5 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    display: flex;
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
}

/* ========== 侧边栏样式 ========== */
.sidebar {
    width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    animation: slideInLeft 0.6s ease-out;
}

.logo-icon {
    font-size: 36px;
    animation: bounce 2s infinite;
}

.logo h1 {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 用户信息区域 */
.user-info-section {
    margin-bottom: 24px;
    animation: slideInLeft 0.6s ease-out;
}

.user-card {
    background: linear-gradient(135deg, #FFF 0%, #FFF5F7 100%);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-sm);
}

.user-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

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

.btn-logout {
    width: 36px;
    height: 36px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-logout:hover {
    border-color: var(--primary-color);
    background: var(--bg-primary);
    transform: scale(1.05);
}

/* 离线模式提示 */
.offline-notice {
    margin-bottom: 24px;
    animation: slideInLeft 0.6s ease-out;
}

.offline-card {
    background: linear-gradient(135deg, #FFF9E6 0%, #FFE8E8 100%);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid var(--accent-color);
}

.offline-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.offline-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
}

.offline-text div {
    font-weight: 500;
    margin-bottom: 2px;
}

.login-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 12px;
    transition: var(--transition);
}

.login-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.pet-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.pet-list-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-add-pet {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-add-pet:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.pets-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pet-item {
    background: linear-gradient(135deg, #FFF 0%, #FFF5F7 100%);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
    animation: slideInLeft 0.4s ease-out backwards;
}

.pet-item:hover {
    border-color: var(--primary-color);
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.pet-item.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.pet-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.pet-item-icon {
    font-size: 32px;
}

.pet-item-name {
    font-size: 16px;
    font-weight: 600;
}

.pet-item-info {
    font-size: 13px;
    opacity: 0.8;
    margin-left: 44px;
}

/* ========== 主内容区样式 ========== */
.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

/* 欢迎页面 */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    animation: fadeIn 0.8s ease-out;
}

.welcome-content {
    text-align: center;
    animation: floatUp 0.8s ease-out;
}

.welcome-icon {
    font-size: 120px;
    margin-bottom: 24px;
    animation: bounce 2s infinite;
}

.welcome-content h2 {
    font-family: 'Playfair Display', serif;
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.welcome-content p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* 宠物详情页面 */
.pet-detail {
    animation: fadeIn 0.6s ease-out;
}

.pet-header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #FFF 100%);
    border-radius: var(--radius-lg);
    padding: 32px;
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-md);
    animation: slideInDown 0.6s ease-out;
}

.pet-avatar {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.6s ease-out;
}

.pet-info {
    flex: 1;
}

.pet-info h2 {
    font-family: 'Playfair Display', serif;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.pet-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    color: var(--text-secondary);
}

.separator {
    color: var(--border-color);
}

.pet-actions {
    display: flex;
    gap: 12px;
}

.btn-icon {
    width: 44px;
    height: 44px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: var(--radius-sm);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    border-color: var(--primary-color);
    transform: scale(1.1);
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    animation: scaleIn 0.4s ease-out backwards;
    position: relative;
    cursor: move;
    cursor: grab;
}

.stat-card:active {
    cursor: grabbing;
}

.stat-card.dragging {
    opacity: 0.5;
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.stat-card.drag-over {
    border: 2px dashed var(--primary-color);
    background: linear-gradient(135deg, #FFF 0%, #FFF5F7 100%);
}

.drag-handle {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 16px;
    color: var(--text-secondary);
    opacity: 0;
    transition: var(--transition);
    cursor: grab;
    user-select: none;
}

.stat-card:hover .drag-handle {
    opacity: 0.6;
}

.drag-handle:hover {
    opacity: 1;
    color: var(--primary-color);
}

.drag-handle:active {
    cursor: grabbing;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 36px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 400;
}

/* 备注信息 - 紧凑显示在头部 */
.pet-notes-compact {
    margin-top: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #FFF9E6 0%, #FFE8E8 100%);
    border-left: 4px solid var(--accent-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: start;
    gap: 10px;
    animation: slideInDown 0.4s ease-out 0.3s backwards;
}

.notes-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.notes-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
    flex: 1;
    word-break: break-word;
}

/* 标签页 */
.tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
    animation: slideInUp 0.6s ease-out;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tab-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 记录列表 */
.records-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.record-item {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    animation: slideInUp 0.4s ease-out backwards;
}

.record-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.record-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.record-date {
    font-size: 14px;
    color: var(--text-secondary);
}

.record-delete {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
    transition: var(--transition);
}

.record-delete:hover {
    opacity: 1;
    transform: scale(1.2);
}

.record-content {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
    font-size: 16px;
}

/* ========== 按钮样式 ========== */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-large {
    padding: 16px 48px;
    font-size: 18px;
}

.btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 10px 28px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* ========== 模态框样式 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-close {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.btn-close:hover {
    color: var(--primary-color);
    transform: rotate(90deg);
}

/* ========== 表单样式 ========== */
form {
    padding: 32px;
}

.form-group {
    margin-bottom: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: 'Noto Sans SC', sans-serif;
    color: var(--text-primary);
    transition: var(--transition);
    background: white;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.1);
}

textarea {
    resize: vertical;
}

/* 开关按钮样式 */
.toggle-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.toggle-label span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
}

.toggle-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: var(--transition);
    border-radius: 28px;
    border: none;
    padding: 0;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.2);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
}

/* 删除宠物区域 */
.delete-section {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 2px solid var(--border-color);
}

.delete-warning {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, #FFF3F3 0%, #FFE8E8 100%);
    border-left: 4px solid #FF4444;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.warning-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.warning-text strong {
    display: block;
    color: #D32F2F;
    font-size: 15px;
    margin-bottom: 4px;
}

.warning-text p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

.btn-delete {
    width: 100%;
    background: #FF4444;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-delete:hover {
    background: #D32F2F;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3);
}

.btn-delete:active {
    transform: translateY(0);
}

/* ========== 动画 ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes floatUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ========== 响应式设计 ========== */
@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
    
    .main-content {
        padding: 24px;
    }
}

/* ========== 头像上传样式 ========== */
.avatar-upload-section {
    display: flex;
    gap: 24px;
    align-items: center;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 2px dashed var(--border-color);
    transition: var(--transition);
}

.avatar-upload-section:hover {
    border-color: var(--primary-color);
    background: #FFF0F5;
}

.avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
    position: relative;
}

.avatar-placeholder {
    font-size: 60px;
    filter: brightness(1.2);
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-upload-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-upload {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
}

.btn-upload:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-remove-avatar {
    padding: 8px 16px;
    background: #EF4444;
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
}

.btn-remove-avatar:hover {
    background: #DC2626;
    transform: translateY(-1px);
}

.upload-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .main-content {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-btn {
        white-space: nowrap;
    }
    
    .avatar-upload-section {
        flex-direction: column;
        text-align: center;
    }
    
    .avatar-upload-controls {
        align-items: center;
    }
    
    .btn-upload,
    .btn-remove-avatar {
        align-self: center;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .pet-header {
        flex-direction: column;
        text-align: center;
    }
    
    .pet-actions {
        width: 100%;
        justify-content: center;
    }
}
