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

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #06b6d4;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-main);
    transition: background-color 0.3s ease;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.2s ease, transform 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* Header */
header {
    background-color: var(--bg-card);
    padding: .1rem .2rem;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    font-weight: 500;
    position: relative;
    padding: 0.5rem 0;
    color: var(--text-secondary);
}

.nav-links a:hover {
    color: var(--primary-color);
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Admin shard-picker */
.shard-picker {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--primary-color);
    font-size: 0.85rem;
}

.shard-picker i {
    opacity: 0.8;
}

.shard-picker select {
    background: var(--card-bg, #fff);
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    cursor: pointer;
    outline: none;
    transition: box-shadow 0.2s;
}

.shard-picker select:focus {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-color) 30%, transparent);
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Layout */
.home-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .home-container {
        grid-template-columns: minmax(300px, 2fr) 1fr;
    }
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
    opacity: 1;
    transition: opacity 0.5s ease;
}

.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-left: 4px solid var(--success);
}

.danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

.info {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--info);
    border-left: 4px solid var(--info);
}

/* Tweet Card */
.tweet {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    border: 1px solid var(--border-color);
}

.tweet:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.tweet-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.tweet-avatar {
    width: 50px;
    height: 50px;
    max-width: 50px;
    max-height: 50px;
    border-radius: var(--radius-full);
    margin-right: 1rem;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.tweet-user {
    font-weight: bold;
    color: var(--text-primary);
}

.tweet-username, .tweet-time {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

.tweet-content {
    margin: 1rem 0;
    line-height: 1.7;
    word-break: break-word;
}

.tweet-actions {
    display: flex;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.tweet-action {
    margin-right: 1.5rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s ease;
}

.tweet-action:hover {
    color: var(--primary-color);
}

.tweet-action.liked {
    color: #e11d48;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: inherit;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

/* Link-style actions (like / report): global button {} above would paint primary fill */
button.btn-link,
button.btn.btn-link,
a.btn-link {
    background-color: transparent !important;
    background-image: none !important;
    color: var(--text-secondary) !important;
    border: none !important;
    box-shadow: none !important;
}

button.btn-link:hover,
button.btn.btn-link:hover {
    background-color: rgba(79, 70, 229, 0.1) !important;
    color: var(--primary-color) !important;
}

button.btn-link.text-danger,
button.btn.btn-link.text-danger {
    color: var(--danger) !important;
}

button.btn-link.text-danger:hover,
button.btn.btn-link.text-danger:hover {
    background-color: rgba(239, 68, 68, 0.1) !important;
    color: var(--danger) !important;
}

/* Comment row uses class "dropdown-form" for flag; menu rules must not stretch full width here */
.comment-card .dropdown-form,
.reply-card .dropdown-form {
    width: auto;
}

.comment-card .dropdown-form button[type="submit"],
.reply-card .dropdown-form button[type="submit"] {
    width: auto !important;
    min-width: unset;
    text-align: left;
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
    background-color: transparent !important;
    color: var(--text-secondary) !important;
}

.comment-card .dropdown-form button[type="submit"]:hover,
.reply-card .dropdown-form button[type="submit"]:hover {
    background-color: rgba(79, 70, 229, 0.1) !important;
    color: var(--primary-color) !important;
}

/* Tweet composer */
.tweet-composer-container {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.composer-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.composer-avatar {
    width: 50px;
    height: 50px;
    max-width: 50px;
    max-height: 50px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.tweet-composer textarea {
    min-height: 100px;
    resize: vertical;
    margin-bottom: 1rem;
}

.composer-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.char-counter {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.char-counter.error {
    color: var(--danger);
}

/* Feed */
.feed h2 {
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    position: relative;
    display: inline-block;
}

.feed h2::after {
    content: '';
    position: absolute;
    width: 40%;
    height: 3px;
    bottom: -8px;
    left: 0;
    background-color: var(--primary-color);
    border-radius: var(--radius-full);
}

.no-tweets {
    padding: 2rem;
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    text-align: center;
    color: var(--text-secondary);
    border: 1px dashed var(--border-color);
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 2rem;
    height: fit-content;
}

.sidebar-section {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.sidebar-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-section h3 i {
    color: var(--primary-color);
}

.sidebar-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.popular-tags {
    list-style: none;
    padding: 0;
}

.popular-tags li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.popular-tags li:last-child {
    border-bottom: none;
}

.popular-tags a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.popular-tags a:hover {
    text-decoration: underline;
}

.tag-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    background-color: var(--bg-card);
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

/* Logo styles */
.logo-link {
    display: inline-block;
    position: relative;
}

.logo-img {
    height: 80px;
    width: auto;
    transition: all 0.3s ease;
    margin: 0;
    padding: 0;
    display: block;
}

.logo-link:hover .logo-img {
    transform: scale(1.25);
    content: url('../img/logo_blue.png');
}

/* Responsive adjustments */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }
    
    main {
        padding: 0 1rem;
    }
    
    .home-container {
        grid-template-columns: 1fr;
    }
    
    .nav-links a {
        font-size: 0.9rem;
    }
}

/* Loading indicators and animations */
.global-loading {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    z-index: 1000;
    border-left: 4px solid var(--primary-color);
    transition: opacity 0.5s ease;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(79, 70, 229, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-timestamp {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.fade-out {
    opacity: 0;
}

.load-timestamp {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Feed header styling */
.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.feed-actions {
    display: flex;
    gap: 0.5rem;
}

.refresh-btn {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
}

.refresh-btn:hover {
    background-color: rgba(79, 70, 229, 0.1);
}

/* Animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 0.5s ease;
}

.like-animation {
    animation: pulse 0.5s ease;
}

/* User profile in sidebar */
.user-info {
    padding: 1rem;
}

.user-info-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.user-avatar {
    width: 60px;
    height: 60px;
    max-width: 60px;
    max-height: 60px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.username {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.user-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: background-color 0.2s ease;
}

.stat-item:hover {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-value {
    font-weight: bold;
    font-size: 1.1rem;
}

/* Tweet menu and dropdown */
.tweet-menu {
    margin-left: auto;
}

.comment-menu {
    margin-left: auto;
    position: relative;
}

.dropdown {
    position: relative;
}

.dropdown-toggle {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.3rem;
    cursor: pointer;
    border-radius: var(--radius-full);
}

.dropdown-toggle:hover {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    transform: none;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background-color: var(--bg-card);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
    min-width: 150px;
    z-index: 10;
    display: none;
    overflow: hidden;
}

.dropdown-menu.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

.dropdown-menu button {
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    background: none;
    color: var(--text-primary);
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-menu .delete-btn {
    color: var(--danger);
}

.dropdown-menu .delete-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

.dropdown-menu .flag-btn {
    color: var(--warning);
}

.dropdown-menu .flag-btn:hover {
    background-color: rgba(245, 158, 11, 0.1);
}

.dropdown-form {
    width: 100%;
}

/* Explore page styles */
.explore-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    width: 100%;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.content-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 300px;
    gap: 2rem;
}

.feed-header {
    margin-bottom: 1.5rem;
}

.feed-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feed-header .subheading {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Post card styling */
.post-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    border: 1px solid var(--border-color);
}

.post-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.post-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
    position: relative;
}

.post-avatar-link {
    margin-right: 1rem;
    flex-shrink: 0;
}

.post-avatar {
    width: 48px;
    height: 48px;
    max-width: 48px;
    max-height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.post-author-info {
    flex-grow: 1;
}

.post-author-name {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

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

.post-user:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.post-username {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.post-time {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.post-menu {
    margin-left: auto;
    position: relative;
}

.post-content-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.post-content {
    margin: 1rem 0;
    line-height: 1.7;
    word-break: break-word;
    white-space: pre-line;
}

.post-media {
    margin: 1rem 0;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.post-media img, 
.post-media video {
    max-width: 100%;
    border-radius: var(--radius-md);
    display: block;
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.post-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.post-action:hover {
    color: var(--primary-color);
}

.post-action.like-btn.liked {
    color: var(--danger);
}

.post-action.like-btn.liked:hover {
    color: var(--danger-hover);
}

/* No posts state */
.no-posts {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    gap: 1rem;
    color: var(--text-secondary);
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.no-posts i {
    color: var(--primary-color);
    opacity: 0.7;
    margin-bottom: 1rem;
}

.no-posts h3 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        order: -1;
        margin-bottom: 2rem;
    }
}

@media (max-width: 768px) {
    .post-header {
        flex-wrap: wrap;
    }
    
    .post-author-info {
        width: calc(100% - 70px);
    }
    
    .post-menu {
        position: absolute;
        top: 0;
        right: 0;
    }
    
    .post-actions {
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .explore-container {
        padding: 0 0.5rem;
        margin: 1rem auto;
    }
    
    .feed-header h1 {
        font-size: 1.5rem;
    }
    
    .post-card {
        padding: 1rem;
    }
    
    .post-avatar {
        width: 40px;
        height: 40px;
    }
}

/* Timestamp display */
.load-timestamp {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #e2e8f0;
        --text-secondary: #94a3b8;
        --bg-main: #0f172a;
        --bg-card: #1e293b;
        --border-color: #334155;
    }
    
    .logo-link:hover .logo-img {
        content: url('../img/logo_white.png');
    }
}

/* Separator */
.tweet-separator {
    color: var(--text-secondary);
    margin: 0 0.25rem;
}

/* Clickable post content */
.tweet-content-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: background-color 0.2s ease;
    cursor: pointer;
    border-radius: var(--radius-md);
}

.tweet-content-link:hover {
    background-color: rgba(79, 70, 229, 0.05);
    color: inherit;
}

.tweet-content {
    margin: 1rem 0;
    line-height: 1.7;
    word-break: break-word;
}

/* Explore page specific styles */
.explore-container .feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    align-content: start;
}

/* Single column feed for explore page */
.explore-container .feed.single-column {
    display: flex;
    flex-direction: column;
    grid-template-columns: unset;
    gap: 1.5rem;
}

/* Ensure tweets in grid don't stretch unnecessarily */
.explore-container .tweet,
.explore-container .post-card {
    display: flex;
    flex-direction: column;
    height: fit-content;
    margin-bottom: 0;
}

.explore-container .feed.single-column .post-card {
    margin-bottom: 1.5rem;
}

/* Adjust sidebar positioning if needed */
.explore-container .sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
    width: 300px;
    flex-shrink: 0;
}

/* Tweet author info styling */
.tweet-author-info {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

/* Comment Reply Form */
.reply-form-container {
    margin-top: 1rem;
    margin-left: 1rem;
    padding: 1rem;
    background-color: var(--bg-main);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.reply-form textarea {
    min-height: 60px;
    margin-bottom: 0.5rem;
}

.reply-form-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.reply-form-footer button {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
}

.reply-form-footer .cancel-reply-btn {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.reply-form-footer .cancel-reply-btn:hover {
    background-color: var(--bg-card);
    border-color: var(--text-secondary);
}

/* Hashtag Link Styles */
.hashtag-link {
    color: var(--secondary-color);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.hashtag-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Popular Tags Sidebar */
.popular-tags {
    list-style: none;
    padding: 0;
    margin-top: 0.5rem;
}

.popular-tags li {
    margin-bottom: 0.75rem;
}

.popular-tags a {
    font-weight: 500;
    color: var(--primary-color);
    text-decoration: none;
}

.popular-tags a:hover {
    text-decoration: underline;
    color: var(--primary-hover);
}

.tag-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

/* Tweet Media Styles */
.tweet-media {
    margin-top: 1rem;
    border-radius: var(--radius-lg);
    overflow: hidden; /* Ensure content respects border radius */
    border: 1px solid var(--border-color);
    position: relative; /* Add positioning context */
    max-height: 500px; /* Limit height for large images */
}

.tweet-media img,
.tweet-media video {
    display: block;
    max-width: 100%;
    width: 100%; /* Ensure image takes full width of container */
    height: auto;
    max-height: 500px; /* Limit height for large images/videos */
    object-fit: contain; /* Changed from cover to contain */
}

.main-post-media img,
.main-post-media video {
    max-height: 600px; /* Allow slightly larger media on single post view */
    object-fit: contain; /* Ensure the whole image is visible */
}

/* Post Media in Post Detail Page */
.post-media img,
.post-media video {
    max-width: 100%;
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    border-radius: var(--radius-md);
    display: block;
}

/* Post page specific styles */
.comments-section {
    margin-top: 2rem;
}

.comment-card {
    margin-bottom: 1rem;
    transition: transform 0.2s ease;
}

.comment-card:hover {
    transform: translateY(-2px);
}

.reply-card {
    margin-left: 2rem;
    border-left: 3px solid var(--primary-color);
}

.replies {
    margin-top: 1rem;
    padding-left: 1rem;
}

/* Improve sidebar in post page */
.col-lg-4 .card {
    position: sticky;
    top: 100px;
    transition: box-shadow 0.3s ease;
}

.col-lg-4 .card:hover {
    box-shadow: var(--shadow-md);
}

/* Improve card spacing and layout */
.card-body {
    padding: 1.25rem;
}

.card-footer {
    background-color: rgba(0, 0, 0, 0.02);
    padding: 0.75rem 1.25rem;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .replies {
        margin-left: 0.5rem;
        padding-left: 0.5rem;
    }
    
    .reply-card {
        margin-left: 0.5rem;
    }
}

/* Fix container padding */
.container.mt-4 {
    padding-top: 1rem;
    padding-bottom: 2rem;
}

/* Fix for user profile pictures */
.rounded-circle {
    object-fit: cover;
}

/* File Input Styling */
input[type="file"] {
    display: none; /* Hide default ugly file input */
}

.file-upload-label {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--bg-main);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: var(--text-secondary);
}

.file-upload-label:hover {
    background-color: var(--bg-card);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.file-chosen-text {
    margin-left: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.media-upload-guidance {
    margin-top: 0.65rem;
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-md);
    background-color: rgba(59, 130, 246, 0.08);
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.5;
    border-left: 4px solid var(--info);
}

.media-upload-guidance.info {
    background-color: rgba(59, 130, 246, 0.08);
    border-left-color: var(--info);
}

.media-upload-guidance.warning {
    background-color: rgba(245, 158, 11, 0.1);
    border-left-color: var(--warning);
}

.media-upload-guidance.error {
    background-color: rgba(239, 68, 68, 0.1);
    border-left-color: var(--danger);
    color: var(--danger);
}

.current-profile-pic {
    margin-bottom: 1rem;
}

.current-profile-pic p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.current-profile-pic img {
    border-radius: var(--radius-full);
    border: 2px solid var(--border-color);
}

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

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Apply animations */
.feed-header {
    animation: fadeIn 0.5s ease forwards;
}

.post-card {
    animation: fadeIn 0.5s ease forwards;
    animation-delay: calc(var(--animation-order, 0) * 0.1s);
    opacity: 0;
}

.sidebar-section {
    animation: slideInRight 0.5s ease forwards;
    animation-delay: 0.2s;
    opacity: 0;
}

.load-timestamp {
    animation: fadeIn 0.5s ease forwards;
    animation-delay: 0.3s;
    opacity: 0;
}

.post-action:hover .icon {
    animation: pulse 0.5s ease;
}

/* Apply animation order to posts */
.feed .post-card:nth-child(1) { --animation-order: 0; }
.feed .post-card:nth-child(2) { --animation-order: 1; }
.feed .post-card:nth-child(3) { --animation-order: 2; }
.feed .post-card:nth-child(4) { --animation-order: 3; }
.feed .post-card:nth-child(5) { --animation-order: 4; }
.feed .post-card:nth-child(6) { --animation-order: 5; }
.feed .post-card:nth-child(7) { --animation-order: 6; }
.feed .post-card:nth-child(8) { --animation-order: 7; }
.feed .post-card:nth-child(9) { --animation-order: 8; }
.feed .post-card:nth-child(10) { --animation-order: 9; }

/* Reduce animations if user prefers reduced motion */
@media (prefers-reduced-motion) {
    .feed-header,
    .post-card,
    .sidebar-section,
    .load-timestamp {
        animation: none;
        opacity: 1;
    }
    
    .post-action:hover .icon {
        animation: none;
    }
}

/* Sidebar links */
.sidebar-links {
    list-style: none;
    margin-top: 1rem;
}

.sidebar-links li {
    margin-bottom: 0.8rem;
}

.sidebar-links a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
    padding: 0.5rem;
    border-radius: var(--radius-md);
}

.sidebar-links a:hover {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    transform: translateX(5px);
}

.sidebar-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    color: white;
}

.button.secondary {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.button.secondary:hover {
    background-color: rgba(79, 70, 229, 0.1);
}

.full-width {
    width: 100%;
}

/* Improved interactive elements */
.post-action, .tweet-action, .like-btn, button[type="submit"] {
    transition: transform 0.2s ease, color 0.2s ease, background-color 0.2s ease;
    position: relative;
}

.post-action:hover, .tweet-action:hover, .like-btn:hover, button[type="submit"]:not(.dropdown-toggle):hover {
    transform: translateY(-2px);
}

.post-action:active, .tweet-action:active, .like-btn:active, button[type="submit"]:not(.dropdown-toggle):active {
    transform: translateY(0);
}

/* Improved like button visibility */
.like-btn i.far.fa-heart, .post-action i.far.fa-heart {
    color: var(--text-secondary);
}

.like-btn:hover i.far.fa-heart, .post-action:hover i.far.fa-heart {
    color: var(--danger);
}

.like-btn i.fas.fa-heart, .post-action i.fas.fa-heart, 
.like-btn.liked i, .post-action.liked i {
    color: var(--danger);
}

/* Improved delete button (less prominent) */
.delete-form button, button.delete-btn {
    color: var(--text-secondary);
    background-color: transparent;
    border: none;
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.delete-form button:hover, button.delete-btn:hover {
    color: var(--danger);
    background-color: rgba(239, 68, 68, 0.1);
}

/* Improved comment form */
textarea[name="content"] {
    min-height: 60px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    resize: vertical;
}

textarea[name="content"]::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

textarea[name="content"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

/* Improved spacing for mobile */
@media (max-width: 768px) {
    .post-card, .tweet, .comment-card {
        padding: 1.25rem;
    }
    
    .post-content, .tweet-content, .card-text {
        line-height: 1.6;
        margin: 0.8rem 0;
    }
    
    .post-header, .tweet-header {
        margin-bottom: 0.8rem;
    }
    
    .post-actions, .tweet-actions, .card-footer {
        padding-top: 0.8rem;
        margin-top: 0.8rem;
    }
    
    .post-avatar, .tweet-avatar {
        width: 45px;
        height: 45px;
    }
}

/* Better visual hierarchy for timestamps */
.post-time, .tweet-time, .text-muted {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
    display: inline-block;
    margin-top: 0.2rem;
}

/* Improved empty state messages */
.no-posts p, .no-tweets p, p.text-muted {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Zero-state improvements */
.post-action span:only-child:not(.icon), .tweet-action span:only-child:not(.icon) {
    position: relative;
}

.like-count:empty::after, span.likes:empty::after, 
.post-action span:only-child[data-count="0"]:not(.icon)::after, 
.tweet-action span:only-child[data-count="0"]:not(.icon)::after {
    content: "Be first";
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Improved avatar sizing and consistency */
.post-avatar, .tweet-avatar {
    width: 48px;
    height: 48px;
    max-width: 48px;
    max-height: 48px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
}

/* Condensed sidebar for better information hierarchy */
.sidebar-section {
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

/* Improved focus states for accessibility */
a:focus, button:focus, input:focus, textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Improved mobile responsiveness for navigation */
@media (max-width: 768px) {
    .nav-links {
        gap: 0.75rem;
    }
    
    .nav-links a {
        padding: 0.5rem;
        text-align: center;
        border-radius: var(--radius-md);
        transition: background-color 0.2s ease;
    }
    
    .nav-links a:hover {
        background-color: rgba(79, 70, 229, 0.1);
    }
    
    .nav-links a::after {
        display: none;
    }
    
    .nav-text {
        display: none;
    }
    
    .nav-links a i {
        font-size: 1.2rem;
        margin-right: 0;
    }
    
    .logo-img {
        height: 60px;
    }
}

/* Improved alert animations */
.alert {
    transition: opacity 0.5s ease;
    animation: slideDown 0.3s ease;
}

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

/* Fixed comment form layout */
.comment-card, .reply-card {
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.comment-card:hover, .reply-card:hover {
    box-shadow: var(--shadow-md);
}

/* Improved spacing for zero engagement states */
.no-comments {
    padding: 1.5rem;
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px dashed var(--border-color);
    margin: 1rem 0;
}

.no-comments i {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-right: 0.5rem;
}

/* Improved dropdown menu layout */
.dropdown-menu {
    border: 1px solid var(--border-color);
    min-width: 180px;
    padding: 0.5rem 0;
}

.dropdown-form {
    width: 100%;
}

.dropdown-form button {
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

/* Improved "be first" states */
.post-action span:empty::before,
.post-action span:contains("0")::before {
    content: "Be first";
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Improved accessibility support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus visible support for keyboard users */
:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 3px;
}

/* Improved post action buttons */
.card-footer .d-flex {
    display: flex !important;
    flex-direction: row !important;
}

.card-footer .btn-sm.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    margin: 0;
    background-color: rgba(79, 70, 229, 0.05);
    border-radius: 9999px; /* pill shape */
    transition: all 0.2s ease;
}

.card-footer .btn-sm.btn-link:hover {
    background-color: rgba(79, 70, 229, 0.1);
    transform: translateY(-2px);
}

.card-footer .btn-sm.btn-link i {
    font-size: 1rem;
}

/* Ensure post actions have proper spacing */
.card-footer .d-flex.align-items-center.gap-3 {
    gap: 1rem !important;
}

/* Fix for potential media query issues */
@media (max-width: 576px) {
    .card-footer .d-flex.align-items-center {
        flex-direction: row !important;
    }
}

/* Styled post action container */
.post-actions-container {
    padding: 0.75rem 1rem;
    background-color: transparent;
    border-top: 1px solid var(--border-color);
}

/* Make sure buttons look consistent and attractive */
.btn-sm.btn-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.btn-sm.btn-link:hover {
    color: var(--primary-color);
}

.btn-sm.btn-link .fas.fa-heart.text-danger,
.btn-sm.btn-link .fas.fa-heart {
    color: var(--danger);
}

/* Make sure the dropdown menu appears correctly */
.dropdown-menu-end {
    right: 0;
    left: auto;
}

/* Remove form margin that might affect layout */
form.m-0 {
    margin: 0 !important;
}

/* Add small animation for hover state */
.btn-sm.btn-link:hover i {
    transform: scale(1.15);
    transition: transform 0.2s ease;
}

/* Consistent styling for all action buttons (posts, comments, replies) */
.post-action, .tweet-action, .like-btn, .reply-toggle, .like-comment-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border-radius: 9999px;
    background-color: rgba(79, 70, 229, 0.05);
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    border: none;
}

.post-action:hover, .tweet-action:hover, .like-btn:hover, .reply-toggle:hover, .like-comment-btn:hover {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* Style like buttons consistently */
.like-btn i, .like-comment-btn i {
    font-size: 1rem;
}

.like-btn:hover i.far.fa-heart, .like-comment-btn:hover i.far.fa-heart {
    color: var(--danger);
}

/* Post media display improvements */
.post-media {
    margin: 1rem 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    text-align: center;
    max-height: 500px;
}

.post-media img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
    border-radius: var(--radius-md);
}

/* Fix for comment forms */
form.m-0 {
    margin: 0 !important;
    display: inline-flex;
}

/* Style consistency for multiple UI components */
.comment-card, .reply-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.comment-card .card-body, .reply-card .card-body {
    padding: 1rem;
}

.replies {
    margin-left: 2rem;
    margin-top: 0.75rem;
    padding-left: 0.75rem;
    border-left: 3px solid var(--primary-color);
}

/* Image picker for debug/fixing image issues */
.image-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    justify-content: flex-start;
}

.image-option {
    cursor: pointer;
    border: 1px solid var(--border-color);
    padding: 5px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    background-color: white;
}

.image-option:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.image-option.selected {
    border: 3px solid var(--primary-color);
}

.image-option img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.image-option .file-name {
    font-size: 9px;
    word-break: break-all;
    margin-top: 3px;
    text-align: center;
    color: var(--text-secondary);
}

/* Debug info */
.debug-info {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 5px;
    word-break: break-all;
    background-color: rgba(0,0,0,0.03);
    padding: 5px;
    border-radius: var(--radius-sm);
}

/* Media preview styles */
.tweet-media-preview {
    max-height: 250px;
    position: relative;
    overflow: hidden;
    transition: opacity 0.3s ease;
    border-radius: var(--radius-md);
}

.media-indicator {
    position: absolute;
    bottom: 10px;
    right: 10px;
    padding: 0.4rem 0.8rem;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.8rem;
    border-radius: var(--radius-md);
    z-index: 2;
    backdrop-filter: blur(4px);
}

.tweet-media-preview img {
    max-height: 250px;
    transition: transform 0.3s ease;
    display: block;
    width: 100%;
    object-fit: cover;
}

.video-preview {
    position: relative;
    width: 100%;
    height: 100%;
}

.video-preview video {
    max-height: 250px;
    object-fit: cover;
    width: 100%;
    display: block;
}

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    z-index: 2;
}

.play-button:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 55%;
    transform: translate(-40%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 15px 0 15px 25px;
    border-color: transparent transparent transparent white;
    z-index: 3;
}

.tweet-content-link:hover .tweet-media-preview img {
    transform: scale(1.03);
}

.tweet-content-link:hover .tweet-media-preview {
    opacity: 0.95;
}

/* View post hint */
.view-post-hint {
    margin-top: 0.75rem;
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.3rem 0;
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.tweet-content-link:hover .view-post-hint {
    opacity: 1;
    color: var(--primary-color);
    transform: translateX(-3px);
}

/* Profile styles */
.profile-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1rem;
}

.profile-header {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    display: flex;
    flex-direction: column;
}

.profile-cover {
    height: 150px;
    background-color: var(--primary-color);
    background-image: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    margin: -1.5rem;
    margin-bottom: 1rem;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}

.profile-avatar {
    margin-top: -75px;
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
    align-self: flex-start;
    margin-left: 2rem;
}

.profile-avatar img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 5px solid var(--bg-card);
    background-color: var(--bg-card);
    object-fit: cover;
}

.profile-info {
    padding: 0 1rem;
}

.profile-name {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.profile-username {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.profile-bio {
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.profile-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-count {
    font-weight: bold;
    font-size: 1.2rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.profile-actions {
    margin-top: 1rem;
}

.btn-follow, .btn-edit-profile {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-full);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-follow:hover, .btn-edit-profile:hover {
    background-color: var(--primary-hover);
}

.btn-follow.following {
    background-color: var(--bg-main);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-follow.following:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: var(--danger);
}

.profile-tweets {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.profile-tweets h3 {
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    position: relative;
    display: inline-block;
}

.profile-tweets h3::after {
    content: '';
    position: absolute;
    width: 40%;
    height: 3px;
    bottom: -8px;
    left: 0;
    background-color: var(--primary-color);
    border-radius: var(--radius-full);
}

.profile-tweets .tweet {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

.profile-tweets .tweet:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.no-tweets {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
} 