/* iOS-Style Feed UI CSS */

/* System Font Stack */
:root {
    --system-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;

    /* Colors */
    --primary-teal: #008080;
    --rating-good: #008080;
    --rating-okay: #e6b333;
    --rating-poor: #cc4d4d;
    --text-primary: #000000;
    --text-secondary: #8e8e93;
    --background: #ffffff;
    --divider: rgba(0, 0, 0, 0.1);
    --heart-red: #ff3b30;

    /* Spacing */
    --padding-standard: 16px;
    --padding-large: 20px;
    --profile-size: 45px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--system-font);
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.4;
    overflow-x: hidden;
}

/* Navigation Bar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 0.5px solid var(--divider);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--padding-standard);
}

.nav-left {
    display: flex;
    align-items: center;
    flex: 1;
}

.menu-icon {
    width: 24px;
    height: 24px;
    cursor: pointer;
}

.menu-icon svg {
    width: 100%;
    height: 100%;
}

.logo {
    height: 28px;
    display: block;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.logo img {
    height: 100%;
    width: auto;
}

.nav-right {
    flex: 1;
    /* Empty for balance */
}

/* Main Content */
.main-content {
    margin-top: 60px; /* just navbar */
    min-height: 100vh;
    background-color: var(--background);
    padding-bottom: 300px; /* space for fixed gradient */
}

/* Feed Container */
.feed-container {
    max-width: 600px;
    margin: 0 auto;
    background-color: var(--background);
}

/* Feed Post */
.feed-post {
    background-color: var(--background);
    border-bottom: 0.5px solid var(--divider);
    transition: background-color 0.2s;
}

.feed-post:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.feed-post:active {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Post Header */
.post-header {
    padding: 12px var(--padding-standard);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

/* Reduce spacing for standard posts without course tags */
.standard-post-no-course .post-header {
    padding-bottom: 0px;
}

.profile-container {
    position: relative;
}

.profile-image {
    width: var(--profile-size);
    height: var(--profile-size);
    border-radius: 50%;
    background-color: #f0f0f0;
    object-fit: cover;
}

.follow-button {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 22px;
    height: 22px;
    background-color: var(--background);
    border: 1px solid var(--divider);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.follow-button svg {
    width: 16px;
    height: 16px;
}

.post-info {
    flex: 1;
}

.post-info-top {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 2px;
}

.username {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.rated-text {
    font-size: 16px;
    color: var(--text-secondary);
}

.course-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--primary-teal);
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
}

.location {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 13px;
}

.location svg {
    width: 12px;
    height: 12px;
}

/* Rating Badge */
.rating-badge {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: white;
}

.rating-good {
    background-color: var(--rating-good);
    opacity: 0.85;
}

.rating-okay {
    background-color: var(--rating-okay);
    opacity: 0.85;
}

.rating-poor {
    background-color: var(--rating-poor);
    opacity: 0.85;
}

/* Post Notes */
.post-notes {
    padding: 0 var(--padding-standard);
    padding-left: 73px; /* Align with username */
    margin-bottom: 12px;
}

/* Reduce top margin for standard posts without course tags */
.standard-post-no-course .post-notes {
    margin-top: -8px;
}

.notes-text {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.4;
}

.notes-text.truncated {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.more-button {
    color: var(--primary-teal);
    font-weight: 500;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-size: 15px;
}

/* Post Photos */
.post-photos {
    margin-bottom: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.post-photos::-webkit-scrollbar {
    display: none;
}

.photos-scroll {
    display: flex;
    gap: 8px;
    padding-left: 73px;
    padding-right: var(--padding-standard);
}

.photo-container {
    flex-shrink: 0;
}

.photo-container.single {
    width: 280px;
    height: 340px;
}

.photo-container.multiple {
    width: 240px;
    height: 280px;
}

.post-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    background-color: #f0f0f0;
}

/* Repost Indicator */
.repost-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px var(--padding-standard);
    padding-left: 73px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.repost-indicator svg {
    color: var(--text-secondary);
}

/* Quoted Post Card */
.quoted-post-card {
    margin: 0 var(--padding-standard);
    margin-left: 73px;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--divider);
    border-radius: 12px;
    background-color: rgba(0, 0, 0, 0.02);
}

.quoted-post-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.quoted-post-header .username {
    font-weight: 600;
}

.quoted-post-header .rated-text {
    color: var(--text-secondary);
}

.quoted-post-header .course-name {
    color: var(--primary-teal);
    text-decoration: none;
}

.rating-badge-small {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: bold;
    color: white;
}

.quoted-post-notes {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Comment Repost Box */
.comment-repost-box {
    margin: 0 var(--padding-standard);
    margin-left: 73px;
    margin-bottom: 12px;
    padding: 12px;
    border-left: 3px solid var(--primary-teal);
    background-color: rgba(0, 128, 128, 0.05);
    border-radius: 4px;
}

.comment-repost-header {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.comment-repost-header .username {
    font-weight: 600;
    color: var(--text-primary);
}

.comment-repost-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Interaction Bar */
.interaction-bar {
    padding: 8px var(--padding-standard);
    padding-left: 73px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.interaction-button {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 8px 4px;
    cursor: pointer;
    color: var(--text-primary);
    transition: color 0.2s;
}

.interaction-button:hover {
    color: var(--primary-teal);
}

.interaction-button svg {
    width: 22px;
    height: 22px;
    stroke: var(--text-primary);
    transition: stroke 0.2s, fill 0.2s;
}

.interaction-button:hover svg {
    stroke: var(--primary-teal);
}

.interaction-button.liked svg {
    fill: var(--heart-red);
    stroke: var(--heart-red);
}

.interaction-count {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.interaction-bar-right {
    margin-left: auto;
}

.details-button {
    background: none;
    border: none;
    padding: 8px 4px;
    cursor: pointer;
}

.details-button svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-secondary);
}

/* Download CTA Section */
.download-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to bottom,
        rgba(0, 128, 128, 0) 0%,
        rgba(0, 128, 128, 0.7) 25%,
        rgba(0, 128, 128, 0.95) 45%,
        rgba(0, 128, 128, 1) 55%,
        rgba(0, 128, 128, 1) 100%
    );
    padding: 120px var(--padding-standard) 16px;
    text-align: center;
    z-index: 100;
    pointer-events: none;
}

.download-cta-content {
    max-width: 600px;
    margin: 0 auto;
    pointer-events: auto;
}

.download-cta h2 {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
}

.download-cta p {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 20px;
    line-height: 1.4;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

.download-btn {
    display: inline-block;
    margin-bottom: 20px;
    transition: transform 0.2s, opacity 0.2s;
}

.download-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.download-btn img {
    height: 48px;
    width: auto;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
}

.social-link {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: transform 0.2s, background-color 0.2s;
    text-decoration: none;
}

.social-link:hover {
    transform: translateY(-2px);
    background-color: rgba(255, 255, 255, 0.3);
}

.social-link svg {
    width: 20px;
    height: 20px;
}

.footer-links-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    font-size: 13px;
}

.footer-links-bottom a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links-bottom a:hover {
    color: #ffffff;
}

.footer-links-bottom span {
    color: rgba(255, 255, 255, 0.7);
}

.copyright-text {
    margin-top: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

/* Footer */
footer {
    display: none; /* Hidden since we have fixed bottom gradient */
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
}

.footer-links a:hover {
    color: var(--text-primary);
}

.footer-copyright {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Loading State */
.loading-post {
    padding: var(--padding-standard);
}

.shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading Overlay for Deep Links */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 2000;
}

.loading-overlay.active {
    display: flex;
}

.loading-overlay .spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-teal);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-overlay p {
    font-size: 16px;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 600px) {
    .feed-container {
        width: 100%;
    }

    .photos-scroll {
        padding-left: var(--padding-standard);
    }

    .post-notes,
    .interaction-bar {
        padding-left: var(--padding-standard);
    }

    /* Add more space between username and text on mobile for standard posts */
    .standard-post-no-course .post-notes {
        margin-top: 4px;
    }

    .download-cta {
        padding: 60px var(--padding-standard) 12px;
    }

    .download-cta h2 {
        font-size: 24px;
        margin-bottom: 6px;
    }

    .download-cta p {
        font-size: 14px;
        margin-bottom: 16px;
    }

    .download-btn {
        margin-bottom: 16px;
    }

    .download-btn img {
        height: 44px;
    }

    .social-links {
        gap: 12px;
        margin-top: 12px;
    }

    .social-link {
        width: 36px;
        height: 36px;
    }

    .social-link svg {
        width: 18px;
        height: 18px;
    }

    .footer-links-bottom {
        margin-top: 12px;
        font-size: 12px;
    }

    .copyright-text {
        font-size: 11px;
        margin-top: 4px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #ffffff;
        --text-secondary: #8e8e93;
        --background: #000000;
        --divider: rgba(255, 255, 255, 0.1);
    }

    .navbar {
        background-color: rgba(0, 0, 0, 0.98);
    }

    .follow-button {
        background-color: var(--background);
        border-color: rgba(255, 255, 255, 0.3);
    }

    .feed-post:hover {
        background-color: rgba(255, 255, 255, 0.05);
    }

    .feed-post:active {
        background-color: rgba(255, 255, 255, 0.1);
    }

    .download-cta {
        background: linear-gradient(to bottom,
            rgba(0, 128, 128, 0) 0%,
            rgba(0, 128, 128, 0.7) 25%,
            rgba(0, 128, 128, 0.95) 45%,
            rgba(0, 128, 128, 1) 55%,
            rgba(0, 128, 128, 1) 100%
        );
    }

    footer {
        background-color: #1c1c1e;
    }

    .loading-overlay {
        background-color: rgba(0, 0, 0, 0.95);
    }

    .loading-overlay .spinner {
        border-color: #333;
        border-top-color: var(--primary-teal);
    }

    .quoted-post-card {
        background-color: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .comment-repost-box {
        background-color: rgba(0, 128, 128, 0.1);
    }

    .interaction-button:hover {
        color: var(--primary-teal);
    }

    .interaction-button:hover svg {
        stroke: var(--primary-teal);
    }
}

/* Hide scrollbars but keep functionality */
.no-scrollbar {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}