/* Main CSS for RedNet */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons+Outlined');

:root {
    /* Map to theme.css variables */
    --primary-color: var(--primary);
    --primary-gradient: linear-gradient(135deg, var(--primary), #ff6b6b);
    --bg-color: var(--background);
    --card-bg: var(--glass);
    /* Glassy background */
    --text-primary: var(--text);
    --text-secondary: var(--text-secondary);
    --border-color: var(--glass-border);
    --hover-bg: var(--glass);
    --shadow-sm: var(--shadow);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.2);
    --radius-md: 12px;
    --radius-lg: 20px;
    --header-height: 70px;
    /* Slightly taller for glass nav */
}

/* Dark mode variables are handled by theme.css mapping above */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-color);
    background-image: radial-gradient(circle at 50% 0%, rgba(255, 0, 60, 0.15) 0%, transparent 70%);
    background-attachment: fixed;
    color: var(--text-primary);
    transition: 0.3s;
}

/* Layout */
.app-layout {
    display: grid;
    grid-template-columns: 260px 1fr 300px;
    gap: 24px;
    max-width: 1400px;
    margin: 80px auto 0;
    /* Changed from 0 auto to accommodate fixed header */
    padding: 24px;
}

.sidebar {
    position: sticky;
    top: 90px;
    height: fit-content;
}

.feed-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 80px;
}

/* Navigation */
.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: 0.2s;
    margin-bottom: 4px;
    font-weight: 500;
    cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
    background: var(--hover-bg);
    color: var(--primary-color);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
}

.nav-item .material-icons,
.nav-item .material-icons-outlined {
    margin-right: 12px;
}

/* Header & Filter Bar */
.filter-bar {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding: 4px 0 12px;
    margin-bottom: 8px;
    scrollbar-width: none;
}

.filter-chip {
    padding: 6px 16px;
    border-radius: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
    transition: 0.2s;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.filter-chip:hover,
.filter-chip.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Common Components */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.icon-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    transition: 0.2s;
}

.icon-btn:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 8px 24px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.3);
}

/* Create Post */
/* This valid CSS was already there, so the @extend block was redundant */
.create-post-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* Using CSS class logic below */
.create-post-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.post-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.current-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.post-textarea {
    flex: 1;
    background: rgba(0, 0, 0, 0.05);
    /* Transparent input */
    border: 1px solid transparent;
    padding: 12px;
    border-radius: var(--radius-md);
    resize: none;
    font-family: inherit;
    font-size: 15px;
    color: var(--text-primary);
    width: 100%;
}

.post-textarea:focus {
    outline: none;
    background: var(--card-bg);
    border-color: var(--primary-color);
}

/* Post Styles */
.post-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
    overflow: hidden;
    animation: fadeIn 0.4s ease-out;
}

.post-header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.user-info {
    display: flex;
    gap: 12px;
    align-items: center;
}

.user-meta h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.user-meta span {
    font-size: 13px;
    color: var(--text-secondary);
}

.post-content {
    padding: 0 16px 16px;
    font-size: 15px;
    color: var(--text-primary);
    white-space: pre-wrap;
    line-height: 1.5;
}

.post-media {
    width: 100%;
    max-height: 600px;
    object-fit: cover;
    display: block;
}

.post-footer-actions {
    padding: 4px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
}

.action-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--radius-md);
    margin: 4px;
}

.action-btn:hover {
    background: var(--hover-bg);
}

.action-btn.liked {
    color: var(--primary-color);
}

/* Special Post Types */
/* Polls */
.poll-container {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.poll-option {
    position: relative;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    transition: 0.2s;
    background: var(--card-bg);
}

.poll-option:hover {
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.poll-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(211, 47, 47, 0.1);
    z-index: 1;
    transition: width 0.5s ease;
    width: 0;
}

.poll-content {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 500;
}

.poll-option.voted .poll-bar {
    background: rgba(211, 47, 47, 0.2);
}

.poll-option.voted {
    border-color: var(--primary-color);
}

/* QA */
.qa-card {
    background: var(--hover-bg);
    border-radius: 8px;
    padding: 12px;
    border-left: 4px solid var(--primary-color);
    margin-bottom: 12px;
}

.qa-question {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
    display: block;
}

.qa-category {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(211, 47, 47, 0.1);
    color: var(--primary-color);
    margin-bottom: 8px;
}

.qa-answers-list {
    margin-top: 12px;
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
}

.qa-answer-item {
    background: var(--card-bg);
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 14px;
    border: 1px solid var(--border-color);
}

/* AI Cards */
.ai-card {
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    margin: 12px 0;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
}

/* Suggestion Box */
.autosuggest-box {
    position: absolute;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 2000;
    width: 250px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

.suggestion-item:hover,
.suggestion-item.active {
    background: var(--hover-bg);
}

.suggestion-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

/* Stories */
.stories-flow {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 12px 0;
    scrollbar-width: none;
}

.stories-flow::-webkit-scrollbar {
    display: none;
}

.story-bubble {
    flex-shrink: 0;
    width: 70px;
    text-align: center;
    cursor: pointer;
}

.story-ring {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    padding: 2px;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 4px;
}

.story-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--card-bg);
    object-fit: cover;
}

.story-name {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.story-add-btn {
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Widgets */
.widget-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 16px;
    margin-bottom: 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.widget-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
}

/* RedSynapse Button */
#ai-float-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    animation: floatPulse 3s infinite;
}

@keyframes floatPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(211, 47, 47, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0);
    }
}

/* Animations */
@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile */
@media (max-width: 1024px) {
    .app-layout {
        grid-template-columns: 80px 1fr;
        gap: 16px;
    }

    .widgets {
        display: none;
    }

    .nav-item span:not(.material-icons-outlined) {
        display: none;
    }

    .nav-item {
        justify-content: center;
    }

    .current-user-name {
        display: none;
    }
}

@media (max-width: 768px) {
    .app-layout {
        display: block;
        padding: 12px;
        padding-bottom: 70px;
    }

    .sidebar {
        display: none;
    }

    /* Could be replaced by bottom nav */
    .header-content {
        justify-content: center;
    }
}

.hidden {
    display: none !important;
}

/* Comments Section */
.comments-section {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--hover-bg);
    display: none;
    animation: fadeIn 0.3s ease;
}

.comments-section.open {
    display: block;
}

.comment-list {
    margin: 12px 0;
    max-height: 300px;
    overflow-y: auto;
}

.comment-item {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 14px;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-body {
    background: var(--card-bg);
    padding: 8px 12px;
    border-radius: 12px;
    border-bottom-left-radius: 2px;
    border: 1px solid var(--border-color);
    flex: 1;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    align-items: center;
}

.comment-author {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.comment-time {
    font-size: 11px;
    color: var(--text-secondary);
}

.comment-text {
    line-height: 1.4;
    color: var(--text-primary);
}

.comment-input-area {
    display: flex;
    gap: 8px;
    align-items: center;
}

.comment-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
    font-family: inherit;
}

.comment-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.comment-send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

.comment-send-btn:hover {
    transform: scale(1.05);
}

/* Verification Badge Styles */
.badge-verified {
    color: #1da1f2;
    font-size: 16px !important;
    vertical-align: middle;
    margin-left: 4px;
}

.badge-owner {
    color: #d32f2f;
    font-size: 16px !important;
    vertical-align: middle;
    margin-left: 4px;
}