/**
 * Betly.social — Feed Page Styles
 *
 * Three-column layout, prediction cards, create post form,
 * wallet connect UI, theme toggle, responsive design.
 */

/* === Variables — Dark Mode === */
:root,
[data-theme="dark"] {
    --bg-primary: #060a13;
    --bg-secondary: #0d1320;
    --bg-card: #111827;
    --bg-card-hover: #1a2332;
    --bg-input: #0d1320;
    --text-primary: #f0f4f8;
    --text-secondary: #8899a8;
    --text-muted: #5a6a7a;
    --accent: #2e5bff;
    --accent-light: #5b7fff;
    --accent-glow: rgba(46, 91, 255, 0.15);
    --green: #10b981;
    --green-bg: rgba(16, 185, 129, 0.1);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.1);
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(46, 91, 255, 0.15);
    --navbar-bg: rgba(6, 10, 19, 0.85);
    --toggle-bg: #2a2f3a;
    --toggle-thumb: #6b7280;
    --radius: 16px;
    --radius-sm: 8px;
    --radius-pill: 100px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* === Variables — Light Mode === */
[data-theme="light"] {
    --bg-primary: #f8f9fc;
    --bg-secondary: #edf0f7;
    --bg-card: #ffffff;
    --bg-card-hover: #f3f5fa;
    --bg-input: #edf0f7;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --accent: #2e5bff;
    --accent-light: #2e5bff;
    --accent-glow: rgba(46, 91, 255, 0.08);
    --green: #059669;
    --green-bg: rgba(5, 150, 105, 0.08);
    --red: #dc2626;
    --red-bg: rgba(220, 38, 38, 0.08);
    --border: rgba(0, 0, 0, 0.06);
    --border-hover: rgba(0, 0, 0, 0.12);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 0 40px rgba(46, 91, 255, 0.08);
    --navbar-bg: rgba(248, 249, 252, 0.85);
    --toggle-bg: #d1d5db;
    --toggle-thumb: #9ca3af;
}

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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 10% 10%, rgba(46, 91, 255, 0.05) 0%, transparent 40%), radial-gradient(ellipse at 90% 50%, rgba(46, 91, 255, 0.03) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

[data-theme="light"] body::before,
[data-theme="light"]::before {
    background: radial-gradient(ellipse at 10% 10%, rgba(46, 91, 255, 0.02) 0%, transparent 40%);
}

/* === Layout === */
.app-layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 240px 600px 300px;
    gap: 0;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
}

/* === Sidebar === */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    transition: border var(--transition);
}

.sidebar-brand {
    margin-bottom: 32px;
    padding: 0 12px;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.sidebar-brand img {
    height: 36px;
}

.sidebar-brand .logo-dark {
    display: block;
}

.sidebar-brand .logo-light {
    display: none;
}

[data-theme="light"] .sidebar-brand .logo-dark {
    display: none;
}

[data-theme="light"] .sidebar-brand .logo-light {
    display: block;
}

.sidebar-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all var(--transition);
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
}

.nav-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
}

.sidebar-theme-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* === Theme Toggle === */
.theme-toggle {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--toggle-bg);
    border: 1px solid var(--border);
    border-radius: 13px;
    cursor: pointer;
    transition: background var(--transition);
    display: flex;
    align-items: center;
    padding: 0 3px;
}

.theme-toggle .toggle-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--toggle-thumb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: transform var(--transition), background var(--transition);
    transform: translateX(0);
}

[data-theme="light"] .theme-toggle .toggle-thumb {
    transform: translateX(21px);
}

/* === User Card === */
.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    background: var(--bg-card);
    transition: background var(--transition);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    flex-shrink: 0;
}

.user-name {
    font-weight: 700;
    font-size: 0.9rem;
}

.user-handle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-xp {
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 600;
}

.btn-wallet {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
    transition: all var(--transition);
}

.btn-wallet:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 91, 255, 0.3);
}

/* === Feed Column === */
.feed-col {
    border-right: 1px solid var(--border);
    transition: border var(--transition);
}

.feed-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--navbar-bg);
    backdrop-filter: blur(20px);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 800;
    font-size: 1.1rem;
    transition: background var(--transition);
}

.feed-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.feed-tab {
    flex: 1;
    text-align: center;
    padding: 14px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
}

.feed-tab:hover {
    color: var(--text-secondary);
}

.feed-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* === Create Post === */
.create-post-box {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    transition: background var(--transition);
}

.create-post-inner {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cp-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    cursor: pointer;
}

.cp-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cp-pred {
    flex: 1;
    padding: 10px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    border: 2px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.cp-pred.cp-yes.active {
    background: var(--green-bg);
    color: var(--green);
    border-color: rgba(16, 185, 129, 0.3);
}

.cp-pred.cp-no.active {
    background: var(--red-bg);
    color: var(--red);
    border-color: rgba(239, 68, 68, 0.3);
}

.cp-input {
    width: 120px;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
}

.cp-textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    resize: vertical;
    min-height: 60px;
    max-height: 200px;
}

.btn-post {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-post:hover {
    box-shadow: 0 4px 16px rgba(46, 91, 255, 0.3);
}

.btn-post:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === Prediction Card === */
.prediction-card {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.prediction-card:hover {
    background: var(--bg-secondary);
}

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

.card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-secondary);
    transition: background var(--transition);
    flex-shrink: 0;
}

.card-user-name {
    font-weight: 700;
    font-size: 0.95rem;
}

.card-user-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-user-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--accent-glow);
    color: var(--accent);
}

.card-market {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 14px;
}

.card-market a {
    color: inherit;
    text-decoration: none;
}

.card-market a:hover {
    text-decoration: underline;
}

.card-bet {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.bet-tag {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bet-yes {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.bet-no {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.bet-amount {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.card-content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-social {
    display: flex;
    gap: 20px;
}

.social-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: color var(--transition);
}

.social-btn:hover {
    color: var(--accent);
}

.social-btn.liked {
    color: var(--red);
}

.social-btn.reposted {
    color: var(--green);
}

.btn-copy {
    background: transparent;
    color: var(--accent);
    border: 1px solid rgba(46, 91, 255, 0.3);
    padding: 6px 18px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-copy:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* === Right Sidebar === */
.right-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.widget {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: background var(--transition), border var(--transition);
}

.widget-title {
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.trending-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.trending-item:last-child {
    border-bottom: none;
}

.trending-q {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
    flex: 1;
    margin-right: 8px;
}

.trending-odds {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.trending-odds.yes {
    background: var(--green-bg);
    color: var(--green);
}

.trending-vol {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 3px;
}

/* === Skeleton === */
.skeleton-line {
    height: 14px;
    width: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    margin-bottom: 8px;
}

.skeleton-line.short {
    width: 60%;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* === Toast === */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    z-index: 9999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-left: 3px solid var(--green);
}

.toast.error {
    border-left: 3px solid var(--red);
}

/* === Responsive === */
@media (max-width:1024px) {
    .app-layout {
        grid-template-columns: 72px 1fr 280px;
    }

    .sidebar-brand span,
    .nav-item span,
    .sidebar-theme-label {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 12px;
    }

    .sidebar-bottom .user-card {
        display: none;
    }
}

@media (max-width:768px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        flex-direction: row;
        padding: 0 8px;
        background: var(--navbar-bg);
        backdrop-filter: blur(20px);
        border-right: none;
        border-top: 1px solid var(--border);
        z-index: 1000;
    }

    .sidebar-brand,
    .sidebar-bottom {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
    }

    .nav-item span {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 10px;
    }

    .right-sidebar {
        display: none;
    }

    .feed-col {
        margin-bottom: 60px;
    }
}