/* Haupt-Styles */
:root {
    --primary-color: #1DA1F2;
    --primary-hover: #1a91da;
    --secondary-color: #14171a;
    --text-primary: #14171a;
    --text-secondary: #657786;
    --border-color: #e1e8ed;
    --bg-primary: #ffffff;
    --bg-secondary: #f7f9fa;
    --bg-hover: #f7f9fa;
    --error-color: #e0245e;
    --success-color: #17bf63;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
    --border-radius: 12px;
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    display: flex;
    min-height: 100vh;
    padding-bottom: 60px;
}

/* Navigation */
.navbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    justify-content: center;
    padding: 8px 0;
}

.nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    max-width: 600px;
}

.nav-btn {
    background: none;
    border: none;
    padding: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.nav-btn svg {
    width: 24px;
    height: 24px;
}

.nav-btn.active {
    color: var(--primary-color);
}

.nav-btn .badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--error-color);
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    min-width: 18px;
    text-align: center;
}

/* Sidebar (Desktop) */
.sidebar {
    display: none;
    width: 250px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 30px;
}

.sidebar-nav {
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--border-radius);
    margin-bottom: 4px;
    transition: var(--transition);
}

.nav-link svg {
    width: 24px;
    height: 24px;
}

.nav-link:hover,
.nav-link.active {
    background: var(--bg-hover);
    color: var(--primary-color);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    margin-top: 20px;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-icon {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--border-radius);
    margin-top: auto;
    cursor: pointer;
    transition: var(--transition);
}

.user-info:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: bold;
    font-size: 14px;
}

.user-handle {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    background: var(--bg-primary);
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-header h1 {
    font-size: 20px;
    font-weight: bold;
}

.timeline-toggle {
    display: flex;
    gap: 8px;
}

.toggle-btn {
    background: none;
    border: none;
    padding: 8px 16px;
    color: var(--text-secondary);
    font-weight: bold;
    cursor: pointer;
    border-radius: 20px;
    transition: var(--transition);
}

.toggle-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Tweet Composer */
.tweet-composer {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
}

.composer-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    flex-shrink: 0;
}

.composer-content {
    flex: 1;
}

.composer-content textarea {
    width: 100%;
    border: none;
    resize: none;
    font-size: 20px;
    min-height: 100px;
    font-family: inherit;
    background: transparent;
    color: var(--text-primary);
}

.composer-content textarea:focus {
    outline: none;
}

.composer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.char-count {
    color: var(--text-secondary);
    font-size: 14px;
}

.char-count.warning {
    color: orange;
}

.char-count.error {
    color: var(--error-color);
}

/* Tweets */
.tweets-container {
    min-height: 400px;
}

.tweet {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
}

.tweet:hover {
    background: var(--bg-hover);
}

.tweet-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.tweet-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    flex-shrink: 0;
}

.tweet-user-info {
    flex: 1;
}

.tweet-username {
    font-weight: bold;
    font-size: 15px;
}

.tweet-username.verified::after {
    content: '✓';
    color: var(--primary-color);
    margin-left: 4px;
}

.tweet-handle {
    color: var(--text-secondary);
    font-size: 15px;
}

.tweet-time {
    color: var(--text-secondary);
    font-size: 15px;
}

.tweet-content {
    margin: 8px 0;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

.tweet-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.tweet-content a:hover {
    text-decoration: underline;
}

.tweet-actions {
    display: flex;
    justify-content: space-around;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.tweet-action {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 20px;
    transition: var(--transition);
    font-size: 14px;
}

.tweet-action svg {
    width: 18px;
    height: 18px;
}

.tweet-action:hover {
    background: var(--bg-hover);
}

.tweet-action.liked {
    color: var(--error-color);
}

.tweet-action.retweeted {
    color: var(--success-color);
}

.tweet-stats {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.modal-content h2 {
    margin-bottom: 20px;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.modal-content input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-footer {
    text-align: center;
    margin-top: 16px;
    color: var(--text-secondary);
}

.modal-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.modal-footer a:hover {
    text-decoration: underline;
}

/* Comment Preview */
.comment-preview {
    padding: 10px;
    background: #f0f0f0;
    border-radius: 8px;
    margin-bottom: 15px;
}

/* Tweet Details Modal */
.tweet-details-modal {
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.comments-list {
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.comments-list .tweet {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.comments-list .tweet:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.no-comments,
.comments-list .loading,
.comments-list .error {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    z-index: 999;
    transition: var(--transition);
}

.dark-mode-toggle svg {
    width: 24px;
    height: 24px;
}

.dark-mode-toggle .icon-sun {
    display: none;
}

.dark-mode-toggle .icon-moon {
    display: block;
}

body.dark-mode .dark-mode-toggle .icon-sun {
    display: block;
}

body.dark-mode .dark-mode-toggle .icon-moon {
    display: none;
}

/* Profile */
.profile-header {
    border-bottom: 1px solid var(--border-color);
}

.profile-banner {
    height: 200px;
    background: linear-gradient(135deg, var(--primary-color), #1a91da);
}

.profile-info {
    padding: 16px;
    position: relative;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 4px solid var(--bg-primary);
    margin-top: -40px;
    margin-bottom: 12px;
}

.profile-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.profile-name {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 4px;
}

.profile-handle {
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.profile-bio {
    margin-bottom: 16px;
    line-height: 1.5;
}

.profile-stats {
    display: flex;
    gap: 24px;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-weight: bold;
    font-size: 18px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.profile-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Search */
.search-container {
    padding: 16px;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 16px;
    background: var(--bg-secondary);
    margin-bottom: 16px;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-primary);
}

.search-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ff6b6b;
    color: white;
    text-align: center;
    padding: 8px;
    z-index: 3000;
    display: none;
}

/* Messages */
.conversations-list {
    max-height: calc(100vh - 60px);
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.conversation-item:hover {
    background: var(--bg-hover);
}

.conversation-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    flex-shrink: 0;
}

.conversation-info {
    flex: 1;
}

.conversation-name {
    font-weight: bold;
    margin-bottom: 4px;
}

.conversation-preview {
    color: var(--text-secondary);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.unread-badge {
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: bold;
}

.conversation-view {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
}

.conversation-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-primary);
}

.conversation-header-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 70%;
    padding: 12px;
    border-radius: 12px;
    word-wrap: break-word;
}

.message.sent {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
}

.message.received {
    align-self: flex-start;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.message-time {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.7;
}

.message-input-container {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.message-input {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.message-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Spaces */
.spaces-container {
    padding: 16px;
}

.space-item {
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 12px;
}

.space-item h3 {
    margin-bottom: 8px;
}

.space-item p {
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.space-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.member-badge {
    background: var(--success-color);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

/* Trending */
.trending-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.trending-item:hover {
    background: var(--bg-hover);
}

.trending-tag {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.trending-count {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Responsive */
@media (min-width: 768px) {
    .navbar {
        display: none;
    }
    
    .sidebar {
        display: block;
    }
    
    .container {
        padding-bottom: 0;
    }
}

