/* ─────────────────────────────────────────────
   REDDIT POSTER — Stylesheet
   ───────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
    --orange: #FF4500;
    --orange-dark: #cc3700;
    --orange-glow: rgba(255, 69, 0, .25);
    --bg: #0d0d0d;
    --surface: #1a1a1a;
    --surface2: #242424;
    --border: rgba(255, 255, 255, .08);
    --text: #e2e2e2;
    --muted: #888;
    --radius: 14px;
    --shadow: 0 8px 32px rgba(0, 0, 0, .45);
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ────────────────────────────────── */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.logo {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: 1.2rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--text);
}

.logo .snoo {
    font-size: 1.6rem;
}

.logo span em {
    color: var(--orange);
    font-style: normal;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
}

/* ── Buttons ───────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1.1rem;
    border-radius: 50px;
    border: none;
    font-size: .88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all .2s ease;
}

.btn-primary {
    background: var(--orange);
    color: #fff;
}

.btn-primary:hover {
    background: var(--orange-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 18px var(--orange-glow);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: rgba(255, 255, 255, .2);
}

/* ── Layout ────────────────────────────────── */
.app-body {
    flex: 1;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    max-width: 1100px;
    width: 100%;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}

/* ── Sidebar ───────────────────────────────── */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: .75rem;
}

#user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid var(--orange);
    object-fit: cover;
}

.user-meta small {
    color: var(--muted);
    font-size: .78rem;
}

#username-display {
    font-weight: 600;
    font-size: .95rem;
}

.tips-card h4 {
    font-size: .85rem;
    color: var(--muted);
    margin-bottom: .75rem;
    font-weight: 500;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.tips-card ul {
    list-style: none;
}

.tips-card li {
    font-size: .84rem;
    color: var(--muted);
    padding: .28rem 0;
    display: flex;
    gap: .4rem;
}

.tips-card li::before {
    content: "•";
    color: var(--orange);
}

/* ── Unauthenticated prompt ────────────────── */
#unauthenticated-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1rem;
    padding: 3rem 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

#unauthenticated-prompt .big-snoo {
    font-size: 4rem;
}

#unauthenticated-prompt h2 {
    font-size: 1.3rem;
}

#unauthenticated-prompt p {
    color: var(--muted);
    font-size: .9rem;
    max-width: 340px;
}

/* ── Post Form ─────────────────────────────── */
#post-form {
    display: none;
}

.form-header h2 {
    font-size: 1.4rem;
    margin-bottom: .3rem;
}

.form-header p {
    color: var(--muted);
    font-size: .88rem;
}

.tabs {
    display: flex;
    gap: .5rem;
    margin: 1.25rem 0;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--muted);
    font-size: .88rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all .2s;
}

.tab-btn.active {
    background: var(--orange);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 12px var(--orange-glow);
}

.tab-btn:not(.active):hover {
    color: var(--text);
    border-color: rgba(255, 255, 255, .2);
}

/* ── Form Fields ───────────────────────────── */
.form-group {
    margin-bottom: 1.1rem;
}

label {
    display: block;
    font-size: .85rem;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: .4rem;
}

.input-wrap {
    position: relative;
}

.input-prefix {
    position: absolute;
    left: .85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: .92rem;
    pointer-events: none;
}

input[type="text"],
input[type="url"],
textarea {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: .93rem;
    padding: .65rem .85rem;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.has-prefix input {
    padding-left: 2.5rem;
}

input:focus,
textarea:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px var(--orange-glow);
}

textarea {
    resize: vertical;
    min-height: 160px;
    line-height: 1.6;
}

.subreddit-wrap {
    position: relative;
}

#subreddit-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    list-style: none;
    overflow: hidden;
    z-index: 50;
}

#subreddit-suggestions li {
    padding: .55rem .85rem;
    font-size: .9rem;
    cursor: pointer;
    transition: background .15s;
}

#subreddit-suggestions li:hover {
    background: rgba(255, 69, 0, .15);
    color: var(--orange);
}

.char-count {
    font-size: .78rem;
    color: var(--muted);
    text-align: right;
    margin-top: .3rem;
}

/* ── Submit button ─────────────────────────── */
.submit-wrap {
    margin-top: 1.5rem;
}

#submit-btn {
    width: 100%;
    padding: .8rem;
    font-size: 1rem;
    justify-content: center;
    border-radius: 8px;
}

#submit-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Toast ─────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .85rem 1.25rem;
    font-size: .9rem;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(12px);
    transition: all .3s ease;
    pointer-events: none;
    max-width: 380px;
    z-index: 999;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.toast.success {
    border-color: #4caf50;
    color: #8dff91;
}

.toast.error {
    border-color: #f44336;
    color: #ff8a80;
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 720px) {
    .app-body {
        grid-template-columns: 1fr;
    }

    .sidebar {
        order: 2;
    }

    header {
        padding: 0 1rem;
    }

    .logo span {
        display: none;
    }
}