/* 兽医AI助手 - 主样式表 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background-color: #f5f5f5;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #4A90E2, #5B9BD5);
    color: white;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    position: relative;
    height: 60px;
}

.status-bar {
    position: absolute;
    top: -25px;
    left: 0;
    right: 0;
    height: 25px;
    background: linear-gradient(135deg, #4A90E2, #5B9BD5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    font-size: 14px;
    color: white;
}

.back-arrow {
    font-size: 18px;
    cursor: pointer;
    transition: opacity 0.3s ease;
    position: relative;
    z-index: 100;
    padding: 5px 10px;
}

.back-arrow:hover {
    opacity: 0.8;
}

.title {
    font-size: 18px;
    font-weight: 500;
    flex: 1;
    text-align: center;
    margin-left: -30px;
}

/* 内容区域 */
.content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.required-star {
    color: #ff4444;
    margin-right: 5px;
}

/* 自定义下拉网格选择器 */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-select-trigger:hover {
    border-color: #4A90E2;
}

.dropdown-arrow {
    transition: transform 0.3s ease;
    color: #999;
}

.custom-select-trigger.open .dropdown-arrow {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
}

.animal-grid {
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.animal-category {
    min-width: 0;
    background: #f8fbff;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 12px;
}

.category-title {
    font-size: 14px;
    font-weight: 600;
    color: #4A90E2;
    margin-bottom: 12px;
    padding: 6px 10px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #4A90E2;
}

.animal-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.animal-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 6px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f8f9fa;
}

.animal-item:hover {
    background: #e3f2fd;
    border-color: #4A90E2;
    transform: translateY(-1px);
}

.animal-item.selected {
    background: #4A90E2;
    color: white;
    border-color: #2c5aa0;
}

.animal-emoji {
    font-size: 20px;
    margin-bottom: 4px;
}

.animal-name {
    font-size: 11px;
    font-weight: 500;
    text-align: center;
}

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

    .animal-items {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 症状描述区域 */
.symptom-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e0e0e0;
}

.voice-button {
    background: linear-gradient(135deg, #4A90E2, #5B9BD5);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 30px;
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.voice-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.voice-button:active {
    transform: translateY(0);
}

.voice-button.recording {
    background: linear-gradient(135deg, #ff4444, #ff6666);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.voice-icon {
    width: 20px;
    height: 20px;
}

.symptom-text {
    width: 100%;
    display: block;
    box-sizing: border-box;
    margin: 0;
    color: #333;
    font-size: 14px;
    line-height: 1.6;
    min-height: 80px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px;
    outline: none;
    resize: vertical;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    transition: border-color 0.3s ease;
}

.symptom-text:focus {
    border-color: #4A90E2;
}

.symptom-text::placeholder {
    color: #999;
}

/* 照片上传区域 */
.photo-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    text-align: center;
    transition: all 0.3s ease;
}

.photo-section:hover {
    border-color: #4A90E2;
    background-color: #f8fbff;
}

.upload-icon {
    width: 60px;
    height: 60px;
    background: #f0f0f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 24px;
}

.upload-icon:hover {
    background: #e0e8f0;
    transform: scale(1.05);
}

.upload-text {
    color: #999;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.upload-text:hover {
    color: #4A90E2;
}

/* 底部按钮 */
.bottom-button {
    background: linear-gradient(135deg, #4A90E2, #5B9BD5);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 15px;
    font-size: 18px;
    cursor: pointer;
    margin: 20px;
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

.bottom-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.bottom-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Modal样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.show {
    display: block;
}

.modal-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-cancel {
    color: #666;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.modal-cancel:hover {
    background: #f0f0f0;
    color: #333;
}

/* 动物网格 - Modal版本（已废弃，保留以防兼容性） */
.modal .animal-grid {
    padding: 20px;
}

.modal .animal-category {
    margin-bottom: 25px;
}

.modal .category-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    background: white;
    padding: 5px 0;
}

.animal-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.animal-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex: 1;
    margin-right: 10px;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.animal-item:last-child {
    margin-right: 0;
}

.animal-item:hover {
    background: #f8fbff;
    transform: translateY(-2px);
}

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

.animal-radio.selected {
    border-color: #4A90E2;
    animation: selectPulse 0.3s ease;
}

@keyframes selectPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.animal-radio.selected::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 10px;
    height: 10px;
    background: #4A90E2;
    border-radius: 50%;
}

.animal-icon {
    width: 30px;
    height: 30px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: transform 0.3s ease;
}

.animal-item:hover .animal-icon {
    transform: scale(1.1);
}

.animal-name {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

/* 错误消息 */
.error-message {
    background: #ffebee;
    color: #d32f2f;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 14px;
    border-left: 4px solid #d32f2f;
    animation: fadeIn 0.3s ease;
}

.success-message {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 14px;
    border-left: 4px solid #2e7d32;
    animation: fadeIn 0.3s ease;
}

/* 加载状态 */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* 响应式设计 */
@media (max-width: 480px) {
    .content {
        padding: 15px;
    }

    .section {
        margin-bottom: 20px;
    }

    .animal-row {
        flex-direction: column;
        gap: 10px;
    }

    .animal-item {
        margin-right: 0;
        justify-content: flex-start;
    }
}

/* 可访问性改进 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 焦点状态 */
.voice-button:focus,
.bottom-button:focus,
.animal-selector:focus,
.modal-cancel:focus {
    outline: 2px solid #4A90E2;
    outline-offset: 2px;
}

/* 打印样式 */
@media print {
    .header,
    .bottom-button,
    .modal {
        display: none;
    }

    body {
        height: auto;
        background: white;
    }

    .content {
        padding: 0;
    }
}

/* 底部弹出层样式 */
.animal-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.animal-picker-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    z-index: 9999;
    max-height: 70vh;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.animal-picker-sheet.show {
    transform: translateY(0);
}

.picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.picker-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.picker-close {
    font-size: 24px;
    color: #999;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.picker-close:hover {
    background: #f5f5f5;
}

.picker-content {
    overflow-y: auto;
    max-height: calc(70vh - 70px);
    -webkit-overflow-scrolling: touch;
}