/* Import Inter font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Reset default styles for consistency */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global styles */
body {
    font-family: 'Inter', Arial, sans-serif;
    background: #f0f2f5;
    color: #1c1e21;
    line-height: 1.6;
    font-size: 14px;
}

/* Container */
.container {
    max-width: 100%;
    margin: 0.5rem;
    padding: 1rem;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Header */
header {
    background: linear-gradient(90deg, #1877f2, #4267b2);
    padding: 0.75rem 1rem;
    border-radius: 8px 8px 0 0;
    margin: -1rem -1rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

header h1 {
    font-size: 1.5rem;
    color: #ffffff;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    transition: transform 0.3s ease;
}

.nav-links a {
    color: #ffffff;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    touch-action: manipulation;
}

.nav-links a:hover, .nav-links a:active {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

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

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
    touch-action: manipulation;
}

.menu-toggle:hover, .menu-toggle:active {
    color: #ffffff;
}

/* Headings */
h2 {
    font-size: 1.1rem;
    color: #1c1e21;
    margin: 1rem 0 0.75rem;
    font-weight: 600;
}

h3 {
    font-size: 1rem;
    color: #1c1e21;
    margin: 0.75rem 0 0.5rem;
    font-weight: 600;
}

/* Back link */
.back-link {
    display: inline-block;
    margin: 0.5rem 0;
    color: #1877f2;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.back-link:hover, .back-link:active {
    color: #4267b2;
    text-decoration: underline;
}

/* Form styles */
form {
    display: grid;
    gap: 0.75rem;
    max-width: 100%;
    margin: 1rem 0;
    padding: 0.75rem;
    background: #ffffff;
    border: 1px solid #dadde1;
    border-radius: 8px;
}

form label {
    font-weight: 500;
    color: #1c1e21;
    font-size: 0.85rem;
}

form input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #dadde1;
    border-radius: 6px;
    font-size: 0.9rem;
    background: #ffffff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    min-height: 2.5rem;
}

form input:focus {
    outline: none;
    border-color: #1877f2;
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.2);
}

form button {
    padding: 0.75rem;
    background: #1877f2;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    min-height: 2.5rem;
    touch-action: manipulation;
}

form button:hover, form button:active {
    background: #4267b2;
    transform: translateY(-2px);
}

form button:focus {
    outline: 2px solid #1877f2;
    outline-offset: 2px;
}

/* Search form */
.search-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 100%;
    margin: 0.75rem 0;
    animation: fadeIn 0.5s ease;
}

.search-form input {
    flex-grow: 1;
}

.search-form button {
    width: 100%;
}

/* Login, Logout, and Delete forms */
.login-form, .logout-form, .delete-form {
    display: inline-block;
    margin: 0;
    padding: 0;
}

.logout-form button, .delete-form button {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    background: #e4e6eb;
    color: #1c1e21;
    min-height: 2rem;
}

.logout-form button:hover, .logout-form button:active,
.delete-form button:hover, .delete-form button:active {
    background: #d8dade;
    transform: none;
}

/* Notification */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 0.75rem;
    margin: 0;
    border-radius: 6px;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: fadeIn 0.5s ease;
    z-index: 1000;
    max-width: 90%;
}

.notification.success {
    background: #e7f3fe;
    color: #1877f2;
    border: 1px solid #b3d4fc;
}

.notification.error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.notification button {
    background: none;
    border: none;
    color: #606770;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0 0.5rem;
    touch-action: manipulation;
}

.notification button:hover, .notification button:active {
    color: #1877f2;
}

/* Timeline styles */
.timeline-post {
    background: #ffffff;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border: 1px solid #dadde1;
    transition: box-shadow 0.3s ease;
    animation: fadeIn 0.5s ease;
}

.timeline-post:active {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.timeline-post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.timeline-post-header strong {
    color: #1877f2;
    font-weight: 600;
    font-size: 0.9rem;
}

.toggle-details {
    background: none;
    border: none;
    color: #606770;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
    touch-action: manipulation;
}

.toggle-details:hover, .toggle-details:active {
    color: #1877f2;
}

.timeline-post-preview {
    color: #606770;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-post-details {
    display: none;
    color: #1c1e21;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #dadde1;
    max-height: 50vh;
    overflow-y: auto;
}

.timeline-post-details.show {
    display: block;
}

.timeline-post-details a {
    color: #1877f2;
    text-decoration: none;
    transition: color 0.3s ease;
}

.timeline-post-details a:hover, .timeline-post-details a:active {
    color: #4267b2;
    text-decoration: underline;
}

.post-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    color: #606770;
    font-size: 0.8rem;
}

.post-actions button {
    background: none;
    border: none;
    color: #606770;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
    padding: 0.5rem;
    transition: color 0.3s ease;
    touch-action: manipulation;
}

.post-actions button:hover, .post-actions button:active {
    color: #1877f2;
}

.post-actions button.liked {
    color: #1877f2;
}

.post-actions button svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* No posts message */
.no-posts {
    text-align: center;
    color: #606770;
    font-size: 0.9rem;
    margin: 1rem 0;
}

/* Pagination styles */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.pagination a {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: #1877f2;
    border: 1px solid #dadde1;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease;
    touch-action: manipulation;
}

.pagination a:hover, .pagination a:active {
    background: #1877f2;
    color: #ffffff;
    transform: translateY(-2px);
}

.pagination a.active {
    background: #1877f2;
    color: #ffffff;
    border-color: #1877f2;
}

.pagination a.disabled {
    color: #dadde1;
    border-color: #dadde1;
    cursor: not-allowed;
}

.pagination a.disabled:hover, .pagination a.disabled:active {
    background: none;
    color: #dadde1;
    transform: none;
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

@keyframes slideIn {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: none; opacity: 1; }
}

/* Responsive design */
@media (min-width: 769px) {
    .container {
        max-width: 800px;
        margin: 1rem auto;
        padding: 1.5rem;
    }

    header {
        padding: 1rem 1.5rem;
        margin: -1.5rem -1.5rem 1.5rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .nav-links {
        display: flex !important;
        transform: none !important;
    }

    .nav-links a {
        padding: 0.5rem 1rem;
        font-size: 0.95rem;
    }

    .menu-toggle {
        display: none;
    }

    h2 {
        font-size: 1.25rem;
        margin: 1.5rem 0 1rem;
    }

    .back-link {
        margin: 1rem 0;
    }

    form {
        max-width: 500px;
        margin: 1.5rem auto;
        padding: 1rem;
        gap: 1rem;
    }

    form label {
        font-size: 0.9rem;
    }

    form input {
        font-size: 0.95rem;
    }

    form button {
        font-size: 0.95rem;
    }

    .search-form {
        flex-direction: row;
        max-width: 500px;
        margin: 1rem auto;
    }

    .search-form button {
        width: auto;
    }

    .timeline-post {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .timeline-post-header strong {
        font-size: 1rem;
    }

    .toggle-details {
        font-size: 0.85rem;
    }

    .timeline-post-preview {
        font-size: 0.9rem;
    }

    .timeline-post-details {
        font-size: 0.9rem;
    }

    .post-actions {
        font-size: 0.85rem;
    }

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

    .notification {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }

    .no-posts {
        font-size: 1rem;
    }

    .pagination a {
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background: linear-gradient(90deg, #1877f2, #4267b2);
        padding: 0.5rem;
        border-radius: 0 0 8px 8px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        transform: translateY(-100%);
        opacity: 0;
        z-index: 10;
    }

    .nav-links.active {
        display: flex;
        transform: none;
        opacity: 1;
        animation: slideIn 0.3s ease forwards;
    }

    .nav-links a {
        width: 100%;
        text-align: left;
        padding: 0.75rem;
        border-radius: 0;
        font-size: 0.9rem;
    }

    .nav-links a.active {
        background: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }

    .menu-toggle {
        display: block;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.25rem;
    }

    .nav-links a {
        font-size: 0.85rem;
        padding: 0.6rem;
    }

    .menu-toggle {
        font-size: 1.1rem;
    }
}

@media (max-width: 320px) {
    .container {
        margin: 0.25rem;
        padding: 0.5rem;
    }

    header {
        padding: 0.5rem 0.75rem;
        margin: -0.75rem -0.75rem 0.75rem;
    }

    header h1 {
        font-size: 1rem;
    }

    form input, form button {
        font-size: 0.8rem;
        min-height: 2rem;
    }

    .timeline-post-header strong {
        font-size: 0.8rem;
    }

    .toggle-details {
        font-size: 0.75rem;
    }

    .timeline-post-preview {
        font-size: 0.8rem;
    }

    .timeline-post-details {
        font-size: 0.8rem;
    }

    .post-actions {
        font-size: 0.75rem;
    }

    .notification {
        font-size: 0.8rem;
        padding: 0.5rem;
    }

    .no-posts {
        font-size: 0.85rem;
    }

    .pagination a {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
}