/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0095f6;
    --primary-hover: #1877f2;
    --bg-color: #fafafa;
    --card-bg: #ffffff;
    --border-color: #dbdbdb;
    --text-primary: #262626;
    --text-secondary: #8e8e8e;
    --text-link: #00376b;
    --like-color: #ed4956;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
}

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

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

/* Navbar */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 60px;
}

.nav-container {
    max-width: 975px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

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

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.nav-icon svg {
    fill: var(--text-primary);
}

.nav-icon.active svg {
    fill: var(--primary-color);
}

.nav-icon:hover svg {
    fill: var(--text-secondary);
}

/* Main Content */
.main-content {
    max-width: 975px;
    margin: 0 auto;
    padding: 90px 20px 30px;
    display: flex;
    gap: 28px;
}

.feed-container {
    flex: 1;
    max-width: 614px;
}

/* Stories Bar */
.stories-bar {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    gap: 15px;
    overflow-x: auto;
}

.story {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.story-ring {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    position: relative;
}

.story-ring img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--card-bg);
}

.your-story {
    background: var(--border-color);
}

.add-story {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    border: 2px solid var(--card-bg);
}

.story-username {
    font-size: 12px;
    color: var(--text-primary);
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Post Card */
.post {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 24px;
}

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

.post-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.post-user-info {
    flex: 1;
}

.post-username {
    font-weight: 600;
    font-size: 14px;
}

.post-location {
    font-size: 12px;
    color: var(--text-secondary);
}

.post-options {
    font-size: 20px;
    color: var(--text-primary);
}

.post-image {
    width: 100%;
    max-height: 600px;
    object-fit: cover;
}

.post-actions {
    display: flex;
    padding: 8px 16px;
    gap: 16px;
}

.post-action {
    padding: 8px 0;
}

.post-action svg {
    width: 24px;
    height: 24px;
    fill: var(--text-primary);
    transition: transform 0.1s;
}

.post-action:hover svg {
    fill: var(--text-secondary);
}

.post-action.liked svg {
    fill: var(--like-color);
    animation: like-pop 0.3s ease;
}

@keyframes like-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.post-action.saved svg {
    fill: var(--text-primary);
}

.save-action {
    margin-left: auto;
}

.post-content {
    padding: 0 16px 16px;
}

.likes-count {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
}

.post-caption {
    font-size: 14px;
    margin-bottom: 8px;
}

.post-caption .username {
    font-weight: 600;
}

.view-comments {
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 8px;
}

.post-time {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.comment-input {
    display: flex;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    gap: 12px;
}

.comment-input input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
}

.comment-input button {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 14px;
}

.comment-input button:disabled {
    opacity: 0.3;
}

/* Sidebar */
.sidebar {
    width: 319px;
    position: sticky;
    top: 90px;
    height: fit-content;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.sidebar-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
}

.user-details .username {
    font-weight: 600;
    font-size: 14px;
    display: block;
}

.user-details .full-name {
    font-size: 14px;
    color: var(--text-secondary);
}

.suggestions-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.suggestions-header span {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
}

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

.suggestion-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.suggestion-info {
    flex: 1;
}

.suggestion-info .username {
    font-weight: 600;
    font-size: 14px;
    display: block;
}

.suggestion-info .reason {
    font-size: 12px;
    color: var(--text-secondary);
}

.follow-btn {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 12px;
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 350px;
}

.auth-box {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 40px;
    margin-bottom: 10px;
    text-align: center;
}

.auth-logo {
    font-size: 40px;
    font-weight: 400;
    margin-bottom: 20px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 20px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-form input {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 14px;
    background: var(--bg-color);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--text-secondary);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    margin-top: 8px;
    width: 100%;
}

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

.btn-secondary {
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    background: var(--card-bg);
}

.divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    padding: 0 18px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
}

.forgot-password a {
    color: var(--text-link);
    font-size: 12px;
}

.signup-prompt {
    padding: 20px 40px;
}

.signup-prompt a {
    color: var(--primary-color);
    font-weight: 600;
}

.terms {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 20px;
}

/* Profile Page */
.profile-page {
    max-width: 935px;
    margin: 0 auto;
    padding: 90px 20px 30px;
}

.profile-header {
    display: flex;
    gap: 80px;
    padding-bottom: 44px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 44px;
}

.profile-avatar {
    flex-shrink: 0;
}

.profile-avatar img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-info {
    flex: 1;
}

.profile-title {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.profile-title h1 {
    font-size: 20px;
    font-weight: 400;
}

.profile-stats {
    display: flex;
    gap: 40px;
    margin-bottom: 20px;
}

.profile-stats span {
    font-size: 16px;
}

.profile-bio h2 {
    font-size: 14px;
    font-weight: 600;
}

.profile-bio p {
    font-size: 14px;
    color: var(--text-primary);
}

.profile-tabs {
    display: flex;
    justify-content: center;
    gap: 60px;
    border-top: 1px solid var(--border-color);
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 16px 0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-secondary);
    border-top: 1px solid transparent;
    margin-top: -1px;
}

.tab-btn svg {
    fill: var(--text-secondary);
}

.tab-btn.active {
    color: var(--text-primary);
    border-top-color: var(--text-primary);
}

.tab-btn.active svg {
    fill: var(--text-primary);
}

.profile-posts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    padding: 20px 0;
}

.profile-post {
    aspect-ratio: 1;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.profile-post img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-post:hover .post-overlay {
    opacity: 1;
}

.post-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    opacity: 0;
    transition: opacity 0.2s;
}

.post-overlay span {
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 7px;
}

/* Upload Page */
.upload-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 90px 20px 30px;
}

.upload-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
}

.upload-container h1 {
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.upload-area {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-placeholder {
    text-align: center;
    color: var(--text-secondary);
}

.upload-placeholder svg {
    fill: var(--text-secondary);
    margin-bottom: 16px;
}

.upload-placeholder p {
    margin-bottom: 16px;
    font-size: 18px;
}

.upload-preview {
    width: 100%;
    text-align: center;
}

.upload-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.post-form {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--text-secondary);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.close-modal {
    font-size: 24px;
    color: var(--text-primary);
}

.modal-content form {
    padding: 16px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 62px;
    height: 62px;
    fill: var(--text-primary);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 28px;
    font-weight: 300;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 935px) {
    .sidebar {
        display: none;
    }

    .feed-container {
        max-width: 100%;
    }

    .profile-header {
        gap: 30px;
    }

    .profile-avatar img {
        width: 77px;
        height: 77px;
    }

    .profile-posts {
        gap: 3px;
    }
}

@media (max-width: 735px) {
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 20px;
    }

    .profile-stats {
        justify-content: center;
    }

    .profile-title {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .stories-bar {
        border-radius: 0;
        border-left: none;
        border-right: none;
        margin: 0 -20px 24px;
    }

    .post {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}
