/* ===== Base Styles ===== */
* { box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; }

/* ===== Loading Spinner ===== */
.loading-spinner {
    width: 40px; height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Hero Section ===== */
.hero-section {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 30%, #10b981 70%, #059669 100%);
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: pulse-bg 4s ease-in-out infinite;
}
@keyframes pulse-bg {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* ===== Feature Cards ===== */
.feature-card {
    background: white;
    border-radius: 16px;
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.04);
}
.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(59,130,246,0.15);
    border-color: #bfdbfe;
}
.feature-card:active { transform: translateY(-2px); }
.feature-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 10px;
}

/* ===== Buttons ===== */
.btn-primary {
    background: linear-gradient(135deg, #2563eb, #10b981);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 15px;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-primary-white {
    background: white;
    color: #2563eb;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.btn-primary-white:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }

.btn-secondary-white {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    border: 2px solid rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 16px;
    backdrop-filter: blur(4px);
}
.btn-secondary-white:hover { background: rgba(255,255,255,0.3); border-color: white; }

.btn-outline {
    background: white;
    color: #374151;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 500;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}
.btn-outline:hover { border-color: #3b82f6; color: #3b82f6; background: #eff6ff; }

/* ===== Form Styles ===== */
.form-section {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.form-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #eff6ff;
}
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}
.input-field {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    transition: border-color 0.2s;
    background: #fafafa;
    outline: none;
}
.input-field:focus { border-color: #3b82f6; background: white; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }

/* ===== Result Cards ===== */
.result-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}
.score-item {
    background: #f9fafb;
    border-radius: 12px;
    padding: 14px;
    border-left: 4px solid #3b82f6;
}
.score-item.excellent { border-left-color: #10b981; }
.score-item.good { border-left-color: #3b82f6; }
.score-item.fair { border-left-color: #f59e0b; }
.score-item.poor { border-left-color: #ef4444; }

.grade-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.grade-excellent { background: #d1fae5; color: #059669; }
.grade-good { background: #dbeafe; color: #2563eb; }
.grade-fair { background: #fef3c7; color: #d97706; }
.grade-poor { background: #fee2e2; color: #dc2626; }

/* ===== Plan Tabs ===== */
.plan-tab {
    padding: 8px 20px;
    border-radius: 20px;
    border: 1.5px solid #e5e7eb;
    background: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}
.plan-tab.active {
    background: linear-gradient(135deg, #2563eb, #10b981);
    color: white;
    border-color: transparent;
}
.plan-tab:hover:not(.active) { border-color: #3b82f6; color: #3b82f6; }

/* ===== Day Card ===== */
.day-card {
    background: white;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid #f3f4f6;
}
.day-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.day-number {
    background: linear-gradient(135deg, #2563eb, #10b981);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}
.day-goal {
    font-size: 14px;
    color: #6b7280;
}

/* ===== Chat Styles ===== */
.chat-msg { display: flex; gap: 10px; }
.chat-msg.user { flex-direction: row-reverse; }
.chat-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    background: #eff6ff;
}
.chat-msg.user .chat-avatar { background: #d1fae5; }
.chat-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
}
.chat-msg.ai .chat-bubble { background: #f3f4f6; color: #1f2937; border-top-left-radius: 4px; }
.chat-msg.user .chat-bubble { background: linear-gradient(135deg, #2563eb, #10b981); color: white; border-top-right-radius: 4px; }

/* ===== Homework Card ===== */
.homework-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    margin-bottom: 16px;
}
.checkin-btn {
    padding: 8px 16px;
    border-radius: 10px;
    border: 1.5px solid #e5e7eb;
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.checkin-btn:hover { border-color: #10b981; }
.checkin-btn.selected { background: #d1fae5; border-color: #10b981; color: #059669; }

.feeling-btn {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid #e5e7eb;
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.feeling-btn:hover { border-color: #3b82f6; }
.feeling-btn.selected { background: #dbeafe; border-color: #3b82f6; color: #2563eb; }

/* ===== Sports List Card ===== */
.sport-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 16px;
}
.sport-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(59,130,246,0.12); border-color: #bfdbfe; }
.sport-card-icon {
    width: 56px; height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

/* ===== Video Placeholder ===== */
.video-placeholder {
    background: linear-gradient(135deg, #1e293b, #334155);
    border-radius: 12px;
    aspect-ratio: 16/9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    margin-bottom: 16px;
}
.video-placeholder .play-icon { font-size: 48px; margin-bottom: 8px; }

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .hero-section { min-height: 260px; }
    .hero-section h1 { font-size: 28px; }
    .chat-bubble { max-width: 85%; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ===== Animations ===== */
.fade-in { animation: fadeIn 0.3s ease-in; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Typing indicator ===== */
.typing-indicator { display: flex; gap: 4px; padding: 8px 0; }
.typing-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typingBounce 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}
