/* Base styles */
:root {
    --primary-color: #a2c3db;
    --background-color: #1a1a1a;
    --text-color: #ffffff;
    --border-color: #333333;
    --modal-background: rgba(0, 0, 0, 0.9);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Layout */
main {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 15px 80px;
    position: relative;
}

/* Tabs */
.tabs {
    display: flex;
    justify-content: space-around;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    background-color: var(--background-color);
    z-index: 100;
    padding: 10px 0;
    width: 100%;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.tab {
    color: var(--text-color);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 20px;
    transition: background-color 0.3s;
}

.tab.active {
    background-color: var(--primary-color);
    color: white;
}

/* Post Form */
#chirp-form {
    background-color: #222;
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 20px;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#chirp-input {
    width: 100%;
    min-height: 100px;
    background-color: transparent;
    border: none;
    color: var(--text-color);
    font-size: 16px;
    resize: none;
    margin-bottom: 10px;
    padding: 10px;
    outline: none;
}

#char-count {
    color: #aaa;
    font-size: 14px;
    margin-bottom: 10px;
    transition: color 0.3s;
}

/* Post Form Buttons */
.form-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.media-buttons {
    display: flex;
    gap: 10px;
}

#gif-button, #image-button {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 20px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 50%;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    -webkit-tap-highlight-color: transparent;
}

#gif-button:hover, #image-button:hover {
    background-color: rgba(162, 195, 219, 0.1);
}

button[type="submit"] {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: opacity 0.3s;
    -webkit-tap-highlight-color: transparent;
}

button[type="submit"]:hover {
    opacity: 0.9;
}
/* Posts */
.post {
    background-color: #222;
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 15px;
    transition: background-color 0.3s;
    cursor: pointer;
}

.post.following {
    border-left: 4px solid #98FB98;
    background: linear-gradient(to right, rgba(152, 251, 152, 0.1), #333333);
}

.post.not-following {
    border-left: 4px solid #ff6b6b;
    background: linear-gradient(to right, rgba(255, 107, 107, 0.1), #333333);
}

.post.own-post {
    border-left: 4px solid #ADD8E6;
    background: linear-gradient(to right, rgba(173, 216, 230, 0.1), #333333);
}

.post:hover {
    background-color: #2a2a2a;
}

/* Media Previews */
.selected-gif-preview,
.selected-image-preview {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 10px 0;
    display: none;
    object-fit: cover;
    max-height: 300px;
}

.post-image, .post-gif {
    margin: 10px 0;
    max-width: 100%;
    overflow: hidden;
    text-align: center;
    border-radius: 10px;
}

.post-image img, .post-gif img {
    max-height: 300px;
    object-fit: cover;
    border-radius: 10px;
    transition: transform 0.3s ease;
}

/* Post Header and Content */
.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.username {
    color: var(--primary-color);
    font-weight: bold;
    text-decoration: none;
}

.timestamp {
    color: #aaa;
    font-size: 14px;
}

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

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

.like-button, 
.reply-count, 
.share-button {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 20px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
    -webkit-tap-highlight-color: transparent;
}

.like-button:hover, 
.reply-count:hover, 
.share-button:hover {
    color: #ff6b6b;
    background-color: rgba(255, 107, 107, 0.1);
}

.like-button.clicked {
    color: #EC5F5F;
}

.view-post {
    color: #aaa;
    text-decoration: none;
    font-size: 14px;
}

/* Loading States */
.loading {
    text-align: center;
    padding: 20px;
    color: #aaa;
}

/* Responsive Design */
@media (max-width: 480px) {
    .tabs {
        padding: 5px 0;
    }

    .tab {
        padding: 8px 15px;
        font-size: 14px;
    }

    .post {
        padding: 12px;
    }

    nav a {
        font-size: 20px;
    }

    .media-buttons {
        gap: 5px;
    }

    #gif-button,
    #image-button {
        min-width: 35px;
        min-height: 35px;
        font-size: 18px;
    }

    /* .gif-modal-content {
        margin: 20px auto;
        max-height: 90vh;
    } */
}

/* GIF Modal */
.gif-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--modal-background);
    z-index: 1000;
    padding: 20px;
}

.gif-modal-content {
    background-color: #222;
    border-radius: 15px;
    max-width: 600px;
    margin: 50px auto;
    padding: 20px;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
    padding-top: 60px;
}

.gif-search-container {
    position: sticky;
    top: 0;
    background-color: #222;
    padding: 10px 0;
    z-index: 1;
}

#gif-search {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background-color: #333;
    color: white;
    margin-bottom: 15px;
}

.gif-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    padding: 10px 0;
}

.gif-item {
    cursor: pointer;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.2s;
}

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

.gif-item img {
    width: 100%;
    height: auto;
    display: block;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(34, 34, 34, 0.8);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.close-modal:hover {
    background: rgba(34, 34, 34, 1);
}

/* File Input */
#image-input {
    display: none;
}

/* Hide elements */
aside h1,
.footer {
    display: none;
}
