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

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f4f4f4;
    color: #333;
    line-height: 1.6;
}

header { 
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #35424a;
    color: #ffffff;
    padding: 20px 0;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin-bottom: 15px;
    font-size: 2em;
}

nav {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

nav a { 
    color: #ffffff;
    margin: 0 15px;
    text-decoration: none;
    font-weight: bold;
    padding: 10px 18px;
    border-radius: 5px;
    transition: all 0.3s ease;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

nav a.active { 
    background: #e8491d;
    color: #ffffff;
} 

nav a:hover{
    background: rgba(255, 255, 255, 0.1);
}

main { 
    max-width: 900px; 
    margin: 20px auto; 
    padding: 0 20px;
}

/* Home intro section */
.intro {
    background: white;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.intro h2 {
    color: #35424a;
    margin-bottom: 15px;
}

.intro p {
    font-size: 1.1em;
    margin-bottom: 20px;
    color: #666;
}

.instructions {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #35424a;
}

.instructions summary {
    cursor: pointer;
    font-weight: bold;
    color: #35424a;
    padding: 5px 0;
}

.instructions summary:hover {
    color: #e8491d;
}

.instructions ul {
    margin-top: 15px;
    margin-left: 20px;
}

.instructions li {
    margin-bottom: 10px;
    line-height: 1.8;
    padding-left: 12px;
}

.page{
    display: block;
}

.page.hidden{
    display: none;
}

.hidden {
    display: none !important;
}

button {
    background: #35424a;
    color: white;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    margin-bottom: 20px;
    border-radius: 5px;
    font-size: 1em;
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
}

button:hover {
    background: #e8491d;
}

button:disabled {
    background: #999;
    cursor: not-allowed;
}

.back-button {
    background: #35424a;
    color: white;
    padding: 12px 24px;
    font-size: 1em;
    margin-bottom: 20px;
    width: auto;
    display: inline-block;
    transition: all 0.3s ease;
}

#posts-container,
#comments-container,
#user-posts-container {
    margin-top: 20px;
}

.text-center {
    text-align: center;
    margin: 30px 0;
}

#load-more-btn {
    padding: 12px 30px;
    font-size: 1.1em;
}

/* Loading Spinner */
.spinner {
    text-align: center;
    padding: 40px 0;
}

.spinner-circle {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #35424a;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.spinner p {
    color: #666;
    font-size: 1.1em;
}

.post-card {
    background: white;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.post-card h3 {
    color: #35424a;
    margin-bottom: 10px;
    cursor: pointer;
    padding: 8px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.post-card h3:hover {
    color: #e8491d;
}

.post-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 0.9em;
    color: #666;
}

.post-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.author {
    font-weight: bold;
    cursor: pointer;
    color: #35424a;
    padding: 4px 8px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.author:hover {
    color: #e8491d;
}

.post-body {
    color: #555;
    line-height: 1.8;
    margin-bottom: 15px;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.tag {
    background: #35424a;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 500;
}

/* Post Detail Styles */
.post-detail-card {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.post-detail-card h2 {
    color: #35424a;
    margin-bottom: 15px;
    font-size: 2em;
}

.post-full-body {
    font-size: 1.1em;
    line-height: 1.8;
    margin-top: 20px;
    color: #333;
}

/* Comment Styles */
.comment-card {
    background: white;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #35424a;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    color: #35424a;
}

.comment-likes {
    color: #e8491d;
    font-weight: bold;
}

.comment-body {
    color: #555;
    line-height: 1.6;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    overflow: auto;
}

.modal:not(.hidden) {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 20px;
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
    -webkit-overflow-scrolling: touch;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 2em;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    transition: color 0.3s ease;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.close-modal:hover {
    color: #e8491d;
}

.modal-profile-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-profile-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #35424a;
    margin-bottom: 15px;
}

.modal-profile-name {
    color: #35424a;
    font-size: 1.8em;
    margin-bottom: 5px;
}

.modal-profile-username {
    color: #666;
    font-size: 1.1em;
}

.modal-profile-details {
    display: grid;
    gap: 15px;
}

.profile-detail-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 6px;
}

.profile-detail-item strong {
    color: #35424a;
    min-width: 80px;
}

.profile-detail-item span {
    color: #555;
}

/* Profile Section Styles */
.profile-card {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.profile-header {
    display: flex;
    gap: 25px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.profile-image {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #35424a;
    flex-shrink: 0;
}

.profile-info {
    flex: 1;
}

.profile-info h2 {
    color: #35424a;
    margin-bottom: 10px;
    font-size: 2em;
}

.profile-username {
    color: #666;
    font-size: 1.2em;
    margin-bottom: 10px;
}

.profile-email {
    color: #35424a;
    font-weight: 500;
    margin-bottom: 10px;
}

.profile-details {
    color: #555;
    line-height: 1.8;
}

#profile-back-btn,
#back-btn {
    background: #35424a;
    color: white;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    margin-bottom: 20px;
    border-radius: 5px;
    font-size: 1em;
    min-height: 44px;
    touch-action: manipulation;
    transition: all 0.3s ease;
}

#profile-back-btn:hover,
#back-btn:hover {
    background: #e8491d;
}

/* Post Detail Section */
#post-detail {
    min-height: 400px;
}

/* Contact Form Styles */
#contact {
    max-width: 600px;
    margin: 0 auto;
}

.contact-intro {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.contact-form {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.form-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 25px;
}

.form-field label {
    font-weight: bold;
    color: #35424a;
    margin-bottom: 8px;
    font-size: 1em;
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field textarea {
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    font-family: Arial, Helvetica, sans-serif;
    transition: border-color 0.3s ease;
}

.form-field input[type="text"]:focus,
.form-field input[type="email"]:focus,
.form-field textarea:focus {
    outline: none;
    border-color: #35424a;
}

.form-field textarea {
    resize: vertical;
    min-height: 100px;
}

/* Form actions */
.form-actions {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

#submit-btn {
    padding: 15px 40px;
    font-size: 1.1em;
    background: #35424a;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#submit-btn:hover {
    background: #e8491d;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(232, 73, 29, 0.3);
}

#submit-btn:disabled {
    background: #999;
    cursor: not-allowed;
    transform: none;
}

/* Success message */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    margin-top: 20px;
    border: 1px solid #c3e6cb;
    font-weight: 500;
}

/* Error message styling */
.error-state {
    color: #e8491d;
    text-align: center;
    padding: 20px;
    background: #fee;
    border-radius: 8px;
    border: 1px solid #e8491d;
}

.empty-state {
    color: #666;
    text-align: center;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 8px;
    font-style: italic;
}

/* Mobile-first responsive breakpoints */
/* Base styles are mobile-first */

/* Tablets and above */
@media (min-width: 769px) {
    .modal-content {
        width: 85%;
    }
    
    .profile-header {
        flex-direction: row;
    }
}

/* Small tablets and large phones (landscape) */
@media (max-width: 768px) {
    header {
        padding: 15px 10px;
    }
    
    header h1 {
        font-size: 1.8em;
        margin-bottom: 12px;
    }
    
    nav a {
        margin: 0 8px;
        padding: 12px 16px;
        font-size: 0.95em;
    }
    
    main {
        padding: 0 15px;
        margin: 15px auto;
    }
    
    .post-card {
        padding: 16px;
        margin-bottom: 15px;
    }
    
    .post-detail-card {
        padding: 20px;
    }
    
    .post-detail-card h2 {
        font-size: 1.5em;
    }
    
    .post-full-body {
        font-size: 1em;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
        padding: 20px;
        max-height: 90vh;
    }
    
    .modal-profile-image {
        width: 100px;
        height: 100px;
    }
    
    .modal-profile-name {
        font-size: 1.6em;
    }
    
    .profile-header {
        gap: 15px;
    }
    
    .profile-image {
        width: 120px;
        height: 120px;
    }
    
    .profile-info h2 {
        font-size: 1.6em;
    }
    
    .comment-card {
        padding: 12px;
    }
    
    .contact-form {
        padding: 25px 20px;
    }
}

/* Mobile phones */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.5em;
        margin-bottom: 10px;
    }
    
    nav {
        gap: 8px;
        padding: 0 10px;
    }
    
    nav a {
        margin: 0;
        flex: 1 1 auto;
        min-width: 80px;
        padding: 12px 14px;
        font-size: 0.9em;
    }
    
    main {
        padding: 0 10px;
    }
    
    .contact h2 {
        text-align: center;
    }
    
    .contact-form {
        padding: 20px 15px;
    }

    #submit-btn {
        width: 100%;
    }

    .post-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .post-meta span {
        width: 100%;
    }

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

    .profile-image {
        width: 100px;
        height: 100px;
    }
    
    .profile-info {
        text-align: center;
    }
    
    .profile-info h2 {
        font-size: 1.4em;
    }
    
    .profile-username {
        font-size: 1em;
    }
    
    .modal-content {
        border-radius: 8px;
        padding: 15px;
        margin: 5px;
    }
    
    .close-modal {
        right: 10px;
        top: 10px;
        font-size: 1.8em;
    }
    
    .modal-profile-image {
        width: 80px;
        height: 80px;
    }
    
    .modal-profile-name {
        font-size: 1.4em;
    }
    
    .modal-profile-username {
        font-size: 1em;
    }
    
    .modal-profile-details {
        gap: 12px;
    }
    
    .profile-detail-item {
        flex-direction: column;
        gap: 5px;
        padding: 10px;
    }
    
    .profile-detail-item strong {
        min-width: auto;
    }
    
    button {
        width: 100%;
        padding: 14px 24px;
    }
    
    #load-more-btn {
        width: auto;
        min-width: 200px;
    }
    
    #profile-back-btn,
    #back-btn {
        width: auto;
        padding: 12px 20px;
    }
    
    .post-card h3 {
        font-size: 1.2em;
    }
    
    .post-body {
        font-size: 0.95em;
    }
    
    .tag {
        font-size: 0.8em;
        padding: 3px 10px;
    }
    
    .comment-header {
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
    }
}

/* Extra small devices */
@media (max-width: 400px) {
    header h1 {
        font-size: 1.3em;
    }
    
    nav a {
        padding: 10px 12px;
        font-size: 0.85em;
        min-width: 70px;
    }
    
    main {
        padding: 0 8px;
    }
    
    .post-card {
        padding: 12px;
    }
    
    .post-card h3 {
        font-size: 1.1em;
    }
    
    .post-body {
        font-size: 0.9em;
    }
    
    .post-detail-card {
        padding: 15px;
    }
    
    .post-detail-card h2 {
        font-size: 1.3em;
    }
    
    .post-full-body {
        font-size: 0.95em;
    }
    
    .modal-profile-details {
        font-size: 0.9em;
    }
    
    .modal-content {
        padding: 12px;
    }
    
    .contact-form {
        padding: 15px 10px;
    }
    
    .form-field input[type="text"],
    .form-field input[type="email"],
    .form-field textarea {
        font-size: 0.95em;
        padding: 10px 12px;
    }
    
    #load-more-btn {
        min-width: 150px;
        padding: 12px 20px;
        font-size: 0.95em;
    }
}