/* Twitter (X) App Styles */
.twitter-app {
    background-color: #fff;
    color: #333;
    display: flex;
    flex-direction: column;
    height: 100%;
    font-family: 'Nunito', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; /* More rounded font if available */
}

/* Header */
.t-header {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.t-avatar-small {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #f0f0f0;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.t-logo {
    font-size: 20px;
    font-weight: 800;
    color: #333;
    margin-left: 15px;
    letter-spacing: -0.5px;
}

.t-header-icon {
    font-size: 18px;
    color: #666;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}
.t-header-icon:hover {
    background: #f5f5f5;
    color: #333;
}

/* Content Area */
.t-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
    scroll-behavior: smooth;
}

.t-tab-page {
    display: none;
    padding-bottom: 80px; /* Space for FAB and Nav */
}

.t-tab-page.active {
    display: block;
}

/* Timeline Refresh Button */
.t-refresh-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    color: #1d9bf0;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 1px solid #eff3f4;
    transition: background 0.2s;
}
.t-refresh-btn:active { background-color: #f7f9f9; }
.t-refresh-btn i { margin-right: 5px; }

/* Tweet Item */
.tweet-item {
    display: flex;
    padding: 15px 20px;
    border-bottom: 1px solid #f8f8f8;
    cursor: pointer;
    transition: background 0.2s;
}

.tweet-item:active {
    background-color: #fafafa;
}

.tweet-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px; /* Softer square */
    background-color: #f0f0f0;
    margin-right: 15px;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
}

.tweet-content {
    flex: 1;
    min-width: 0;
}

.tweet-header {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
}

.tweet-name {
    font-weight: 700;
    margin-right: 6px;
    color: #333;
    font-size: 15px;
}

.tweet-handle, .tweet-time {
    color: #999;
    font-size: 13px;
}

.tweet-time::before {
    content: "·";
    margin: 0 6px;
    color: #ddd;
}

.tweet-text {
    font-size: 15px;
    line-height: 1.5;
    color: #444;
    margin-bottom: 12px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Image Grid */
.tweet-media {
    margin-top: 12px;
    border-radius: 12px;
    overflow: hidden;
    border: none;
    display: grid;
    gap: 2px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.tweet-media.grid-1 { grid-template-columns: 1fr; }
.tweet-media.grid-2 { grid-template-columns: 1fr 1fr; aspect-ratio: 2/1; }
.tweet-media.grid-3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 2/1; }
.tweet-media.grid-3 img:first-child { grid-row: span 2; }
.tweet-media.grid-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 1/1; }

.tweet-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Quote Tweet */
.tweet-quote {
    margin-top: 12px;
    border: 1px solid #cfd9de;
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
}
.tweet-quote:hover { background-color: #f7f9f9; }
.quote-header { display: flex; align-items: center; margin-bottom: 4px; }
.quote-avatar { width: 20px; height: 20px; border-radius: 50%; margin-right: 8px; background-size: cover; }
.quote-name { font-weight: 700; font-size: 14px; margin-right: 4px; }
.quote-handle { color: #536471; font-size: 14px; }

/* Actions */
.tweet-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    max-width: 100%;
    padding-right: 20px;
}

.t-action-btn {
    display: flex;
    align-items: center;
    color: #999;
    font-size: 13px;
    transition: color 0.2s;
}

.t-action-btn i {
    font-size: 16px;
    padding: 6px;
    border-radius: 50%;
    transition: background 0.2s;
    margin-right: 2px;
}

.t-action-btn:hover i { background-color: #f5f5f5; color: #333; }
.t-action-btn:hover span { color: #333; }

.t-action-btn.liked { color: #ff6b6b; }
.t-action-btn.liked i { color: #ff6b6b; }

.t-action-btn.retweeted { color: #333; }
.t-action-btn.retweeted i { color: #333; }

/* FAB */
.t-fab {
    position: absolute;
    bottom: 80px;
    right: 25px;
    width: 50px;
    height: 50px;
    border-radius: 18px; /* Squircle */
    background-color: #333;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    cursor: pointer;
    z-index: 20;
    transition: transform 0.2s, box-shadow 0.2s;
}
.t-fab:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.2); }
.t-fab:active { transform: scale(0.95); }

/* Bottom Nav */
.t-nav-bar {
    height: 65px;
    border-top: none;
    box-shadow: 0 -2px 20px rgba(0,0,0,0.03);
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: #fff;
    padding-bottom: env(safe-area-inset-bottom);
    border-radius: 20px 20px 0 0;
}

.t-nav-item {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.t-nav-item i {
    font-size: 24px;
    color: #333;
}

.t-nav-item.active {
    opacity: 1;
}
.t-nav-item.active i {
    font-weight: 900;
}

/* Sidebar Drawer */
.t-drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}
.t-drawer-overlay.open { display: block; opacity: 1; }

.t-drawer {
    position: absolute;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: #fff;
    z-index: 201;
    transition: left 0.3s ease-out;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}
.t-drawer.open { left: 0; }

.t-drawer-header {
    margin-bottom: 20px;
}
.t-drawer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #cfd9de;
    margin-bottom: 10px;
    background-size: cover;
}
.t-drawer-name { font-weight: 700; font-size: 17px; }
.t-drawer-handle { color: #536471; font-size: 15px; }
.t-drawer-stats { display: flex; gap: 20px; margin-top: 15px; font-size: 14px; }
.t-drawer-stats span b { color: #0f1419; }
.t-drawer-stats span { color: #536471; }

.t-drawer-menu { flex: 1; display: flex; flex-direction: column; gap: 20px; margin-top: 10px; }
.t-drawer-item { display: flex; align-items: center; gap: 20px; font-size: 20px; font-weight: 700; color: #0f1419; cursor: pointer; }
.t-drawer-item i { width: 24px; }

.t-drawer-footer { border-top: 1px solid #eff3f4; padding-top: 20px; display: flex; justify-content: space-between; }

/* DM Page */
.t-dm-item {
    display: flex;
    padding: 16px;
    cursor: pointer;
}
.t-dm-item:active { background-color: #f7f9f9; }
.t-dm-avatar { width: 48px; height: 48px; border-radius: 50%; background-color: #cfd9de; margin-right: 12px; background-size: cover; }
.t-dm-content { flex: 1; overflow: hidden; }
.t-dm-top { display: flex; justify-content: space-between; margin-bottom: 2px; }
.t-dm-name { font-weight: 700; font-size: 15px; }
.t-dm-date { color: #536471; font-size: 15px; }
.t-dm-msg { color: #536471; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* DM Chat Window */
.t-dm-window {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 50;
    display: none;
    flex-direction: column;
}
.t-dm-header {
    height: 53px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    border-bottom: 1px solid #eff3f4;
}
.t-dm-back { padding: 10px; cursor: pointer; }
.t-dm-header-info { flex: 1; display: flex; flex-direction: column; align-items: center; }
.t-dm-header-name { font-weight: 700; font-size: 17px; }
.t-dm-header-handle { color: #536471; font-size: 13px; }
.t-dm-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.t-msg-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 22px;
    font-size: 15px;
    line-height: 20px;
    word-wrap: break-word;
}
.t-msg-bubble.received {
    background-color: #eff3f4;
    color: #0f1419;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.t-msg-bubble.sent {
    background-color: #1d9bf0;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.t-dm-input {
    padding: 12px;
    border-top: 1px solid #eff3f4;
    display: flex;
    align-items: center;
    gap: 10px;
}
.t-dm-input input {
    flex: 1;
    background-color: #eff3f4;
    border: none;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 15px;
    outline: none;
}
.t-dm-send { color: #1d9bf0; cursor: pointer; font-weight: bold; }

/* New Styles */
.t-account-switcher-icon {
    cursor: pointer;
    padding: 5px;
}

.t-search-header {
    padding: 10px 16px;
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    z-index: 10;
}

.t-search-input {
    width: 100%;
    background-color: #eff3f4;
    border: none;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 15px;
    outline: none;
}

.t-dm-tab {
    transition: background 0.2s;
}
.t-dm-tab:hover {
    background-color: #f7f9f9;
}
