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

:root {
    --primary-color: #0095f6;
    --primary-hover: #0077c2;
    --bg-color: #fafafa;
    --white: #ffffff;
    --black: #262626;
    --gray: #8e8e8e;
    --light-gray: #dbdbdb;
    --border-color: #efefef;
    --story-ring: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--black);
    line-height: 1.5;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    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 {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--black);
    font-size: 1.5rem;
    font-weight: 600;
}

.logo i {
    font-size: 1.8rem;
    background: var(--story-ring);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-search {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-search i {
    position: absolute;
    left: 12px;
    color: var(--gray);
    font-size: 0.9rem;
}

.nav-search input {
    width: 268px;
    padding: 8px 12px 8px 35px;
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    background: var(--bg-color);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.nav-search input:focus {
    background: var(--white);
    border-color: var(--light-gray);
}

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

.nav-icon {
    color: var(--black);
    font-size: 1.4rem;
    text-decoration: none;
    position: relative;
    transition: transform 0.2s;
}

.nav-icon:hover {
    transform: scale(1.1);
}

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

.profile-icon img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--light-gray);
}

/* Main Container */
.main-container {
    max-width: 935px;
    margin: 80px auto 0;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 30px;
}

/* Stories Section */
.stories-section {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    overflow-x: auto;
}

.stories-container {
    display: flex;
    gap: 16px;
}

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

.story-item span {
    font-size: 0.75rem;
    color: var(--black);
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.story-ring {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    padding: 3px;
    position: relative;
}

.story-ring.has-story {
    background: var(--story-ring);
}

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

.add-story .story-ring {
    border: 2px dashed var(--light-gray);
    background: var(--bg-color);
}

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

/* Feed Section */
.feed-section {
    grid-column: 1;
}

.feed-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Post Card */
.post-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
}

.post-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.post-user-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--black);
}

.post-user-info span {
    font-size: 0.75rem;
    color: var(--gray);
}

.post-options {
    color: var(--black);
    font-size: 1.2rem;
    cursor: pointer;
}

.post-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--bg-color);
}

.post-actions {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
}

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

.post-action-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--black);
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
}

.post-action-btn:hover {
    transform: scale(1.1);
}

.post-action-btn.liked {
    color: #ed4956;
}

.post-action-btn.liked i {
    font-weight: 900;
}

.post-likes {
    padding: 0 16px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.post-caption {
    padding: 0 16px;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.post-caption strong {
    font-weight: 600;
    margin-right: 6px;
}

.post-comments {
    padding: 0 16px;
    color: var(--gray);
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 8px;
}

.post-time {
    padding: 0 16px 16px;
    color: var(--gray);
    font-size: 0.75rem;
    text-transform: uppercase;
}

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

.post-comment-input input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.9rem;
    background: transparent;
}

.post-comment-input button {
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.2s;
}

.post-comment-input button.active {
    opacity: 1;
}

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

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

.user-card img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
}

.user-card-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-card-info span {
    font-size: 0.85rem;
    color: var(--gray);
}

.switch-btn {
    margin-left: auto;
    color: var(--primary-color);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}

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

.suggestions-header h5 {
    color: var(--gray);
    font-size: 0.85rem;
    font-weight: 600;
}

.suggestions-header a {
    color: var(--black);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

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

.suggestion-info h5 {
    font-size: 0.85rem;
    font-weight: 600;
}

.suggestion-info span {
    font-size: 0.75rem;
    color: var(--gray);
}

.follow-btn {
    margin-left: auto;
    color: var(--primary-color);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

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

.auth-logo {
    margin-bottom: 30px;
}

.auth-logo i {
    font-size: 3rem;
    background: var(--story-ring);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-logo h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-top: 10px;
}

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

.auth-form input {
    padding: 12px;
    border: 1px solid var(--light-gray);
    border-radius: 4px;
    background: var(--bg-color);
    font-size: 0.9rem;
    outline: none;
}

.auth-form input:focus {
    border-color: var(--gray);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
}

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

.auth-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--gray);
    font-size: 0.8rem;
    font-weight: 600;
}

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

.auth-divider span {
    padding: 0 16px;
}

.btn-facebook {
    background: none;
    border: none;
    color: #385185;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.forgot-password {
    display: block;
    margin-top: 20px;
    color: #00376b;
    font-size: 0.8rem;
    text-decoration: none;
}

.auth-switch {
    margin-top: 30px;
    padding: 20px;
    border: 1px solid var(--light-gray);
    border-radius: 4px;
    font-size: 0.9rem;
}

.auth-switch a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

/* Post Modal */
.post-modal {
    max-width: 500px;
    padding: 0;
    overflow: hidden;
}

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

.post-modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--black);
    cursor: pointer;
}

.post-modal-body {
    padding: 20px;
}

.image-upload-area {
    border: 2px dashed var(--light-gray);
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
    margin-bottom: 16px;
}

.image-upload-area:hover {
    border-color: var(--primary-color);
}

.image-upload-area i {
    font-size: 3rem;
    color: var(--black);
    margin-bottom: 12px;
}

.image-upload-area p {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.image-upload-area span {
    font-size: 0.85rem;
    color: var(--gray);
}

.image-preview {
    margin-bottom: 16px;
    border-radius: 8px;
    overflow: hidden;
}

.image-preview img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    background: var(--black);
}

.post-modal-body textarea {
    width: 100%;
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    padding: 12px;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 16px;
    outline: none;
}

.post-modal-body textarea:focus {
    border-color: var(--gray);
}

/* Profile Page Styles */
.profile-header {
    display: flex;
    gap: 80px;
    padding: 30px 0;
    border-bottom: 1px solid var(--border-color);
}

.profile-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

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

.profile-info {
    flex: 1;
}

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

.profile-top h2 {
    font-size: 1.75rem;
    font-weight: 300;
}

.profile-actions {
    display: flex;
    gap: 8px;
}

.btn-edit {
    background: var(--white);
    border: 1px solid var(--light-gray);
    padding: 6px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-settings {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--black);
    cursor: pointer;
}

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

.profile-stats div {
    font-size: 1rem;
}

.profile-stats strong {
    font-weight: 600;
}

.profile-bio h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-bio p {
    font-size: 0.9rem;
    color: var(--black);
}

.profile-bio a {
    color: #00376b;
    text-decoration: none;
    font-weight: 600;
}

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

.profile-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 16px 0;
    color: var(--gray);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    border-top: 1px solid transparent;
    margin-top: -1px;
}

.profile-tab.active {
    color: var(--black);
    border-top-color: var(--black);
}

/* Photo Grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-top: 20px;
}

.photo-item {
    aspect-ratio: 1;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.photo-item:hover img {
    transform: scale(1.05);
}

.photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    opacity: 0;
    transition: opacity 0.3s;
    color: var(--white);
    font-weight: 600;
}

.photo-item:hover .photo-overlay {
    opacity: 1;
}

.photo-overlay span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Signup Page */
.signup-container {
    max-width: 350px;
    margin: 40px auto;
    padding: 20px;
}

.signup-box {
    background: var(--white);
    border: 1px solid var(--light-gray);
    border-radius: 1px;
    padding: 40px;
    text-align: center;
    margin-bottom: 10px;
}

.signup-box .auth-logo {
    margin-bottom: 20px;
}

.signup-box h2 {
    color: var(--gray);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.btn-facebook-full {
    background: #0095f6;
    color: var(--white);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-bottom: 20px;
}

.terms-text {
    color: var(--gray);
    font-size: 0.75rem;
    margin-top: 20px;
}

.terms-text a {
    color: #00376b;
    text-decoration: none;
}

.login-box {
    background: var(--white);
    border: 1px solid var(--light-gray);
    border-radius: 1px;
    padding: 25px;
    text-align: center;
}

.login-box a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

/* Responsive Design */
@media (max-width: 935px) {
    .main-container {
        grid-template-columns: 1fr;
        max-width: 600px;
    }

    .sidebar {
        display: none;
    }
}

@media (max-width: 640px) {
    .nav-search {
        display: none;
    }

    .nav-container {
        padding: 0 16px;
    }

    .nav-icons {
        gap: 18px;
    }

    .nav-icon {
        font-size: 1.3rem;
    }

    .profile-header {
        flex-direction: column;
        align-items: center;
        gap: 20px;
        text-align: center;
    }

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

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

    .photo-grid {
        gap: 2px;
    }
}

/* Animations */
@keyframes likeAnimation {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.like-animation {
    animation: likeAnimation 0.3s ease;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--light-gray);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray);
}