/* ================================================================== */
/*  Post Quality — Design System                                       */
/*  Inspired by Linear / Stripe: dark sidebar, crisp typography        */
/* ================================================================== */

/* ── Custom properties ─────────────────────────────────────────────── */
:root {
    /* Colors */
    --accent:          #5E6AD2;
    --accent-hover:    #4A55C2;
    --accent-subtle:   #EEF0FB;

    --success:         #22C55E;
    --success-subtle:  #F0FDF4;
    --danger:          #EF4444;
    --danger-subtle:   #FEF2F2;
    --warning:         #F59E0B;
    --warning-subtle:  #FFFBEB;

    --text-primary:    #111827;
    --text-secondary:  #6B7280;
    --text-tertiary:   #9CA3AF;

    --border:          #E5E7EB;
    --border-strong:   #D1D5DB;

    --bg:              #F9FAFB;
    --bg-card:         #FFFFFF;
    --bg-sidebar:      #111827;
    --bg-sidebar-item: rgba(255,255,255,.06);
    --bg-sidebar-active: rgba(255,255,255,.12);

    --sidebar-text:    #E5E7EB;
    --sidebar-icon:    #9CA3AF;
    --sidebar-active:  #FFFFFF;

    /* Layout */
    --sidebar-width:   232px;
    --topbar-height:   56px;
    --radius:          8px;
    --radius-sm:       5px;
    --radius-lg:       12px;

    /* Shadows */
    --shadow-sm:       0 1px 2px rgba(0,0,0,.05);
    --shadow-md:       0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
    --shadow-lg:       0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);

    /* Typography */
    --font:            'Inter', system-ui, -apple-system, sans-serif;
    --font-mono:       'JetBrains Mono', 'Fira Code', monospace;
    --text-xs:         .75rem;
    --text-sm:         .8125rem;
    --text-base:       .9375rem;
    --text-lg:         1.0625rem;
    --text-xl:         1.25rem;
    --text-2xl:        1.5rem;
    --text-3xl:        1.875rem;

    /* Transitions */
    --transition:      150ms ease;
}

/* ── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    font-size: var(--text-base);
    color: var(--text-primary);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; }
ul { list-style: none; }
button { cursor: pointer; font: inherit; border: none; background: none; }

/* ── Layout ─────────────────────────────────────────────────────────── */
.layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: 100vh;
    overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: none;
    padding: 0 12px;
    position: relative;
    z-index: 10;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 8px 12px;
    flex-shrink: 0;
}
.sidebar__brand {
    font-size: var(--text-sm);
    font-weight: 600;
    color: #fff;
    letter-spacing: -.01em;
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    padding-top: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--sidebar-text);
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
}
.nav-item svg { color: var(--sidebar-icon); flex-shrink: 0; transition: color var(--transition); }
.nav-item:hover { background: var(--bg-sidebar-item); color: #fff; text-decoration: none; }
.nav-item:hover svg { color: #fff; }
.nav-item.is-active { background: var(--bg-sidebar-active); color: var(--sidebar-active); }
.nav-item.is-active svg { color: var(--sidebar-active); }

.sidebar__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 8px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
    margin-top: auto;
}
.user-chip { display: flex; align-items: center; gap: 9px; min-width: 0; }
.user-chip__avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: var(--text-xs);
    font-weight: 700;
    flex-shrink: 0;
}
.user-chip__info { display: flex; flex-direction: column; min-width: 0; }
.user-chip__name { font-size: var(--text-sm); font-weight: 500; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip__role { font-size: var(--text-xs); color: var(--sidebar-icon); text-transform: capitalize; }

/* ── Main ─────────────────────────────────────────────────────────── */
.main {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    background: var(--bg);
}

/* ── Topbar ─────────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-height);
    padding: 0 28px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 5;
}
.topbar__title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -.02em;
}
.topbar__actions { display: flex; align-items: center; gap: 8px; }

/* ── Page content ─────────────────────────────────────────────────── */
.page-content { padding: 28px; display: flex; flex-direction: column; gap: 24px; }

/* ── Alert ─────────────────────────────────────────────────────────── */
.alert {
    margin: 12px 28px 0;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: 500;
}
.alert--success { background: var(--success-subtle); color: #15803D; border: 1px solid #BBF7D0; }
.alert--error   { background: var(--danger-subtle);  color: #B91C1C; border: 1px solid #FECACA; }

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.card__title { font-size: var(--text-base); font-weight: 600; letter-spacing: -.01em; }
.card__link { font-size: var(--text-xs); color: var(--accent); }
.card__link:hover { text-decoration: underline; }

/* ── Stat grid ─────────────────────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: var(--shadow-sm);
}
.stat-card--accent  { border-color: #C7D2FE; background: #EEF2FF; }
.stat-card--success { border-color: #BBF7D0; background: var(--success-subtle); }
.stat-card--danger  { border-color: #FECACA; background: var(--danger-subtle); }

.stat-card__label {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .05em;
}
.stat-card__value {
    font-size: var(--text-3xl);
    font-weight: 700;
    letter-spacing: -.04em;
    color: var(--text-primary);
    line-height: 1;
}
.stat-card--accent  .stat-card__value { color: #3730A3; }
.stat-card--success .stat-card__value { color: #15803D; }
.stat-card--danger  .stat-card__value { color: #B91C1C; }

/* ── Dashboard two-column ──────────────────────────────────────────── */
.dashboard-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 960px) { .dashboard-cols { grid-template-columns: 1fr; } }

/* ── Post list ─────────────────────────────────────────────────────── */
.post-list { display: flex; flex-direction: column; }
.post-list__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.post-list__item:last-child { border-bottom: none; }
.post-list__item:hover { background: var(--bg); }
.post-list__platform { font-size: 1.1rem; flex-shrink: 0; }
.post-list__body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.post-list__caption {
    font-size: var(--text-sm);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.post-list__meta { font-size: var(--text-xs); color: var(--text-secondary); }

.empty-state {
    padding: 36px 20px;
    text-align: center;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: var(--text-sm);
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 16px;
    height: 36px;
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: background var(--transition), box-shadow var(--transition), color var(--transition);
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none !important;
}
.btn--primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 2px rgba(94,106,210,.3);
}
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-strong);
}
.btn--ghost:hover { background: var(--bg); color: var(--text-primary); }
.btn--full { width: 100%; }
.btn--sm { height: 30px; padding: 0 12px; font-size: var(--text-xs); }

.btn-icon {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--sidebar-icon);
    transition: background var(--transition), color var(--transition);
}
.btn-icon:hover { background: var(--bg-sidebar-item); color: #fff; }

/* ── Forms ─────────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); }
.form-label-row { display: flex; align-items: center; justify-content: space-between; }
.form-label-link { font-size: var(--text-xs); color: var(--accent); }
.form-label-link:hover { text-decoration: underline; }

.form-input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font: inherit;
    font-size: var(--text-sm);
    color: var(--text-primary);
    background: var(--bg-card);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(94,106,210,.15);
}
.form-input::placeholder { color: var(--text-tertiary); }

.input-wrapper { position: relative; }
.input-wrapper .form-input { padding-right: 40px; }
.input-suffix {
    position: absolute;
    right: 10px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    display: flex; align-items: center;
}
.input-suffix:hover { color: var(--text-secondary); }

/* ── Auth page ─────────────────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 24px;
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 32px 32px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.auth-card__logo { display: flex; justify-content: center; }
.auth-card__title {
    font-size: var(--text-2xl);
    font-weight: 700;
    letter-spacing: -.03em;
    text-align: center;
}
.auth-card__subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-align: center;
    margin-top: -12px;
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .page-content { padding: 16px; }
}

