/* SeisoMaster - Style.css */
:root {
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --primary-dark: #3730A3;
    --secondary: #10B981;
    --accent: #F59E0B;
    --danger: #EF4444;
    --bg: #F8FAFC;
    --card-bg: #FFFFFF;
    --text: #1E293B;
    --text-light: #64748B;
    --border: #E2E8F0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding-bottom: 80px;
    -webkit-font-smoothing: antialiased;
}

/* Top Navigation */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
}

.nav-icons {
    display: flex;
    gap: 8px;
}

.nav-btn {
    background: var(--bg);
    border: none;
    padding: 10px 14px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
}

.nav-btn:hover { background: var(--primary-light); color: white; }

/* Main Layout */
.main-content {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    gap: 24px;
    padding: 24px;
}

/* Sidebar */
.sidebar {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.sidebar-section h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
}

.streak-box {
    text-align: center;
    padding: 12px;
    background: linear-gradient(135deg, #F59E0B, #EF4444);
    border-radius: var(--radius-sm);
    color: white;
}

.streak-number { font-size: 24px; font-weight: 800; }
.streak-label { font-size: 14px; }

.xp-box {
    text-align: center;
    padding: 16px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    margin-top: 8px;
}

.xp-label { font-size: 14px; opacity: 0.8; }
.xp-value { font-size: 28px; font-weight: 800; }

.mission-item {
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-light);
}

.mission-item.completed { color: var(--secondary); }
.mission-item.pending { color: var(--text-light); }

.perf-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.bar-bg {
    flex: 1;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 8px;
}

.bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s;
}

.bar-fill.warn { background: var(--accent); }
.bar-fill.complete { background: var(--secondary); }

.goal-box {
    margin-bottom: 12px;
}

.goal-label {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 4px;
}

.goal-progress {
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.goal-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 0.3s;
}

.goal-sub { font-size: 12px; color: var(--text-light); }

.ai-tip {
    font-size: 13px;
    font-style: italic;
    color: var(--text-light);
    margin-bottom: 12px;
    padding: 12px;
    background: linear-gradient(135deg, #EEF2FF, #E0E7FF);
    border-radius: var(--radius-xs);
}

.ai-recommend { display: flex; flex-direction: column; gap: 8px; }
.rec-item { font-size: 13px; padding: 8px; background: var(--bg); border-radius: var(--radius-xs); }

.desktop-only { display: none; }

/* Center Content */
.center-content { flex: 1; min-width: 0; }

/* Pages */
.page { display: none; }
.page.active { display: block; }

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
}

.subtitle {
    color: var(--text-light);
    font-size: 16px;
    margin-top: 4px;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

/* Feed Filters */
.feed-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Post Cards */
.post-card { margin-bottom: 20px; }

.post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.post-meta { display: flex; flex-direction: column; }
.post-meta strong { font-size: 15px; }
.post-time { font-size: 13px; color: var(--text-light); }

.post-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    width: fit-content;
    margin-top: 4px;
}

.jlpt-tag { background: #DBEAFE; color: #1E40AF; }
.tokutei-tag { background: #D1FAE5; color: #065F46; }
.cleaning-tag { background: #FEF3C7; color: #92400E; }

.post-body p { margin-bottom: 12px; font-size: 15px; }
.post-quote {
    font-style: italic;
    color: var(--text-light);
    border-left: 3px solid var(--primary);
    padding-left: 12px;
}

.score-box {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 20px;
    border-radius: var(--radius-sm);
    text-align: center;
    margin: 12px 0;
}

.score-value { font-size: 32px; font-weight: 800; }
.score-label { font-size: 14px; opacity: 0.9; }

.badge-box { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.badge {
    padding: 6px 12px;
    background: var(--bg);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* Progress Bar */
.progress-container { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
}

.progress-text { font-size: 14px; font-weight: 600; color: var(--primary); }

/* Post Actions */
.post-actions {
    display: flex;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-light);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

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

/* Course Cards */
.course-card { cursor: pointer; transition: all 0.2s; }
.course-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

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

.course-level {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
}

.course-streak {
    font-size: 14px;
    background: var(--bg);
    padding: 4px 12px;
    border-radius: 20px;
}

.course-body { margin-bottom: 20px; }

.course-progress { margin-bottom: 16px; }
.progress-label { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.progress-bar.big { height: 12px; }

.subject-bars { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }

.subject-item {
    display: flex;
    align-items: center;
    font-size: 13px;
    gap: 8px;
}

.subject-item span:first-child { width: 80px; color: var(--text-light); }
.subject-item span:last-child { width: 40px; text-align: right; font-weight: 600; }

.today-mission {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.today-mission h4 { font-size: 14px; margin-bottom: 8px; }

/* Course Grid */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Narrow Page */
.narrow-page { max-width: 640px; margin: 0 auto; }

/* JLPT N3 Detail */
.n3-progress { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.subject-progress { display: flex; align-items: center; gap: 12px; }
.subject-progress .progress-bar { flex: 1; }
.subject-progress span:last-child { font-weight: 600; min-width: 40px; text-align: right; }

.section-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-bottom: 24px;
    padding-bottom: 8px;
}

.section-tab {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: white;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.section-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

.continue-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: linear-gradient(135deg, #EEF2FF, #E0E7FF);
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
}

.continue-title { font-weight: 700; }
.continue-sub { font-size: 13px; color: var(--text-light); }

.recommend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.recommend-card {
    padding: 20px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.recommend-card:hover { box-shadow: var(--shadow); }
.rec-icon { font-size: 32px; margin-bottom: 8px; }
.rec-title { font-weight: 700; font-size: 14px; }
.rec-desc { font-size: 13px; color: var(--text-light); }

/* Tokutei Progress */
.tokutei-progress { margin-bottom: 24px; }
.overall-progress { text-align: center; padding: 20px; background: var(--bg); border-radius: var(--radius-sm); }

.module-list { display: flex; flex-direction: column; gap: 12px; }

.module-card {
    padding: 16px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
}

.module-card:hover { box-shadow: var(--shadow-lg); }

.module-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.module-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.module-title { font-weight: 700; }
.module-progress { font-weight: 600; color: var(--primary); }

/* Quiz */
.quiz-card { text-align: center; }
.quiz-progress-bar { height: 4px; background: var(--bg); border-radius: 2px; margin-bottom: 24px; overflow: hidden; }
.quiz-progress-bar .progress-fill { height: 100%; width: 60%; }

.question-text { font-size: 18px; font-weight: 600; margin-bottom: 24px; line-height: 1.6; }

.quiz-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.quiz-option {
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s;
    text-align: left;
}

.quiz-option:hover { border-color: var(--primary); background: #EEF2FF; }

.quiz-result { margin-top: 24px; padding: 24px; border-radius: var(--radius-sm); }
.quiz-result.correct { background: #D1FAE5; }
.quiz-result.incorrect { background: #FEE2E2; }

.result-icon { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.result-answer { font-size: 18px; font-weight: 700; }
.result-explanation { font-size: 14px; color: var(--text-light); margin: 8px 0; }
.result-xp { font-size: 20px; font-weight: 800; color: var(--secondary); }

/* Community */
.community-list { display: flex; flex-direction: column; gap: 16px; }

.community-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.community-icon { font-size: 40px; }

.community-info { flex: 1; }
.community-info h3 { font-size: 16px; margin-bottom: 4px; }

.community-stats { display: flex; gap: 16px; font-size: 13px; color: var(--text-light); }

/* Create Post */
.create-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.create-option {
    text-align: center;
    padding: 20px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.create-option:hover { background: #EEF2FF; }
.create-option-icon { font-size: 28px; margin-bottom: 8px; }
.create-option-title { font-size: 13px; font-weight: 600; }

.example-post { text-align: center; padding: 20px; }

/* Profile */
.profile-card { text-align: center; padding: 32px; }

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 800;
    margin: 0 auto 16px;
}

.profile-name { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.profile-country { color: var(--text-light); margin-bottom: 12px; }

.profile-tags { display: flex; justify-content: center; gap: 8px; margin-bottom: 16px; }
.tag {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.profile-stats { display: flex; justify-content: center; gap: 32px; margin-bottom: 24px; }
.stat-value { font-size: 24px; font-weight: 800; }
.stat-label { font-size: 14px; color: var(--text-light); }

.course-list { display: flex; flex-direction: column; gap: 8px; }

.course-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-xs);
}

.course-item-title { font-weight: 600; }
.course-item-status { font-size: 13px; }

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.badge-card {
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}

/* Leaderboard */
.leaderboard-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.leaderboard-list { display: flex; flex-direction: column; gap: 8px; }

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.rank { font-size: 24px; }
.name { flex: 1; font-weight: 600; }
.xp { color: var(--primary); font-weight: 700; }

/* AI Sensei */
.ai-chat-box {
    padding: 24px;
    background: linear-gradient(135deg, #EEF2FF, #E0E7FF);
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.ai-avatar { font-size: 32px; margin-bottom: 12px; }
.ai-message p { margin-bottom: 8px; font-size: 15px; }
.ai-message code {
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
}

.ai-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.ai-quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

/* Study Journey */
.journey-timeline { display: flex; flex-direction: column; gap: 0; }

.journey-step {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
}

.step-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.journey-step.completed .step-icon { background: var(--secondary); }
.journey-step.completed .step-icon { color: white; }
.journey-step.current .step-icon { background: var(--primary); color: white; }
.journey-step.pending .step-icon { background: var(--border); }

.step-info h3 { font-size: 16px; margin-bottom: 2px; }
.step-info p { font-size: 13px; color: var(--text-light); }

.journey-connector {
    width: 2px;
    height: 24px;
    background: var(--border);
    margin-left: 35px;
}

.journey-connector.completed { background: var(--secondary); }

/* Toast */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
}

.toast.show { opacity: 1; }

/* Bottom Navigation */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
    padding: 8px 0;
    z-index: 100;
}

.bottom-nav-btn {
    background: none;
    border: none;
    padding: 8px 16px;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
}

.bottom-nav-btn.active { color: var(--primary); }
.bottom-nav-btn:hover { color: var(--primary); }

/* Desktop Layout */
@media (min-width: 1024px) {
    .sidebar { display: flex; }
    .bottom-nav { display: none; }
    .desktop-only { display: block; }
    body { padding-bottom: 0; }
}

@media (max-width: 1023px) {
    .sidebar { display: none; }
    .main-content { flex-direction: column; padding: 16px; }
    .course-grid { grid-template-columns: 1fr; }
}

/* Responsive */
@media (max-width: 640px) {
    .top-nav { padding: 12px 16px; }
    .nav-brand { font-size: 16px; }
    .page-header h1 { font-size: 22px; }
    .quiz-options { grid-template-columns: 1fr; }
    .community-card { flex-direction: column; text-align: center; }
    .profile-stats { gap: 16px; }
    .achievement-grid { grid-template-columns: repeat(2, 1fr); }
}
