/* ATP Design System — Mobile First */
:root {
    --primary: #6C63FF;
    --primary-dark: #3F3D9E;
    --primary-light: #A5A0FF;
    --success: #4CAF50;
    --warning: #FF9800;
    --danger: #FF6B6B;
    --info: #2196F3;
    --bg: #f5f6fa;
    --card: #ffffff;
    --text: #1a1a2e;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --nav-height: 64px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Screens */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

/* Login Screen */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px 24px;
    background: linear-gradient(180deg, #6C63FF 0%, #3F3D9E 100%);
}
.logo-area { text-align: center; margin-bottom: 40px; }
.logo-icon { font-size: 64px; margin-bottom: 12px; }
.logo-area h1 { color: white; font-size: 48px; font-weight: 800; letter-spacing: 2px; }
.tagline { color: rgba(255,255,255,0.9); font-size: 18px; margin-top: 4px; }
.subtitle { color: rgba(255,255,255,0.65); font-size: 13px; margin-top: 12px; line-height: 1.5; }
.select-label { color: rgba(255,255,255,0.7); font-size: 14px; margin-bottom: 16px; text-align: center; }

.profile-btn {
    display: flex; align-items: center; gap: 14px;
    width: 100%; padding: 16px 20px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius);
    color: white; cursor: pointer;
    margin-bottom: 12px;
    transition: all 0.2s;
    text-align: left;
}
.profile-btn:hover, .profile-btn:active { background: rgba(255,255,255,0.25); transform: scale(1.02); }
.profile-icon { font-size: 32px; }
.profile-name { font-size: 16px; font-weight: 600; display: block; }
.profile-desc { font-size: 12px; opacity: 0.75; display: block; }

/* App Header */
.app-header {
    position: sticky; top: 0; z-index: 10;
    padding: 16px 20px 12px;
    display: flex; justify-content: space-between; align-items: center;
}
.student-header { background: linear-gradient(135deg, #6C63FF, #8B83FF); color: white; }
.teacher-header { background: linear-gradient(135deg, #2196F3, #42A5F5); color: white; }
.parent-header { background: linear-gradient(135deg, #4CAF50, #66BB6A); color: white; }
.greeting { font-size: 18px; font-weight: 700; display: block; }
.date-label { font-size: 12px; opacity: 0.8; }
.header-right { display: flex; gap: 8px; align-items: center; }
.xp-badge, .streak-badge {
    background: rgba(255,255,255,0.2);
    padding: 4px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
}
.icon-btn {
    background: rgba(255,255,255,0.2); border: none;
    width: 40px; height: 40px; border-radius: 50%;
    font-size: 18px; cursor: pointer; position: relative;
}
.notif-dot {
    position: absolute; top: 6px; right: 6px;
    width: 8px; height: 8px; background: var(--danger);
    border-radius: 50%;
}

/* Content */
.app-content { padding: 16px 20px 80px; }
.section-title { font-size: 15px; font-weight: 700; margin: 20px 0 12px; color: var(--text); }

/* Alert Card */
.alert-card {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; border-radius: var(--radius);
    background: var(--card); box-shadow: var(--shadow);
}
.alert-card.urgent { border-left: 4px solid var(--danger); }
.alert-icon { font-size: 24px; }
.alert-text { flex: 1; }
.alert-text strong { display: block; font-size: 14px; }
.alert-text span { font-size: 12px; color: var(--text-light); }
.btn-review {
    background: var(--primary); color: white; border: none;
    padding: 8px 16px; border-radius: 8px; font-size: 13px;
    font-weight: 600; cursor: pointer;
}
.btn-review:active { background: var(--primary-dark); }

/* Progress Rings */
.progress-cards { display: flex; gap: 12px; }
.progress-card {
    flex: 1; background: var(--card); border-radius: var(--radius);
    padding: 16px 12px; text-align: center; box-shadow: var(--shadow);
}
.ring {
    width: 64px; height: 64px; margin: 0 auto 8px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: conic-gradient(var(--color) calc(var(--progress) * 3.6deg), #e8e8e8 0);
    position: relative;
}
.ring::before {
    content: ''; position: absolute;
    width: 48px; height: 48px; background: var(--card);
    border-radius: 50%;
}
.ring span { position: relative; z-index: 1; font-size: 14px; font-weight: 700; }
.progress-label { font-size: 11px; color: var(--text-light); }

/* Calendar List */
.calendar-list { display: flex; flex-direction: column; gap: 8px; }
.cal-item {
    display: flex; align-items: center; gap: 14px;
    background: var(--card); padding: 14px 16px;
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.cal-item.urgent { border-left: 3px solid var(--danger); }
.cal-date { text-align: center; min-width: 42px; }
.cal-day { display: block; font-size: 22px; font-weight: 800; color: var(--primary); }
.cal-month { display: block; font-size: 10px; color: var(--text-light); text-transform: uppercase; }
.cal-info { flex: 1; }
.cal-info strong { display: block; font-size: 14px; }
.cal-info span { font-size: 12px; color: var(--text-light); }
.cal-tag {
    padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600;
}
.tag-prova { background: #ffe0e0; color: #d32f2f; }
.tag-trabalho { background: #e3f2fd; color: #1565c0; }

/* Badges */
.badges-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.badge {
    min-width: 80px; text-align: center; padding: 12px 8px;
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); font-size: 28px;
}
.badge span { display: block; font-size: 10px; color: var(--text-light); margin-top: 4px; }
.badge.locked { opacity: 0.4; filter: grayscale(1); }

/* Teacher — Quick Actions */
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 8px; }
.qa-btn {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 14px 8px; background: var(--card); border: none;
    border-radius: var(--radius); box-shadow: var(--shadow);
    cursor: pointer; font-size: 12px; color: var(--text); font-weight: 500;
}
.qa-btn:active { background: #eee; }
.qa-icon { font-size: 24px; }

/* Teacher — Class List */
.class-list { display: flex; flex-direction: column; gap: 8px; }
.class-item {
    display: flex; align-items: center; gap: 14px;
    background: var(--card); padding: 14px 16px;
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.class-item.current { border-left: 3px solid var(--info); background: #f0f7ff; }
.class-item.done { opacity: 0.6; }
.class-time { font-size: 14px; font-weight: 700; color: var(--primary); min-width: 50px; }
.class-info { flex: 1; }
.class-info strong { display: block; font-size: 14px; }
.class-info span { font-size: 12px; color: var(--text-light); }
.class-status { font-size: 14px; }
.class-status.live {
    background: var(--danger); color: white;
    padding: 3px 8px; border-radius: 6px;
    font-size: 10px; font-weight: 700; animation: pulse 2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* Teacher — Student Alerts */
.student-alerts { display: flex; flex-direction: column; gap: 8px; }
.student-alert {
    display: flex; align-items: center; gap: 12px;
    background: var(--card); padding: 12px 16px;
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.student-alert.risk-high { border-left: 3px solid var(--danger); }
.student-alert.risk-medium { border-left: 3px solid var(--warning); }
.student-alert.risk-low { border-left: 3px solid var(--info); }
.sa-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary-light); color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}
.sa-info { flex: 1; }
.sa-info strong { display: block; font-size: 13px; }
.sa-info span { font-size: 11px; color: var(--text-light); }
.risk-tag { padding: 3px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; }
.risk-tag.high { background: #ffe0e0; color: #d32f2f; }
.risk-tag.medium { background: #fff3e0; color: #e65100; }
.risk-tag.low { background: #e3f2fd; color: #1565c0; }

/* Teacher — Performance */
.performance-grid { display: flex; flex-direction: column; gap: 8px; }
.perf-card {
    background: var(--card); padding: 14px 16px;
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.perf-class { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.perf-bar-container { background: #e8e8e8; border-radius: 8px; height: 24px; overflow: hidden; }
.perf-bar {
    height: 100%; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 12px; font-weight: 600;
    transition: width 0.5s ease;
}
.perf-detail { font-size: 11px; color: var(--text-light); margin-top: 4px; }

/* Parent — Child Card */
.child-card {
    background: var(--card); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow);
}
.child-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.child-avatar {
    width: 48px; height: 48px; border-radius: 50%;
    background: linear-gradient(135deg, #6C63FF, #A5A0FF);
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700;
}
.child-info { flex: 1; }
.child-info strong { display: block; font-size: 16px; }
.child-info span { font-size: 12px; color: var(--text-light); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; }
.status-dot.online { background: var(--success); }
.child-stats { display: flex; justify-content: space-around; }
.child-stat { text-align: center; }
.cs-value { font-size: 22px; font-weight: 800; }
.cs-value.good { color: var(--success); }
.cs-label { font-size: 11px; color: var(--text-light); }

/* Parent — Alerts */
.parent-alerts { display: flex; flex-direction: column; gap: 10px; }
.p-alert {
    display: flex; gap: 12px;
    background: var(--card); padding: 14px 16px;
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.p-alert.info { border-left: 3px solid var(--info); }
.p-alert.positive { border-left: 3px solid var(--success); }
.p-alert.warning { border-left: 3px solid var(--warning); }
.p-alert-icon { font-size: 24px; }
.p-alert-content { flex: 1; }
.p-alert-content strong { display: block; font-size: 13px; margin-bottom: 2px; }
.p-alert-content span { font-size: 12px; color: var(--text-light); line-height: 1.4; }
.p-alert-time { font-size: 10px; color: var(--text-light); margin-top: 6px; opacity: 0.7; }

/* Parent — Grade Calculator */
.grade-calc { display: flex; flex-direction: column; gap: 12px; }
.gc-subject {
    background: var(--card); padding: 14px 16px;
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.gc-name { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.gc-grades { display: flex; gap: 8px; margin-bottom: 6px; }
.gc-grade { font-size: 12px; background: #f0f2f5; padding: 2px 8px; border-radius: 6px; }
.gc-grade.pending { background: #fff3e0; color: #e65100; }
.gc-need { font-size: 12px; color: var(--text-light); margin-bottom: 6px; }
.gc-bar { background: #e8e8e8; height: 8px; border-radius: 4px; overflow: hidden; }
.gc-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }
.gc-fill.safe { background: var(--success); }
.gc-fill.danger { background: var(--danger); }

/* Parent — Tips */
.tips-list { display: flex; flex-direction: column; gap: 10px; }
.tip-card {
    display: flex; gap: 12px; align-items: flex-start;
    background: #f8f7ff; padding: 14px 16px;
    border-radius: var(--radius); border: 1px solid #e8e6ff;
}
.tip-icon { font-size: 28px; }
.tip-content strong { display: block; font-size: 13px; margin-bottom: 2px; }
.tip-content span { font-size: 12px; color: var(--text-light); line-height: 1.4; }

/* Review Modal */
.modal {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 100;
    justify-content: center; align-items: flex-end;
}
.modal.show { display: flex; }
.modal-content {
    background: var(--card); border-radius: 20px 20px 0 0;
    width: 100%; max-width: 430px; max-height: 85vh;
    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 20px 12px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; }
.close-btn { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-light); }
.modal-body { padding: 20px; }
.review-topic h4 { font-size: 16px; margin-bottom: 8px; color: var(--primary); }
.review-topic p { font-size: 14px; line-height: 1.6; margin-bottom: 12px; }
.formula-box {
    background: #f8f7ff; border: 1px solid #e0deff;
    padding: 14px; border-radius: 8px; font-size: 15px;
    text-align: center; margin-bottom: 20px;
}
.flashcard { margin-bottom: 20px; }
.flashcard-front {
    background: linear-gradient(135deg, #6C63FF, #8B83FF);
    color: white; padding: 20px; border-radius: var(--radius);
    cursor: pointer; text-align: center; min-height: 100px;
}
.flash-q { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.flash-hint { font-size: 12px; opacity: 0.7; }
.flash-a { display: none; font-size: 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.3); }
.flashcard-front.flipped .flash-q { opacity: 0.6; }
.flashcard-front.flipped .flash-hint { display: none; }
.flashcard-front.flipped .flash-a { display: block; }
.review-progress { text-align: center; }
.review-bar { background: #e8e8e8; height: 8px; border-radius: 4px; margin-bottom: 8px; }
.review-fill { background: var(--primary); height: 100%; border-radius: 4px; transition: width 0.3s; }
.review-progress span { font-size: 12px; color: var(--text-light); }

/* Bottom Navigation */
.bottom-nav {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 430px;
    background: var(--card); border-top: 1px solid var(--border);
    display: flex; justify-content: space-around;
    padding: 8px 0 12px; z-index: 50;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}
.bottom-nav.hidden { display: none; }
.nav-btn {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: none; border: none; cursor: pointer;
    color: var(--text-light); padding: 4px 12px;
}
.nav-btn.active { color: var(--primary); }
.nav-icon { font-size: 22px; }
.nav-label { font-size: 10px; font-weight: 500; }
