/* 25Schools Homepage - Mobile-Optimized Feed CSS */
/* Production-ready conversion-focused design */

:root {
    --primary-color: #06b6d4;
    --primary-dark: #0891b2;
    --secondary-color: #3b82f6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    margin: 0;
    padding: 0;
}

h1 {
    font-size: 1.875rem;
    line-height: 1.2;
}

h2 {
    font-size: 1.5rem;
    line-height: 1.333;
}

h3 {
    font-size: 1.25rem;
    line-height: 1.4;
}

p {
    margin: 0;
    padding: 0;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Top Bar - Fixed positioning */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    justify-content: space-between;
}

.top-bar-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-badge {
    width: 2rem;
    height: 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.top-bar-link {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.top-bar-link:hover {
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:active {
    transform: scale(0.96);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

/* Main Content Area */
main {
    padding-top: calc(70px + 1rem);
    padding-bottom: calc(70px + 1rem);
    min-height: 100vh;
}

.feed-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #0a5f6f 0%, #0891b2 50%, #06b6d4 100%);
    color: white;
    padding: 2rem 1rem;
    border-radius: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.hero-section h1 {
    font-size: 1.875rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
    color: #ffffff;
}

.hero-section p {
    font-size: 0.9375rem;
    color: #e0f2fe;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.hero-stats {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.hero-ctas {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-white {
    background-color: white;
    color: var(--primary-color);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-white:active {
    background-color: rgba(255, 255, 255, 0.9);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid white;
    color: white;
    padding: 0.625rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.btn-outline:active {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Trust Indicators */
.trust-indicators {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.05), rgba(59, 130, 246, 0.05));
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem 1rem;
    margin-bottom: 1.5rem;
}

.trust-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .trust-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.trust-item {
    text-align: center;
}

.trust-number {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.trust-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Sections */
section {
    margin-bottom: 2rem;
}

section h2 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Feed Items */
.feed-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.feed-item:active {
    box-shadow: var(--shadow-md);
}

.feed-avatar {
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
}

.feed-content {
    flex: 1;
    min-width: 0;
}

.feed-header {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.feed-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.feed-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.feed-action {
    color: var(--primary-color);
    font-weight: 600;
}

.feed-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.badge-xp {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    background-color: rgba(251, 191, 36, 0.1);
    color: #d97706;
    font-size: 0.75rem;
    font-weight: 600;
}

.feed-cta {
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 600;
    transition: color 0.2s ease;
    cursor: pointer;
}

.feed-cta:active {
    color: var(--primary-dark);
}

.load-more-btn {
    width: 100%;
    padding: 0.75rem;
    margin-top: 1rem;
    background-color: transparent;
    color: var(--primary-color);
    border: none;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.load-more-btn:hover {
    background-color: var(--bg-secondary);
}

.load-more-btn:active {
    background-color: rgba(6, 182, 212, 0.05);
}

/* Quiz Cards */
.featured-quiz-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    transition: all 0.2s ease;
}

.featured-quiz-card:active {
    box-shadow: var(--shadow-md);
}

.quiz-color-bar {
    height: 4px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.quiz-bar-primary {
    background-color: var(--success-color);
}

.quiz-bar-secondary {
    background-color: var(--secondary-color);
}

.quiz-bar-tertiary {
    background-color: #a855f7;
}

.quiz-content {
    padding: 1rem;
}

.quiz-badges {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-level {
    background-color: rgba(6, 182, 212, 0.1);
    color: var(--primary-color);
}

.badge-difficulty {
    background-color: rgba(249, 115, 22, 0.1);
    color: #ea580c;
}

.quiz-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.quiz-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.quiz-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.quiz-stat-icon {
    width: 1rem;
    height: 1rem;
}

.btn-start-quiz {
    width: 100%;
    padding: 0.625rem 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
}

.btn-start-quiz:active {
    transform: scale(0.96);
}

/* Leaderboard */
.leaderboard-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

.leaderboard-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.leaderboard-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.leaderboard-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.leaderboard-period {
    font-size: 0.75rem;
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
}

.leaderboard-items {
    border-top: 1px solid var(--border-color);
}

.leaderboard-item {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-item:active {
    background-color: var(--bg-secondary);
}

.rank-badge {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 1.25rem;
}

.rank-1 {
    background-color: #fbbf24;
}

.rank-2 {
    background-color: #d1d5db;
}

.rank-3 {
    background-color: #d97706;
}

.leaderboard-info {
    flex: 1;
    min-width: 0;
}

.leaderboard-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-level {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.leaderboard-points {
    text-align: right;
}

.points-value {
    font-weight: 700;
    color: var(--text-primary);
}

.points-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.leaderboard-action {
    opacity: 0;
    transition: opacity 0.2s ease;
    width: 1.25rem;
    height: 1.25rem;
    color: var(--primary-color);
}

.leaderboard-item:hover .leaderboard-action {
    opacity: 1;
}

.leaderboard-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    text-align: center;
}

.leaderboard-cta {
    width: 100%;
    padding: 0.625rem 1rem;
    background-color: transparent;
    color: var(--primary-color);
    border: none;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.leaderboard-cta:active {
    background-color: var(--bg-secondary);
}

/* Study Resources */
.resources-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .resources-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.resource-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.resource-card:active {
    box-shadow: var(--shadow-md);
}

.resource-icon {
    width: 2.5rem;
    height: 2.5rem;
    margin: 0 auto 0.75rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.resource-icon-blue {
    background-color: rgba(59, 130, 246, 0.1);
}

.resource-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.resource-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.resource-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Final CTA Section */
.final-cta {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 0.75rem;
    padding: 2rem 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
}

.final-cta h2 {
    color: white;
    margin-bottom: 0.75rem;
}

.final-cta p {
    opacity: 0.9;
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    z-index: 999;
    padding-bottom: max(0px, env(safe-area-inset-bottom));
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    transition: color 0.2s ease;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0.5rem 0;
    min-height: 70px;
    position: relative;
}

.bottom-nav-item svg {
    width: 1.25rem;
    height: 1.25rem;
}

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

.bottom-nav-item:active {
    background-color: rgba(6, 182, 212, 0.05);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Empty State */
.empty-state {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 2rem 1rem;
    text-align: center;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Utility Classes */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-center {
    text-align: center;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    h1 {
        font-size: 2.25rem;
    }

    h2 {
        font-size: 1.875rem;
    }

    .feed-container {
        padding: 0 2rem;
    }

    .bottom-nav {
        display: none;
    }

    main {
        padding-bottom: 2rem;
    }
}

/* Dark mode support (optional future enhancement) */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f3f4f6;
        --text-secondary: #d1d5db;
        --bg-primary: #1f2937;
        --bg-secondary: #111827;
        --border-color: #374151;
    }
}

/* High DPI / Retina display support */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    .top-bar,
    .bottom-nav {
        border-width: 0.5px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {

    .feed-item:hover,
    .leaderboard-item:hover {
        background-color: transparent;
    }

    .leaderboard-action {
        opacity: 1;
    }
}
