/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-color: #000000;
    --surface-color: #121212;
    --border-color: #262626;
    --text-primary: #f5f5f5;
    --text-secondary: #a8a8a8;
    --accent-color: #2ecc71;
    /* Cannabis green */
    --accent-hover: #27ae60;
    --error-color: #e74c3c;
    --overlay-color: rgba(0, 0, 0, 0.5);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
}

a {
    color: var(--accent-color);
    text-decoration: none;
}

/* Authentication Pages */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-box {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.auth-box h1 {
    font-family: 'Brush Script MT', cursive, sans-serif;
    font-size: 2.5rem;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.auth-box input {
    width: 100%;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-size: 14px;
}

.auth-box input:focus {
    outline: none;
    border-color: var(--text-secondary);
}

.btn-primary {
    width: 100%;
    background-color: var(--accent-color);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s, transform 0.1s;
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-primary:active {
    transform: scale(0.98);
}

.auth-footer {
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.error-msg {
    color: var(--error-color);
    margin-bottom: 20px;
    font-size: 14px;
    background-color: rgba(231, 76, 60, 0.1);
    padding: 10px;
    border-radius: 4px;
}

/* Navigation Bar */
.navbar {
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 975px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Brush Script MT', cursive, sans-serif;
    font-size: 1.8rem;
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: var(--text-primary);
    font-size: 1.5rem;
    transition: color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 50%;
}

.nav-links a:hover {
    color: var(--text-secondary);
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-links a.active {
    color: var(--accent-color);
}

.nav-links a:active {
    transform: scale(0.9);
}

.notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: var(--error-color);
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 4px;
    /* Optional: outline to make it pop against the icon */
    border: 2px solid var(--bg-color);
}

/* Main Layout */
.feed-container,
.profile-container,
.upload-container {
    max-width: 600px;
    margin: 30px auto;
    padding: 0 20px;
}

.profile-container {
    max-width: 975px;
}

/* Chat Layout Specifics */
.chat-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    margin: 0;
    background: var(--bg-color);
}

.chat-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    max-width: 600px;
    width: 100%;
    margin: 20px auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-color);
    overflow: hidden;
}

/* Posts */
.post {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 30px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.post:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.post-header {
    display: flex;
    align-items: center;
    padding: 14px;
}

.post-avatar {
    font-size: 32px;
    color: var(--text-secondary);
    margin-right: 12px;
}

.post-username {
    font-weight: 600;
    font-size: 14px;
}

.post-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 800px;
}

.post-content {
    padding: 14px;
}

.post-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.post-actions i {
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}

.post-actions i:hover {
    color: var(--text-secondary);
}

.post-actions i:active {
    transform: scale(0.8);
}

.post-actions i.fa-heart:hover {
    color: var(--error-color);
}

.post-likes {
    margin-bottom: 8px;
    font-size: 14px;
}

.post-caption {
    font-size: 14px;
    margin-bottom: 8px;
}

.post-time {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* Upload Page */
.upload-box {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 30px;
}

.upload-box h2 {
    margin-bottom: 20px;
    text-align: center;
}

.file-input-wrapper {
    margin-bottom: 20px;
}

.file-input-wrapper input[type="file"] {
    display: none;
}

.custom-file-upload {
    display: block;
    border: 2px dashed var(--border-color);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    border-radius: 8px;
    transition: border-color 0.2s, background-color 0.2s;
    font-size: 16px;
    font-weight: 500;
}

.custom-file-upload:hover {
    border-color: var(--accent-color);
    background-color: rgba(46, 204, 113, 0.05);
}

.custom-file-upload i {
    display: block;
    font-size: 40px;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.upload-box textarea {
    width: 100%;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 8px;
    resize: vertical;
    margin-bottom: 20px;
    font-family: inherit;
}

.upload-box textarea:focus {
    outline: none;
    border-color: var(--text-secondary);
}

.anonymization-note {
    margin-top: 10px;
    font-size: 12px;
    color: var(--accent-color);
    text-align: center;
}

/* Profile Page */
.profile-header {
    display: flex;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.profile-avatar-large {
    font-size: 120px;
    color: var(--text-secondary);
    margin-right: 60px;
    flex-shrink: 0;
}

.profile-info {
    flex-grow: 1;
}

.profile-username {
    font-size: 28px;
    font-weight: 300;
    margin-bottom: 20px;
}

.profile-stats {
    display: flex;
    gap: 40px;
    font-size: 16px;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.grid-item {
    aspect-ratio: 1 / 1;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.grid-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-color);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    opacity: 0;
    transition: opacity 0.2s;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.grid-item:hover .grid-item-overlay {
    opacity: 1;
}

.no-posts {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.no-posts p {
    margin-bottom: 20px;
}

/* Instagram-style Post Modal */
.split-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    justify-content: center;
    align-items: center;
}

.split-modal .close-modal {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
}

.split-modal .modal-container {
    display: flex;
    background: var(--surface-color);
    width: 90%;
    max-width: 1000px;
    height: 80vh;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.modal-image-col {
    flex: 6;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-image-col img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.modal-info-col {
    flex: 4;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-color);
    background: var(--bg-color);
}

.modal-header {
    padding: 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.modal-comments {
    flex-grow: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-comments .comment {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.modal-comments .comment img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
}

.modal-actions {
    padding: 14px;
    border-top: 1px solid var(--border-color);
}

.modal-comment-form {
    display: flex;
    padding: 14px;
    border-top: 1px solid var(--border-color);
}

.modal-comment-form input {
    flex-grow: 1;
    border: none;
    background: transparent;
    outline: none;
    color: var(--text-primary);
}

.modal-comment-form button {
    background: none;
    border: none;
    color: var(--accent-color);
    font-weight: 600;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-avatar-large {
        font-size: 80px;
        margin-right: 0;
        margin-bottom: 20px;
    }

    .profile-stats {
        gap: 20px;
        font-size: 14px;
        flex-wrap: wrap;
    }

    .profile-grid {
        gap: 5px;
    }

    .nav-container {
        padding: 0 15px;
    }

    .nav-links {
        gap: 15px;
    }

    .nav-links a {
        font-size: 1.2rem;
    }

    .feed-container,
    .profile-container,
    .upload-container {
        margin: 15px auto;
        padding: 0 10px;
    }

    .auth-box {
        padding: 20px;
    }

    .split-modal .modal-container {
        flex-direction: column;
        height: 90vh;
        width: 100%;
        max-width: 500px;
        overflow-y: auto;
    }

    .modal-image-col {
        height: auto;
        flex: none;
        max-height: 50vh;
    }

    .modal-info-col {
        flex: auto;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
}

@media (max-width: 480px) {
    .navbar {
        position: fixed;
        top: auto;
        bottom: 0;
        width: 100%;
        border-bottom: none;
        border-top: 1px solid var(--border-color);
        padding: 0;
    }

    .nav-container {
        flex-direction: column;
        height: auto;
        padding: 0;
    }

    .nav-links {
        width: 100%;
        justify-content: space-around;
        padding: 10px 0;
        margin: 0;
    }

    .logo {
        display: none;
        /* Hide logo on mobile bottom bar */
    }

    .nav-links a {
        font-size: 1.5rem;
    }

    /* Make room for bottom nav */
    html,
    body {
        padding-bottom: 60px !important;
    }

    body.chat-page {
        height: calc(100vh - 60px);
        padding-bottom: 0 !important;
    }

    .chat-container {
        margin: 0;
        border: none;
        border-radius: 0;
        height: 100%;
    }

    .logo {
        font-size: 1.5rem;
    }

    .profile-avatar-large img {
        width: 80px !important;
        height: 80px !important;
    }

    .post-actions i {
        font-size: 20px;
    }

    .btn-primary {
        padding: 10px;
        font-size: 13px;
    }
}