/* ============================================================
   TWOWITTER — nostalgic 2009-era Twitter aesthetic
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue:        #0084b4;
    --blue-dark:   #006599;
    --blue-light:  #e8f5fd;
    --bg:          #c0deed;
    --white:       #ffffff;
    --border:      #d3e3ed;
    --border-dark: #a8c5d8;
    --text:        #333333;
    --text-muted:  #999999;
    --text-light:  #666666;
    --red:         #e0245e;
    --green:       #17bf63;
    --yellow:      #f5a623;
    --header-h:    52px;
}

html { font-size: 14px; }

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 20% 50%, rgba(255,255,255,.12) 0%, transparent 60%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,.08) 0%, transparent 50%);
    color: var(--text);
    line-height: 1.45;
    min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ─────────────────────────────────────────────── */
#site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--white);
    border-bottom: 3px solid var(--blue);
    height: var(--header-h);
    display: flex;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0,100,160,.18);
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-bird {
    font-size: 26px;
    line-height: 1;
}

.logo-text {
    font-size: 22px;
    font-weight: bold;
    color: var(--blue);
    letter-spacing: -0.5px;
}

.logo-text span {
    color: #0064a0;
    font-size: 13px;
    font-weight: normal;
    display: block;
    line-height: 1;
    margin-top: -2px;
    letter-spacing: 0;
}

nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

nav a {
    padding: 5px 10px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: bold;
    color: var(--text-light);
    transition: background .15s, color .15s;
}

nav a:hover, nav a.active {
    background: var(--blue-light);
    color: var(--blue);
    text-decoration: none;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-shrink: 0;
}

.header-user .username-chip {
    font-size: 13px;
    font-weight: bold;
    color: var(--blue);
}

.btn-logout {
    font-size: 12px;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 3px 10px;
    transition: all .15s;
}
.btn-logout:hover {
    color: var(--red);
    border-color: var(--red);
    text-decoration: none;
}

/* ── Layout ─────────────────────────────────────────────── */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px;
}

.layout {
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

.col-feed    { flex: 1; min-width: 0; }
.col-sidebar { width: 250px; flex-shrink: 0; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 14px;
    overflow: hidden;
}

.card-header {
    background: var(--blue);
    color: var(--white);
    padding: 8px 14px;
    font-weight: bold;
    font-size: 13px;
    letter-spacing: .3px;
}

.card-body { padding: 14px; }

/* ── Post Box ────────────────────────────────────────────── */
.post-box {}

.post-prompt {
    font-size: 16px;
    font-weight: bold;
    color: var(--text);
    margin-bottom: 8px;
}

.post-prompt small {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: normal;
    margin-left: 6px;
}

#twit-textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 9px 11px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 72px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    color: var(--text);
    background: #fafeff;
}

#twit-textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(0,132,180,.15);
    background: var(--white);
}

.post-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.char-counter {
    font-size: 12px;
    color: var(--text-muted);
    transition: color .2s;
}

.char-counter.warning { color: var(--yellow); }
.char-counter.danger  { color: var(--red); font-weight: bold; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 7px 18px;
    border-radius: 18px;
    border: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all .15s;
    line-height: 1.3;
    text-align: center;
}

.btn-primary {
    background: var(--blue);
    color: var(--white);
    border: 2px solid var(--blue-dark);
}
.btn-primary:hover {
    background: var(--blue-dark);
    text-decoration: none;
    color: var(--white);
}
.btn-primary:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--white);
    color: var(--blue);
    border: 2px solid var(--blue);
}
.btn-secondary:hover {
    background: var(--blue-light);
    text-decoration: none;
}

.btn-follow {
    font-size: 12px;
    padding: 4px 14px;
    border-radius: 12px;
}

.btn-follow.following {
    background: var(--white);
    color: var(--text-muted);
    border-color: var(--border);
}
.btn-follow.following:hover {
    background: #fff0f0;
    color: var(--red);
    border-color: var(--red);
}

.btn-sm {
    font-size: 12px;
    padding: 4px 12px;
}

/* ── Twit Items ──────────────────────────────────────────── */
.twit-list { }

.twit-item {
    display: flex;
    gap: 10px;
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    transition: background .1s;
}
.twit-item:last-child { border-bottom: none; }
.twit-item:hover { background: #f8fbfd; }

.twit-body { flex: 1; min-width: 0; }

.twit-meta {
    display: flex;
    align-items: baseline;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.twit-name {
    font-weight: bold;
    color: var(--text);
    font-size: 14px;
}
.twit-name:hover { color: var(--blue); text-decoration: underline; }

.twit-handle {
    color: var(--text-muted);
    font-size: 12px;
}

.twit-time {
    color: var(--text-muted);
    font-size: 12px;
    margin-left: auto;
}

.twit-content {
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    margin-bottom: 8px;
    color: var(--text);
}

.twit-content .mention { color: var(--blue); font-weight: bold; }
.twit-content .mention:hover { text-decoration: underline; }
.twit-content .hashtag { color: var(--blue); }
.twit-content .hashtag:hover { text-decoration: underline; }

.twit-actions {
    display: flex;
    gap: 14px;
    align-items: center;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    color: var(--text-muted);
    padding: 3px 6px;
    border-radius: 10px;
    transition: all .15s;
    user-select: none;
}

.action-btn:hover { background: var(--blue-light); color: var(--blue); }

.action-btn.liked    { color: var(--red); }
.action-btn.liked:hover { background: #ffe8ee; }

.action-btn.retwitted { color: var(--green); }
.action-btn.retwitted:hover { background: #e6f9ee; }

.action-btn .icon { font-size: 14px; }

/* ── Avatar ──────────────────────────────────────────────── */
.avatar {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    flex-shrink: 0;
    font-family: Arial, sans-serif;
    letter-spacing: .5px;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

/* ── Sidebar ─────────────────────────────────────────────── */
.trend-item {
    display: block;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    color: var(--blue);
    font-size: 13px;
    font-weight: bold;
}
.trend-item:last-child { border-bottom: none; }
.trend-item:hover { text-decoration: underline; }

.trend-count {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: normal;
    display: block;
}

.suggest-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.suggest-item:last-child { border-bottom: none; }

.suggest-info { flex: 1; min-width: 0; }
.suggest-name {
    font-weight: bold;
    font-size: 13px;
    color: var(--text);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.suggest-handle {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Auth pages ──────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo .bird { font-size: 52px; }

.auth-logo .name {
    font-size: 32px;
    font-weight: bold;
    color: var(--blue);
    line-height: 1;
}

.auth-logo .tagline {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.auth-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 28px 30px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 4px 18px rgba(0,100,160,.12);
}

.auth-card h2 {
    font-size: 20px;
    margin-bottom: 18px;
    color: var(--text);
}

.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-light);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 8px 11px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    color: var(--text);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(0,132,180,.15);
}

.form-submit { margin-top: 18px; }

.auth-link {
    text-align: center;
    margin-top: 14px;
    font-size: 13px;
    color: var(--text-muted);
}

.alert {
    padding: 9px 13px;
    border-radius: 5px;
    font-size: 13px;
    margin-bottom: 14px;
    border: 1px solid transparent;
}

.alert-error {
    background: #fff0f3;
    border-color: #fcc;
    color: #c00;
}

.alert-success {
    background: #f0fff4;
    border-color: #b2f5cc;
    color: #1a7a40;
}

/* ── Profile page ────────────────────────────────────────── */
.profile-header {
    padding: 22px 18px 16px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.profile-info { flex: 1; }

.profile-name {
    font-size: 22px;
    font-weight: bold;
    color: var(--text);
    line-height: 1.2;
}

.profile-handle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.profile-bio {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 10px;
    line-height: 1.4;
}

.profile-stats {
    display: flex;
    gap: 20px;
    font-size: 13px;
}

.stat-num {
    font-weight: bold;
    color: var(--text);
}

.stat-label { color: var(--text-muted); }

.profile-joined {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state .whale { font-size: 48px; margin-bottom: 10px; }
.empty-state p { font-size: 14px; line-height: 1.6; }

/* ── Footer ──────────────────────────────────────────────── */
#site-footer {
    text-align: center;
    padding: 20px;
    font-size: 12px;
    color: #7aabca;
    margin-top: 10px;
}

#site-footer a { color: #5599bb; }

/* ── Toast notifications ─────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--text);
    color: var(--white);
    padding: 9px 18px;
    border-radius: 20px;
    font-size: 13px;
    opacity: 0;
    animation: toast-in .25s ease forwards, toast-out .3s ease 2.2s forwards;
    white-space: nowrap;
    box-shadow: 0 3px 12px rgba(0,0,0,.3);
}

@keyframes toast-in  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; } }

/* ── Fail Whale ──────────────────────────────────────────── */
.fail-whale-banner {
    background: #eaf5ff;
    border: 2px dashed var(--blue);
    border-radius: 8px;
    text-align: center;
    padding: 20px;
    margin-bottom: 14px;
}
.fail-whale-banner .whale { font-size: 52px; }
.fail-whale-banner h3 { color: var(--blue); margin: 6px 0 4px; }
.fail-whale-banner p  { font-size: 12px; color: var(--text-muted); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 720px) {
    .col-sidebar { display: none; }
    .layout { flex-direction: column; }
}
