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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f0f2f5;
    color: #1c1e21;
}

.container {
    max-width: 400px;
    margin: 50px auto;
    padding: 20px;
}

.auth-box {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.auth-box h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #1877f2;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #dddfe2;
    border-radius: 5px;
    font-size: 14px;
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

.btn-primary {
    background: #1877f2;
    color: white;
}

.btn-primary:hover {
    background: #166fe5;
}

.alert {
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* App Layout */
.app-container {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.sidebar {
    width: 250px;
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-right: 20px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.user-profile {
    text-align: center;
    margin-bottom: 20px;
}

.user-profile img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #1877f2;
}

/* NEW: Profile image placeholder styles */
.user-profile img[src*="default.jpg"],
.user-profile img[src*="default.jpg"]:before {
    background: #1877f2;
}

.sidebar nav a {
    display: block;
    padding: 10px;
    color: #1c1e21;
    text-decoration: none;
    border-radius: 5px;
    margin-bottom: 5px;
    transition: background 0.2s;
}

.sidebar nav a:hover {
    background: #f0f2f5;
}

.sidebar nav a.active {
    background: #e7f3ff;
    color: #1877f2;
    font-weight: 600;
}

.main-content {
    flex: 1;
}

/* Posts */
.create-post {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.create-post textarea {
    width: 100%;
    border: none;
    resize: none;
    font-size: 14px;
    padding: 10px;
    font-family: inherit;
}

.create-post textarea:focus {
    outline: none;
}

.post-options {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.post-options input[type="file"] {
    flex: 1;
    padding: 5px;
}

.post-options select {
    padding: 8px;
    border: 1px solid #dddfe2;
    border-radius: 5px;
    background: white;
}

.post-options .btn {
    width: auto;
    padding: 8px 24px;
}

.post {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.post-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.post-header img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
    border: 2px solid #e4e6eb;
}

/* NEW: Handle broken images */
.post-header img[src*="default.jpg"] {
    background: #1877f2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.post-header strong {
    display: block;
    font-size: 14px;
}

.post-header .username {
    color: #65676b;
    font-size: 13px;
}

.post-header .time {
    color: #65676b;
    font-size: 12px;
}

.post-content {
    margin-bottom: 15px;
    line-height: 1.6;
    word-wrap: break-word;
}

.post-image {
    max-width: 100%;
    margin-top: 10px;
    border-radius: 8px;
    max-height: 500px;
    object-fit: cover;
}

.post-actions {
    display: flex;
    gap: 20px;
    padding-top: 10px;
    border-top: 1px solid #e4e6eb;
}

.like-btn {
    cursor: pointer;
    color: #65676b;
    text-decoration: none;
    transition: color 0.2s;
}

.like-btn:hover {
    color: #1877f2;
}

.like-btn.liked {
    color: #1877f2;
    font-weight: 600;
}

/* Comments */
.comments-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e4e6eb;
}

.comment {
    display: flex;
    margin-bottom: 10px;
}

.comment img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
    border: 2px solid #e4e6eb;
}

.comment img[src*="default.jpg"] {
    background: #1877f2;
}

.comment div {
    background: #f0f2f5;
    padding: 8px 12px;
    border-radius: 12px;
    flex: 1;
}

.comment strong {
    font-size: 13px;
    display: block;
}

.comment p {
    font-size: 14px;
    margin: 2px 0;
    word-wrap: break-word;
}

.comment .time {
    font-size: 11px;
    color: #65676b;
}

.comment-form {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.comment-form input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #dddfe2;
    border-radius: 20px;
    font-size: 14px;
    font-family: inherit;
}

.comment-form input:focus {
    outline: 2px solid #1877f2;
    border-color: transparent;
}

.comment-form button {
    padding: 8px 16px;
    background: #1877f2;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.comment-form button:hover {
    background: #166fe5;
}

/* NEW: Empty state styles */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.empty-state h3 {
    color: #1c1e21;
    margin-bottom: 10px;
}

.empty-state p {
    color: #65676b;
}

/* NEW: Badge styles */
.badge {
    display: inline-block;
    padding: 4px 12px;
    background: #e4e6eb;
    color: #1c1e21;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.badge-primary {
    background: #1877f2;
    color: white;
}

.badge-success {
    background: #42b72a;
    color: white;
}

/* NEW: Profile cover photo */
.cover-photo {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
}

.profile-header {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.profile-info {
    padding: 20px;
    text-align: center;
    margin-top: -40px;
    position: relative;
}

.profile-pic {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid white;
    object-fit: cover;
    margin-bottom: 10px;
}

.profile-info h2 {
    margin: 5px 0;
}

.profile-info .btn {
    width: auto;
    padding: 8px 24px;
    margin-top: 10px;
}

/* NEW: Friend suggestion styles */
.friend-card {
    display: flex;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.friend-card img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
}

.friend-card .info {
    flex: 1;
}

.friend-card .info h4 {
    font-size: 14px;
}

.friend-card .info p {
    font-size: 12px;
    color: #65676b;
}

.friend-card .btn {
    width: auto;
    padding: 6px 16px;
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        padding: 10px;
    }
    
    .sidebar {
        width: 100%;
        position: static;
        margin-bottom: 20px;
    }
    
    .auth-box {
        margin: 20px;
        padding: 20px;
    }
    
    .post-options {
        flex-direction: column;
        align-items: stretch;
    }
    
    .post-options .btn {
        width: 100%;
    }
    
    .comment-form {
        flex-direction: column;
    }
    
    .comment-form button {
        width: 100%;
    }
    
    .profile-info {
        margin-top: -20px;
    }
    
    .profile-pic {
        width: 80px;
        height: 80px;
    }
    
    .cover-photo {
        height: 120px;
    }
}

/* NEW: Loading animation */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.loading {
    animation: pulse 1.5s infinite;
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c7cd;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8b0b8;
}

/* NEW: Image hover effects */
.post-image:hover {
    opacity: 0.95;
    transition: opacity 0.2s;
}

/* NEW: Notification dot */
.notification-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #f02849;
    border-radius: 50%;
    margin-left: 5px;
}

/* NEW: Tooltip */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1c1e21;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    margin-bottom: 5px;
}