/**
 * The Roman Roast - Main Application Styles
 * Signal-style 3-panel layout
 */

/* ==================== APP CONTAINER ==================== */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ==================== HEADER ==================== */
.app-header {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--ash-gray);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.app-logo-link {
    text-decoration: none;
    display: inline-block;
}

.app-logo {
    font-size: var(--font-size-lg);
    font-weight: 700;
    background: linear-gradient(135deg, var(--flame-red) 0%, var(--ember-orange) 50%, var(--solar-yellow) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.app-logo-link:hover .app-logo {
    opacity: 0.8;
}

.banner-message {
    color: #FF8C00; /* Orange */
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.user-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    border: 2px solid var(--ember-orange);
    object-fit: cover;
    flex-shrink: 0;
    display: block;
    background-color: var(--bg-tertiary);
    background-size: cover;
    background-position: center;
}

.user-name {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background-color: var(--bg-tertiary);
    color: var(--ember-orange);
}

/* ==================== MAIN LAYOUT ==================== */
.app-main {
    display: grid;
    grid-template-columns: 300px 1fr;
    flex: 1;
    overflow: hidden;
}

.app-main.has-links-panel {
    grid-template-columns: 300px 1fr 350px;
}

/* ==================== CHAT LIST PANEL (Left) ==================== */
.chat-list-panel {
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--ash-gray);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--ash-gray);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h2 {
    font-size: var(--font-size-md);
    margin: 0;
}

/* ==================== PUBLIC GROUPS SECTION (New) ==================== */
.public-groups-section {
    border-bottom: 2px solid var(--ash-gray);
    background: linear-gradient(180deg, var(--bg-secondary) 0%, rgba(139, 0, 0, 0.05) 100%);
    flex-shrink: 0;
}

.public-groups-section .panel-header {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--ash-gray);
}

.public-groups-section .panel-header h2 {
    font-size: var(--font-size-sm);
    color: var(--ember-orange);
}

.public-groups-list {
    display: flex;
    flex-direction: column;
    padding: var(--space-xs);
    max-height: 300px;
    overflow-y: auto;
}

/* Legacy support for global-groups-section */
.global-groups-section {
    border-bottom: 2px solid var(--ash-gray);
    background: linear-gradient(180deg, var(--bg-secondary) 0%, rgba(139, 0, 0, 0.05) 100%);
}

.global-groups-section .panel-header {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--ash-gray);
}

.global-groups-section .panel-header h2 {
    font-size: var(--font-size-sm);
    color: var(--ember-orange);
}

.global-groups-list {
    display: flex;
    flex-direction: column;
    padding: var(--space-xs);
}

.global-group-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    position: relative;
}

.global-group-item:hover {
    background-color: var(--hot-coals);
    transform: translateX(3px);
}

.global-group-item.active {
    background-color: var(--hot-coals);
    border-left: 3px solid var(--ember-orange);
}

.global-group-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.global-group-name {
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.global-group-item:hover .global-group-name {
    color: var(--ember-orange);
}

/* ==================== USER GROUPS SECTION ==================== */
.user-groups-section {
    flex-shrink: 0;
    border-bottom: 1px solid var(--ash-gray);
}

.user-groups-section .panel-header h2 {
    font-size: var(--font-size-md);
}

.groups-list {
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
    max-height: 400px;
}

.group-item {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--ash-gray);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.group-item:hover {
    background-color: var(--bg-tertiary);
}

.group-item.active {
    background-color: var(--hot-coals);
    border-left: 3px solid var(--ember-orange);
}

.chat-item-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* ==================== MESSAGES SECTION ==================== */
.messages-section {
    flex: 1;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.messages-section .panel-header h2 {
    font-size: var(--font-size-md);
}

.messages-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--ash-gray);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.chat-item:hover {
    background-color: var(--bg-tertiary);
}

.chat-item.active {
    background-color: var(--hot-coals);
    border-left: 3px solid var(--ember-orange);
}

.chat-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
    gap: var(--space-sm);
}

.chat-item-avatar-container {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
    min-width: 0;
}

.chat-item-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.chat-item-name {
    font-weight: 600;
    font-size: var(--font-size-base);
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    flex: 1;
}

.chat-item-time {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

.chat-item-preview {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==================== MESSAGE PANEL (Center) ==================== */
.message-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    overflow: hidden;
}

.message-panel-empty {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: var(--space-xl);
    overflow-y: auto;
    z-index: 1;
}

.message-panel-empty.hidden {
    display: none;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    width: 100%;
}

.empty-state h2 {
    font-size: var(--font-size-xxl);
    margin-bottom: var(--space-md);
}

/* ==================== HOME FEED ==================== */
.home-feed-tabs {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    margin: var(--space-lg) 0 var(--space-md);
    width: 100%;
}

.home-feed-tab {
    padding: var(--space-sm) var(--space-lg);
    background-color: var(--bg-secondary);
    border: 1px solid var(--ash-gray);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 120px;
}

.home-feed-tab:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--ember-orange);
    color: var(--text-primary);
}

.home-feed-tab.active {
    background-color: var(--ember-orange);
    border-color: var(--ember-orange);
    color: white;
}

.home-feed-tab.active:hover {
    background-color: var(--flame-red);
    border-color: var(--flame-red);
}

.home-feed-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.home-feed-loading,
.home-feed-empty,
.home-feed-error {
    text-align: center;
    padding: var(--space-lg);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.home-feed-list {
    width: 100%;
    max-width: 900px;
}

.home-feed-item {
    padding: var(--space-sm) var(--space-xs);
    border-bottom: 1px solid var(--ash-gray);
    transition: background-color var(--transition-fast);
    width: 100%;
}

.home-feed-item:hover {
    background-color: var(--bg-secondary);
}

.home-feed-item-content {
    display: flex;
    align-items: baseline;
    gap: var(--space-xs);
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.home-feed-source {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    font-weight: 500;
    flex-shrink: 0;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.home-feed-source:hover {
    color: var(--ember-orange);
    text-decoration: underline;
}

.home-feed-badge {
    font-size: var(--font-size-xs);
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.home-feed-badge-link {
    background-color: rgba(139, 0, 0, 0.2);
    color: #8b0000;
}

.home-feed-badge-thread {
    background-color: rgba(255, 140, 0, 0.2);
    color: #ff8c00;
}

.home-feed-title {
    flex: 1;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.4;
    min-width: 0; /* Allow text to wrap */
}

.home-feed-title:hover {
    color: var(--ember-orange);
    text-decoration: underline;
}

.home-feed-comments {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    flex-shrink: 0;
    margin-left: auto;
}

.home-feed-item-meta {
    display: flex;
    gap: var(--space-xs);
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-top: 2px;
}

.home-feed-author {
    color: var(--text-secondary);
}

.home-feed-time {
    color: var(--text-tertiary);
}

.home-feed-pagination {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin: var(--space-lg) 0;
    width: 100%;
}

.home-feed-pagination-btn {
    padding: var(--space-sm) var(--space-md);
    background-color: var(--bg-secondary);
    border: 1px solid var(--ash-gray);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 100px;
}

.home-feed-pagination-btn:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--ember-orange);
    color: var(--ember-orange);
}

.home-feed-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.message-panel-content {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    z-index: 2;
}

.message-panel-content.hidden {
    display: none;
}

/* ==================== GROUP VIEW (Two-Panel Layout) ==================== */
.group-view {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    z-index: 2;
}

.group-view.hidden {
    display: none;
}

.group-container-inner {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0;
    height: 100%;
    overflow: hidden;
}

@media (max-width: 767px) {
    .group-container-inner {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    .group-feed-panel {
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--ash-gray);
    }
    
    .group-chat-panel {
        max-height: 50vh;
        overflow: hidden;
    }
    
    /* Mobile toggle for group view panels */
    .group-feed-panel.mobile-hidden {
        display: none;
    }
    
    .group-chat-panel.mobile-hidden {
        display: none;
    }
    
    .group-feed-panel.mobile-full {
        max-height: 100%;
        grid-row: 1 / -1;
    }
    
    .group-chat-panel.mobile-full {
        max-height: 100%;
        grid-row: 1 / -1;
    }
}

/* Left Panel - Feed */
.group-feed-panel {
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--ash-gray);
}

.feed-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--ash-gray);
    background-color: var(--bg-secondary);
    flex-shrink: 0;
}

.feed-header-info h3 {
    margin: 0;
    font-size: var(--font-size-md);
    color: var(--text-primary);
}

.feed-controls-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-sm);
    gap: var(--space-md);
}

@media (max-width: 767px) {
    .feed-controls-top {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-sm);
    }
    
    .feed-tabs {
        width: 100%;
        justify-content: stretch;
    }
    
    .feed-tabs .feed-tab {
        flex: 1;
        text-align: center;
    }
    
    .feed-controls-top > div:last-child {
        display: flex;
        gap: var(--space-xs);
        width: 100%;
    }
    
    .feed-controls-top > div:last-child .btn {
        flex: 1;
        font-size: var(--font-size-xs);
        padding: var(--space-xs) var(--space-sm);
    }
}

.feed-controls {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--ash-gray);
    background-color: var(--bg-secondary);
    flex-shrink: 0;
}

.feed-tabs {
    display: flex;
    gap: 5px;
}

.feed-tab {
    padding: 8px 15px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.feed-tab:hover {
    background: var(--bg-tertiary);
}

.feed-tab.active {
    background: var(--ember-orange);
    color: #fff;
}

.feed-sort {
    display: flex;
    gap: 5px;
}

@media (max-width: 767px) {
    .feed-sort {
        flex-wrap: wrap;
        gap: var(--space-xs);
    }
    
    .feed-sort-btn {
        flex: 1;
        min-width: 0;
        font-size: var(--font-size-xs);
        padding: var(--space-xs) var(--space-sm);
    }
}

.feed-sort-btn {
    padding: 6px 12px;
    border: 1px solid var(--ash-gray);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.feed-sort-btn:first-child {
    border-radius: 15px 0 0 15px;
}

.feed-sort-btn:last-child {
    border-radius: 0 15px 15px 0;
}

.feed-sort-btn.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--ember-orange);
}

.feed-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

/* Feed Item Card */
.feed-item {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.2s;
    cursor: pointer;
}

.feed-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.feed-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.feed-item-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.feed-item-author {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.feed-item-meta {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.feed-item-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-left: auto;
}

.feed-item-type.thread {
    background: rgba(139, 0, 0, 0.2);
    color: #ff6b6b;
}

.feed-item-type.link {
    background: rgba(52, 152, 219, 0.2);
    color: #5dade2;
}

.feed-item-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 10px;
    line-height: 1.4;
    color: var(--text-primary);
}

.feed-item-title a {
    color: var(--text-primary);
    text-decoration: none;
}

.feed-item-title a:hover {
    color: var(--ember-orange);
}

.feed-item-excerpt {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.feed-item-image {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
}

.feed-item-stats {
    display: flex;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.feed-item-stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Right Panel - Chat (in group view) */
.group-chat-panel {
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.group-chat-panel .chat-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--ash-gray);
    background-color: var(--bg-secondary);
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group-chat-panel .chat-header-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.group-chat-panel .chat-header h3 {
    margin: 0;
    font-size: var(--font-size-md);
    color: var(--text-primary);
}

.group-chat-panel .btn-back {
    padding: 4px 8px;
    font-size: var(--font-size-md);
    color: var(--text-primary);
    background: transparent;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.group-chat-panel .btn-back:hover {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.group-chat-panel .panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.group-chat-panel .panel-content.hidden {
    display: none;
}

.group-chat-panel .message-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    min-height: 0;
}

.group-chat-panel .message-input-container {
    border-top: 1px solid var(--ash-gray);
    background-color: var(--bg-secondary);
    padding: var(--space-md) var(--space-lg);
    flex-shrink: 0;
}

/* Comments View */
.group-chat-panel .comments-item-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--ash-gray);
    background-color: var(--bg-secondary);
    flex-shrink: 0;
}

.group-chat-panel .comments-item-header h4 {
    margin: 0 0 var(--space-xs) 0;
    font-size: var(--font-size-md);
    color: var(--text-primary);
}

.group-chat-panel .comments-item-header .item-meta {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin: 0;
}

/* Comment styling */
.comment-item {
    padding: var(--space-sm);
    border-radius: 6px;
    background: var(--bg-tertiary);
    margin-bottom: var(--space-xs);
}

.comment-item .comment-author {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.comment-item .comment-author .avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
}

.comment-item .comment-content {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.comment-item .comment-meta {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-xs);
}

.comment-item .comment-replies {
    margin-top: var(--space-sm);
    padding-left: var(--space-lg);
    border-left: 2px solid var(--ash-gray);
}

/* Active feed item */
.feed-item.active {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--color-primary);
}

.empty-feed {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-feed-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.empty-feed h3 {
    margin: 0 0 var(--space-sm);
    color: var(--text-primary);
}

.message-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--ash-gray);
    background-color: var(--bg-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-info h3 {
    margin: 0;
    font-size: var(--font-size-md);
}

.chat-members {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin: 0;
}

.message-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    min-height: 0;
}

.message-item {
    display: flex;
    gap: var(--space-md);
    max-width: 70%;
    align-items: flex-start;
}

.message-item-own {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-round);
    flex-shrink: 0;
    object-fit: cover;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: 2px;
    flex-shrink: 0;
}

.message-author {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--ember-orange);
}

.message-time {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

.message-text {
    color: var(--text-primary);
    line-height: 1.5;
    word-wrap: break-word;
}

.message-edited {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    font-style: italic;
    margin-top: var(--space-xs);
}

/* ==================== MESSAGE INPUT ==================== */
.message-input-container {
    border-top: 1px solid var(--ash-gray);
    background-color: var(--bg-secondary);
    padding: var(--space-md) var(--space-lg);
    flex-shrink: 0;
}

.message-form {
    display: flex;
    gap: var(--space-md);
    align-items: flex-end;
}

.message-input {
    flex: 1;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--ash-gray);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    resize: none;
    max-height: 120px;
    transition: border-color var(--transition-fast);
}

.message-input:focus {
    outline: none;
    border-color: var(--ember-orange);
}

.btn-send {
    background-color: var(--ember-orange);
    border: none;
    border-radius: var(--radius-round);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.btn-send:hover {
    background-color: var(--blaze-orange);
    box-shadow: 0 0 15px rgba(255, 136, 0, 0.3);
}

.send-icon {
    color: white;
    font-size: 18px;
}

/* ==================== LINKS PANEL (Right) ==================== */
.links-panel {
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--ash-gray);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 300px;
}

.links-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

/* ==================== DROPDOWN MENU ==================== */
.dropdown-menu {
    position: fixed;
    top: 60px;
    right: var(--space-lg);
    background-color: var(--bg-elevated);
    border: 1px solid var(--ash-gray);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    min-width: 200px;
    z-index: 1000;
}

.dropdown-item {
    display: block;
    padding: var(--space-md) var(--space-lg);
    color: var(--text-primary);
    text-decoration: none;
    transition: background-color var(--transition-fast);
}

.dropdown-item:hover {
    background-color: var(--bg-tertiary);
    color: var(--ember-orange);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--ash-gray);
    margin: var(--space-sm) 0;
}

/* ==================== LOADING STATE ==================== */
.loading {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-tertiary);
    font-style: italic;
}

/* ==================== MOBILE NAVIGATION ==================== */
.mobile-menu-btn {
    display: none;
}

.mobile-back-btn {
    display: none;
}

.mobile-close-btn {
    display: none;
}

.mobile-panel-header {
    display: none;
}

/* Mobile overlay for panels */
.mobile-panel-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    opacity: 0;
    transition: opacity var(--transition-fast);
    backdrop-filter: blur(2px);
}

.mobile-panel-overlay.visible {
    display: block;
    opacity: 1;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .app-main {
        grid-template-columns: 250px 1fr;
    }
    
    .links-panel {
        display: none;
    }
}

@media (max-width: 767px) {
    /* Mobile menu button */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: var(--space-sm);
    }
    
    /* Mobile back buttons */
    .mobile-back-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: var(--space-sm);
    }
    
    /* Mobile close button */
    .mobile-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Mobile panel header */
    .mobile-panel-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: var(--space-md) var(--space-lg);
        border-bottom: 1px solid var(--ash-gray);
        background-color: var(--bg-secondary);
    }
    
    .app-main {
        grid-template-columns: 1fr !important;
    }
    
    /* Chat list panel - mobile overlay */
    .chat-list-panel {
        display: none;
    }
    
    .chat-list-panel.mobile-visible {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 200;
        background-color: var(--bg-secondary);
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }
    
    .chat-list-panel.mobile-visible.show {
        transform: translateX(0);
    }
    
    /* Prevent body scroll when mobile panel is open */
    body.mobile-panel-open {
        overflow: hidden;
    }
    
    .links-panel {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        z-index: 150;
        transform: translateX(100%);
        transition: transform var(--transition-normal);
    }
    
    .links-panel.show {
        transform: translateX(0);
    }
    
    .message-item {
        max-width: 85%;
    }
    
    .user-name {
        display: none;
    }
    
    /* Touch-friendly targets - minimum 44x44px */
    .btn-icon,
    .btn-send,
    button:not(.feed-tab):not(.feed-sort-btn):not(.home-feed-tab),
    .btn-primary,
    .btn-secondary {
        min-height: 44px;
        min-width: 44px;
        padding: var(--space-sm) var(--space-md);
    }
    
    .btn-icon {
        padding: var(--space-sm);
    }
    
    /* Touch-friendly form inputs - prevents zoom on iOS */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="url"],
    input[type="search"],
    input[type="tel"],
    textarea,
    select,
    .message-input,
    .form-input {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: var(--space-sm) var(--space-md);
    }
    
    /* Header adjustments for mobile */
    .app-header {
        padding: var(--space-sm) var(--space-md);
        padding-top: max(var(--space-sm), env(safe-area-inset-top));
        flex-wrap: wrap;
        min-height: 60px;
    }
    
    /* Safe area insets for notched devices */
    .app-container {
        padding-top: env(safe-area-inset-top, 0);
        padding-bottom: env(safe-area-inset-bottom, 0);
        padding-left: env(safe-area-inset-left, 0);
        padding-right: env(safe-area-inset-right, 0);
    }
    
    .chat-list-panel.mobile-visible {
        padding-top: max(60px, env(safe-area-inset-top, 60px));
    }
    
    .header-left {
        flex: 1;
        min-width: 0;
    }
    
    .app-logo {
        font-size: var(--font-size-md);
    }
    
    .banner-message {
        font-size: 0.75rem;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: block !important;
    }
    
    /* Message header with back button */
    .message-header {
        padding-left: var(--space-sm);
    }
    
    .message-header .chat-info {
        flex: 1;
        min-width: 0;
    }
    
    .message-header .chat-name {
        font-size: var(--font-size-base);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Group view feed header with back button */
    .feed-header-info {
        display: flex;
        align-items: center;
        gap: var(--space-sm);
        flex: 1;
        min-width: 0;
    }
    
    .feed-header-info h3 {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1;
    }
}

/* ==================== DROPDOWN MENU ==================== */
.dropdown-menu {
    position: absolute;
    background: var(--bg-secondary);
    border: 1px solid var(--ash-gray);
    border-radius: var(--radius-md);
    padding: var(--space-xs);
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.dropdown-menu.hidden {
    display: none;
}

.dropdown-item {
    display: block;
    padding: var(--space-sm) var(--space-md);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease;
    font-size: var(--font-size-sm);
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--ember-orange);
}

.dropdown-divider {
    height: 1px;
    background: var(--ash-gray);
    margin: var(--space-xs) 0;
}

