/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
header {
    background-color: #4CAF50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.8rem;
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-left: 20px;
}

nav ul li a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

nav ul li a:hover {
    color: #e0e0e0;
}

.auth-buttons button {
    background-color: #fff;
    color: #4CAF50;
    border: none;
    padding: 8px 16px;
    margin-left: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.auth-buttons button:hover {
    background-color: #f0f0f0;
}

/* 主要内容样式 */
main {
    min-height: calc(100vh - 140px);
}

.hero {
    background-color: #f5f5f5;
    padding: 60px 0;
    text-align: center;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #333;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: #666;
}

body.mobile-ui-active {
    background: #020611;
    overflow: hidden;
}

body.desktop-ui-forced {
    overflow: auto;
    background: #fff;
}

body.desktop-ui-forced .mobile-command-center {
    display: none !important;
}

.mobile-command-center {
    position: fixed;
    inset: 0;
    padding: 24px 18px 32px;
    background: radial-gradient(circle at 20% 20%, rgba(81,125,255,0.18), transparent 55%),
                radial-gradient(circle at 90% 10%, rgba(76,175,80,0.2), transparent 45%),
                linear-gradient(140deg, #050913 0%, #010308 100%);
    display: none;
    z-index: 1200;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.mobile-ui-active .mobile-command-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.mobile-panel {
    width: min(520px, 100%);
    border-radius: 28px;
    background: rgba(3,7,18,0.92);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 35px 80px rgba(0,0,0,0.55);
    padding: 20px 20px 24px;
    color: #dfe7ff;
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    transition: transform 0.25s ease;
}

.mobile-panel.is-dragging {
    transition: none;
    box-shadow: 0 45px 110px rgba(0,0,0,0.65);
}

.mobile-panel.collapsed .mobile-body {
    display: none;
}

.mobile-panel.collapsed {
    width: auto;
    padding-bottom: 12px;
}

.mobile-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.mobile-chip {
    display: inline-flex;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(76,175,80,0.18);
    color: #9ff5c8;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mobile-panel-header h3 {
    margin: 6px 0 0;
    font-size: 1.3rem;
}

.mobile-retreat-btn {
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255,255,255,0.1);
    color: #e4ecff;
    font-size: 1rem;
    cursor: pointer;
}

.mobile-viewfinder {
    position: relative;
    height: 280px;
    border-radius: 22px;
    overflow: hidden;
    background: #050b18;
    border: 1px solid rgba(255,255,255,0.04);
}

.mobile-viewfinder video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mobile-scan-veil {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent, rgba(22,102,255,0.2), transparent);
    animation: mobileSweep 4s ease-in-out infinite;
    pointer-events: none;
}

.mobile-status,
.mobile-report {
    border-radius: 16px;
    padding: 12px 14px;
    font-size: 0.95rem;
    line-height: 1.4;
    border: 1px solid rgba(255,255,255,0.05);
}

.mobile-status {
    background: rgba(15,30,52,0.85);
    color: #8ecbff;
}

.mobile-status.status-success {
    background: rgba(8,40,26,0.8);
    color: #9ff5c8;
}

.mobile-status.status-error {
    background: rgba(40,10,10,0.85);
    color: #ffc7c7;
}

.mobile-report {
    background: rgba(10,24,18,0.85);
    color: #9ff5c8;
}

.mobile-report.status-info {
    background: rgba(10,24,18,0.85);
}

.mobile-report.status-error {
    background: rgba(40,10,10,0.85);
    color: #ffc7c7;
}

.mobile-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.mobile-controls button {
    border: none;
    border-radius: 16px;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.mobile-controls .primary {
    background: linear-gradient(120deg, #4CAF50, #7dffb5);
    color: #022312;
    box-shadow: 0 12px 25px rgba(76,175,80,0.35);
}

.mobile-controls .secondary {
    background: rgba(255,255,255,0.08);
    color: #e2e9ff;
    border: 1px solid rgba(255,255,255,0.08);
}

.mobile-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mobile-log {
    max-height: 120px;
    overflow-y: auto;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.05);
    background: rgba(3,8,18,0.85);
    padding: 12px 14px;
    font-size: 0.85rem;
    color: rgba(223,231,255,0.85);
}

.mobile-log p {
    margin-bottom: 6px;
}

.mobile-command-center.collapsed {
    align-items: flex-start;
}

@keyframes mobileSweep {
    0% { transform: translateY(-100%); opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translateY(100%); opacity: 0; }
}

@media (max-width: 520px) {
    .mobile-panel {
        border-radius: 22px;
        padding: 18px;
    }

    .mobile-controls {
        grid-template-columns: 1fr;
    }
}

.mobile-cruise-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4CAF50 0%, #7dffb5 100%);
    border: none;
    box-shadow: 0 8px 24px rgba(76, 175, 80, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
    color: #022312;
    font-size: 28px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    touch-action: manipulation;
}

.mobile-cruise-fab:active {
    transform: scale(0.95);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
}

.mobile-cruise-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(76, 175, 80, 0.5), 0 6px 16px rgba(0, 0, 0, 0.35);
}

body.desktop-ui-forced .mobile-cruise-fab {
    display: flex;
}

@media (min-width: 769px) {
    .mobile-cruise-fab {
        display: none !important;
    }
}

/* Location FAB styles */
.location-fab {
    position: fixed;
    bottom: 100px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 24px;
    background: linear-gradient(135deg, #2196F3 0%, #64B5F6 100%);
    border: none;
    box-shadow: 0 8px 24px rgba(33, 150, 243, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: none;
    z-index: 1101;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    touch-action: manipulation;
}

.location-fab:active {
    transform: scale(0.95);
}

.location-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(33, 150, 243, 0.5), 0 6px 16px rgba(0, 0, 0, 0.35);
}

.desktop-location-btn {
    margin: 16px auto;
    padding: 12px 24px;
    border-radius: 8px;
    background: linear-gradient(135deg, #2196F3 0%, #64B5F6 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.desktop-location-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(33, 150, 243, 0.4);
}

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

/* Location modal styles */
.location-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.location-modal-content {
    background: white;
    padding: 24px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.location-modal-content h3 {
    margin-bottom: 20px;
    color: #333;
}

.location-modal-content .form-group {
    margin-bottom: 16px;
}

.location-modal-content label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.location-modal-content input,
.location-modal-content select,
.location-modal-content textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

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

.location-modal-content .btn-primary,
.location-modal-content .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.location-modal-content .btn-primary {
    background: #2196F3;
    color: white;
}

.location-modal-content .btn-primary:hover {
    background: #1976D2;
}

.location-modal-content .btn-secondary {
    background: #f5f5f5;
    color: #333;
}

.location-modal-content .btn-secondary:hover {
    background: #e0e0e0;
}

#joinUsBtn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#joinUsBtn:hover {
    background-color: #45a049;
}

section {
    padding: 60px 0;
}

section h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2rem;
    color: #333;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: modalopen 0.4s;
}

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

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 20px;
}

.close:hover,
.close:focus {
    color: #000;
}

.modal-content h2 {
    margin-top: 0;
    text-align: center;
    color: #333;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    resize: vertical;
}

.form-group input:focus {
    border-color: #4CAF50;
    outline: none;
}

.modal-content button {
    width: 100%;
    background-color: #4CAF50;
    color: white;
    padding: 12px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.modal-content button:hover {
    background-color: #45a049;
}

.cat-search {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cat-search input {
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #ddd;
    font-size: 16px;
}

.cat-search small {
    color: #666;
}

.status-message {
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 0.95rem;
}

.status-success {
    background-color: #d4edda;
    color: #155724;
}

.status-error {
    background-color: #f8d7da;
    color: #721c24;
}

.status-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

.cat-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-bottom: 8px;
    background-color: #f1f1f1;
    color: #555;
}

.cat-status-adopted {
    background-color: #ffe0b2;
    color: #d35400;
}

.modal-content p {
    text-align: center;
    margin-top: 20px;
}

.modal-content a {
    color: #4CAF50;
    text-decoration: none;
}

.modal-content a:hover {
    text-decoration: underline;
}

/* 猫咪列表样式 */
.cat-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.no-cats {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #666;
    border: 1px dashed #ddd;
    border-radius: 8px;
    background-color: #fafafa;
}

.adoption-cat-summary {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #eee;
}

.cat-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.cat-card:hover {
    transform: translateY(-5px);
}

.cat-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.cat-card .info {
    padding: 15px;
}

.cat-card h3 {
    margin-bottom: 10px;
    color: #333;
}

.cat-card p {
    color: #666;
    margin-bottom: 10px;
}

/* 页脚样式 */
footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: auto;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        text-align: center;
    }
    
    nav ul {
        margin: 20px 0;
    }
    
    nav ul li {
        margin: 0 10px;
    }
    
    .auth-buttons {
        margin-top: 10px;
    }
    
    .hero h2 {
        font-size: 2rem;
    }
    
    .hero .container {
        text-align: left;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .hero p {
        font-size: 1rem;
        color: #4a5b63;
    }

    #joinUsBtn {
        width: 100%;
    }

    .mobile-hero {
        display: block;
    }

    section {
        padding: 40px 0;
    }
    
    section h2 {
        font-size: 1.5rem;
    }
}

/* 用户信息样式 */
.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
}

.user-info span {
    color: white;
    font-weight: bold;
}

.user-info button {
    background-color: #ff6b6b;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.user-info button:hover {
    background-color: #ff5252;
}

.btn-primary,
.btn-secondary {
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.btn-primary {
    background-color: #4CAF50;
    color: #fff;
}

.btn-secondary {
    background-color: #6c757d;
    color: #fff;
}

.btn-primary:hover,
.btn-secondary:hover {
    opacity: 0.85;
}

.recognition-section {
    background-color: #f9f9f9;
}

.recognition-intro {
    text-align: center;
    max-width: 720px;
    margin: 0 auto 24px;
    color: #555;
}

.recognition-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: flex-start;
}

.recognition-controls {
    flex: 1 1 320px;
    background-color: #fff;
    border: 1px solid #e4e4e4;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.recognition-video {
    width: 100%;
    max-height: 320px;
    background-color: #000;
    border-radius: 6px;
    object-fit: cover;
}

.recognition-buttons {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.recognition-buttons button {
    flex: 1;
}

.recognition-divider {
    text-align: center;
    margin: 16px 0;
    color: #888;
    font-size: 0.9rem;
}

.file-upload {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
    color: #333;
    margin-top: 8px;
}

.file-upload input {
    margin-top: 4px;
}

.recognition-status {
    margin-top: 12px;
    font-size: 0.9rem;
    min-height: 1.2em;
    color: #555;
}

.recognition-status.success {
    color: #2f8f46;
}

.recognition-status.error {
    color: #c0392b;
}

.recognition-results {
    flex: 1 1 320px;
    background-color: #fff;
    border: 1px solid #e4e4e4;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    min-height: 320px;
}

.recognition-placeholder {
    color: #777;
    margin: 0;
}

.recognition-result-card {
    border-bottom: 1px solid #eee;
    padding: 12px 0;
}

.recognition-result-card:last-child {
    border-bottom: none;
}

.recognition-result-card h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
}

.recognition-result-card p {
    margin: 4px 0;
    color: #555;
    font-size: 0.9rem;
}

.recognition-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: #eef2f7;
    color: #53738c;
    font-size: 0.75rem;
    margin-right: 6px;
}

@media (max-width: 768px) {
    .recognition-wrapper {
        flex-direction: column;
    }

    .recognition-buttons {
        flex-direction: column;
    }
}