/* ═══════════════════════════════════════════
   CodeVault Design System v2
   ═══════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────── */
:root {
    /* Backgrounds */
    --bg-primary:   #0b0d14;
    --bg-secondary: #111420;
    --bg-tertiary:  #161926;
    --bg-navbar:    #0f1117;

    /* Borders */
    --border:       #1e2330;
    --border-hover: #2a3045;

    /* Text */
    --text-primary:   #e2e4ea;
    --text-secondary: #8b8fa3;
    --text-muted:     #4a4f63;
    --text-hint:      #3a3f52;
    --text-darkest:   #2a3045;

    /* Links (muted slate-blue) */
    --link:       #6b8fc4;
    --link-hover: #8baad8;

    /* Buttons */
    --btn-primary-bg:   #e2e4ea;
    --btn-primary-text: #0f1117;
    --btn-secondary-text: #6b7080;

    /* Status */
    --success:    #34d399;
    --success-bg: #0b2e1a;
    --danger:     #f87171;
    --danger-bg:  #2e0b0b;

    /* Typography */
    --font-ui:   -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-code: 'JetBrains Mono', 'Fira Code', monospace;

    /* Spacing */
    --space-xs:  0.25rem;
    --space-sm:  0.5rem;
    --space-md:  1rem;
    --space-lg:  1.5rem;
    --space-xl:  2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Radii */
    --radius-sm:   4px;
    --radius-md:   6px;   /* buttons, inputs, badges */
    --radius-lg:   8px;   /* cards */
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 100ms ease;
    --transition:      150ms ease;
    --transition-slow: 200ms ease;

    /* Navbar */
    --navbar-h: 48px;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-ui);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

img { max-width: 100%; height: auto; }

code, pre, kbd, samp {
    font-family: var(--font-code);
}

/* ── Headings ───────────────────────────── */
h1, h2, h3, h4 {
    letter-spacing: -0.02em;
}

/* ── Navbar ────────────────────────────── */
.navbar {
    background: var(--bg-navbar);
    border-bottom: 1px solid var(--border);
    height: var(--navbar-h);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}
.navbar-brand:hover {
    color: var(--text-primary);
    text-decoration: none;
}
.navbar-brand svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

/* Guest nav links (Explore, Docs) shown left-side after brand */
.navbar-guest-links {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    list-style: none;
}
.navbar-guest-links a {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-md);
    transition: color var(--transition), background var(--transition);
    text-decoration: none;
}
.navbar-guest-links a:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    text-decoration: none;
}

.navbar-spacer { flex: 1; }

/* Auth user: search + avatar */
.navbar-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.3rem 0.6rem;
    cursor: default;
    width: 200px;
    transition: border-color var(--transition);
}
.navbar-search:hover {
    border-color: var(--border-hover);
}
.navbar-search svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.navbar-search-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    flex: 1;
}
.navbar-search-kbd {
    font-size: 0.68rem;
    color: var(--text-hint);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    font-family: var(--font-ui);
}

.navbar-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    flex-shrink: 0;
    transition: border-color var(--transition), color var(--transition);
}
.navbar-avatar:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    text-decoration: none;
}

/* Guest right: Log in + Sign up */
.navbar-auth {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.navbar-auth .btn-login {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-md);
    transition: color var(--transition), background var(--transition);
}
.navbar-auth .btn-login:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    text-decoration: none;
}

/* Mobile hamburger button */
.navbar-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-md);
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
}
.navbar-hamburger:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.navbar-hamburger-lines {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 18px;
}
.navbar-hamburger-lines span {
    display: block;
    height: 1.5px;
    background: currentColor;
    border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
}
/* Hamburger open state */
.navbar-hamburger.open .navbar-hamburger-lines span:nth-child(1) {
    transform: translateY(5.5px) rotate(45deg);
}
.navbar-hamburger.open .navbar-hamburger-lines span:nth-child(2) {
    opacity: 0;
}
.navbar-hamburger.open .navbar-hamburger-lines span:nth-child(3) {
    transform: translateY(-5.5px) rotate(-45deg);
}

/* Legacy toggle — hidden by default */
.navbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.3rem;
}

/* ── App Layout (sidebar + main) ────────── */
.app-layout {
    display: flex;
    flex: 1;
    min-height: calc(100vh - var(--navbar-h));
}

.app-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #10131b 0%, #0c0e16 100%);
    border-right: 1px solid var(--border);
    position: sticky;
    top: var(--navbar-h);
    height: calc(100vh - var(--navbar-h));
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 98;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active {
    display: block;
}

/* Page fade-in */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.app-main {
    flex: 1;
    min-width: 0;
    padding: 24px 32px;
    animation: fadeIn 200ms ease;
}

/* Public pages wrap in <main> */
main {
    flex: 1;
    padding: var(--space-xl) 0;
    animation: fadeIn 200ms ease;
    position: relative;
    z-index: 1;
}

/* ── Sidebar Internals ──────────────────── */
.sidebar-new-btn {
    padding: 0.75rem 0.875rem 0.625rem;
    flex-shrink: 0;
}
.sidebar-new-btn a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.45rem 0.75rem;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: opacity var(--transition);
}
.sidebar-new-btn a:hover {
    opacity: 0.88;
    text-decoration: none;
    color: var(--btn-primary-text);
}

.sidebar-nav {
    padding: 0.25rem 0.5rem;
    flex-shrink: 0;
}
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.42rem 0.625rem;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 500;
    color: #555a6e;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}
.sidebar-nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    text-decoration: none;
}
.sidebar-nav-item.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-left: 2px solid var(--text-primary);
    padding-left: calc(0.625rem - 2px);
}
.sidebar-nav-item svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    opacity: 0.7;
}
.sidebar-nav-item.active svg {
    opacity: 1;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0.875rem;
    flex-shrink: 0;
}

.sidebar-section {
    padding: 0.25rem 0.5rem;
    flex-shrink: 0;
}
.sidebar-section-title {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-hint);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.25rem 0.625rem 0.375rem;
}
.sidebar-section-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0.625rem;
    border-radius: var(--radius-md);
    font-size: 0.775rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-section-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    text-decoration: none;
}
.sidebar-section-item-count {
    font-size: 0.7rem;
    color: var(--text-hint);
    flex-shrink: 0;
}

.sidebar-bottom {
    margin-top: auto;
    padding: 0.5rem 0.5rem 0.75rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-bottom-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.38rem 0.625rem;
    border-radius: var(--radius-md);
    font-size: 0.78rem;
    color: #555a6e;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}
.sidebar-bottom-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    text-decoration: none;
}
.sidebar-bottom-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.7;
}

/* ── Layout Utilities ───────────────────── */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}
.container-narrow {
    max-width: 560px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* ── Buttons ───────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.45rem 1rem;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition), filter var(--transition), opacity var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover {
    text-decoration: none;
    filter: brightness(0.92);
}
.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border-color: var(--btn-primary-bg);
}
.btn-primary:hover {
    opacity: 1;
    filter: brightness(0.88);
    color: var(--btn-primary-text);
}

.btn-secondary {
    background: transparent;
    color: var(--btn-secondary-text);
    border-color: #2a3045;
}
.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: #3a4055;
    color: #e2e4ea;
    filter: none;
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.3);
}
.btn-danger:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
    filter: none;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: var(--space-xs) var(--space-sm);
}
.btn-ghost:hover {
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    filter: none;
}

.btn-sm {
    padding: 0.28rem 0.65rem;
    font-size: 0.75rem;
}
.btn-lg {
    padding: 11px 28px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
}
.btn-block {
    display: flex;
    width: 100%;
}

/* ── Forms ─────────────────────────────── */
.form-group {
    margin-bottom: var(--space-lg);
}
.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    letter-spacing: 0.01em;
}
.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-ui);
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--border-hover);
    box-shadow: 0 0 0 2px rgba(226,228,234,0.06);
}
.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-hint);
}
.form-textarea {
    resize: vertical;
    min-height: 100px;
}
.form-code-textarea {
    font-family: var(--font-code);
    font-size: 0.83rem;
    line-height: 1.55;
    min-height: 280px;
    tab-size: 4;
}
.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234a4f63' d='M6 8.825L1.175 4 2.238 2.938 6 6.7 9.762 2.938 10.825 4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}
.form-error {
    color: var(--danger);
    font-size: 0.775rem;
    margin-top: var(--space-xs);
}
.form-hint {
    color: var(--text-muted);
    font-size: 0.775rem;
    margin-top: var(--space-xs);
}
.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}
.form-checkbox input[type="checkbox"] {
    accent-color: var(--text-secondary);
    width: 15px;
    height: 15px;
}

/* ── Cards ─────────────────────────────── */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.02);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover {
    border-color: var(--border-hover);
    box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.02), 0 0 0 1px rgba(255,255,255,0.03);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}
.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}
.card-title a {
    color: var(--text-primary);
    text-decoration: none;
}
.card-title a:hover {
    color: var(--link-hover);
    text-decoration: none;
}
.card-meta {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-md);
}
.card-actions {
    display: flex;
    gap: var(--space-xs);
}

/* Snippet card grid */
.snippet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-md);
}

/* Home page — recently shared 3-col grid */
.home-recent-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.home-snippet-card {
    background: rgba(17,20,32,0.7);
    border: 1px solid #1e2330;
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    transition: border-color var(--transition);
    min-width: 0;
    overflow: hidden;
}
.home-snippet-card:hover {
    border-color: #2a3045;
}
.home-snippet-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-sm);
}
.home-snippet-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #e2e4ea;
    text-decoration: none;
    line-height: 1.4;
}
.home-snippet-title:hover {
    color: var(--link-hover);
    text-decoration: none;
}
.home-snippet-star {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.home-snippet-preview {
    background: #0b0d14;
    border: 1px solid #1a1d2a;
    border-radius: 6px;
    padding: 8px 10px;
    font-family: var(--font-code);
    font-size: 0.72rem;
    color: #4a4f63;
    max-height: 52px;
    max-width: 100%;
    overflow: hidden;
    white-space: pre;
    text-overflow: ellipsis;
    line-height: 1.55;
    text-align: left;
}
.home-snippet-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}
.home-snippet-author {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
}
.home-snippet-author:hover {
    color: var(--text-secondary);
    text-decoration: none;
}

/* ── Badges ────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.45rem;
    font-size: 0.7rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    white-space: nowrap;
}
.badge-language {
    background: #1a1d2a;
    color: #6b7080;
    font-family: var(--font-code);
}
.badge-tag {
    background: #1a1d2a;
    color: var(--text-muted);
}
.badge-public {
    background: rgba(52, 211, 153, 0.1);
    color: #34d399;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    border: none;
    font-weight: 500;
}
.badge-private {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

/* ── Code Blocks ────────────────────────── */
.code-block {
    position: relative;
    background: var(--bg-primary);
    border: 1px solid #1a1d2a;
    border-radius: 6px;
    overflow: hidden;
}
.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.875rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}
.code-block pre {
    margin: 0;
    padding: var(--space-md);
    overflow-x: auto;
    font-size: 0.83rem;
    line-height: 1.6;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.code-block pre::-webkit-scrollbar {
    height: 4px;
}
.code-block pre::-webkit-scrollbar-track {
    background: transparent;
}
.code-block pre::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}
.code-block code {
    font-family: var(--font-code);
}
.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 0.2rem 0.55rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-ui);
}
.copy-btn:hover {
    color: var(--text-secondary);
    background: #1e2330;
    border-color: var(--border-hover);
}
.copy-btn.copied {
    color: var(--success);
    border-color: rgba(52, 211, 153, 0.4);
}

/* ── Stars ─────────────────────────────── */
@keyframes starPulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}
.star-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 0.28rem 0.65rem;
    font-size: 0.78rem;
    color: var(--text-hint);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
}
.star-btn:hover {
    color: var(--text-muted);
    border-color: var(--border-hover);
}
.star-btn.starred {
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}
.star-btn.pulse {
    animation: starPulse 200ms ease;
}

/* ── Stats Bar ─────────────────────────── */
.stats-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
}
.stat-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    flex: 1;
    min-width: 120px;
    transition: border-color var(--transition);
    border-left: none;
}
.stat-item:hover {
    border-color: var(--border-hover);
}
.stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Search Bar ────────────────────────── */
.search-bar {
    position: relative;
    margin-bottom: var(--space-xl);
}
.search-bar input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    font-family: var(--font-ui);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.search-bar input:focus {
    border-color: var(--border-hover);
    box-shadow: 0 0 0 3px rgba(42, 48, 69, 0.4);
}
.search-bar input::placeholder { color: var(--text-hint); }
.search-bar svg {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

/* ── Empty State ───────────────────────── */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
}
.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--text-hint);
    margin-bottom: var(--space-lg);
}
.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}
.empty-state p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: var(--space-xl);
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Alerts ─────────────────────────────── */
.alert {
    padding: 0.75rem var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.84rem;
    margin-bottom: var(--space-lg);
    border: 1px solid;
    animation: fadeIn 200ms ease;
}
.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.25);
}
.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(52, 211, 153, 0.25);
}

/* ── Auth Pages ─────────────────────────── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--navbar-h));
    padding: var(--space-xl) var(--space-lg);
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: #111420;
    border: 1px solid #1e2330;
    border-radius: 8px;
    padding: 32px;
}
.auth-card h1 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}
.auth-card .auth-subtitle {
    color: var(--text-muted);
    font-size: 0.84rem;
    margin-bottom: var(--space-xl);
}
.auth-footer {
    text-align: center;
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
    font-size: 0.84rem;
    color: var(--text-muted);
}

/* ── Landing / Hero ─────────────────────── */
.hero {
    text-align: center;
    padding: 100px 0 48px;
}
.hero h1,
.hero h1 * {
    font-size: clamp(2.2rem, 5vw, 3rem);
    font-weight: 700;
    letter-spacing: -1.5px;
    line-height: 1.15;
    margin-bottom: var(--space-md);
    color: #e2e4ea;
}
.hero p {
    font-size: 15px;
    color: #8b8fa3;
    max-width: 500px;
    margin: 0 auto var(--space-xl);
    line-height: 1.7;
}
.hero-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}

/* Faint radial glow behind hero text */
.hero-glow {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 700px;
    height: 500px;
    background: radial-gradient(ellipse at center, rgba(88,100,180,0.06) 0%, transparent 60%);
    pointer-events: none;
}

/* Hero pill badge */
.hero-pill {
    display: inline-block;
    background: rgba(17,20,32,0.8);
    backdrop-filter: blur(8px);
    border: 1px solid #1e2330;
    border-radius: 20px;
    padding: 5px 16px;
    font-size: 11px;
    color: #555a6e;
    letter-spacing: 0.01em;
    transition: border-color 150ms ease;
    margin-bottom: 1.5rem;
    cursor: default;
}
.hero-pill:hover {
    border-color: #2a3045;
}

/* Feature icon container */
.feature-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #161926;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Feature cards */
.features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    padding: 0 0 var(--space-2xl);
}
.feature-card {
    padding: 24px;
    background: rgba(17,20,32,0.7);
    backdrop-filter: blur(8px);
    border: 1px solid #1e2330;
    border-radius: 10px;
    transition: border-color 150ms ease;
}
.feature-card:hover {
    border-color: #2a3045;
}
.feature-icon-wrap svg {
    color: #6b7080;
}
.feature-icon {
    width: 36px;
    height: 36px;
    color: #6b7080;
    margin-bottom: var(--space-md);
}
.feature-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-top: 14px;
    margin-bottom: var(--space-sm);
    color: #e2e4ea;
}
.feature-card p {
    font-size: 13px;
    color: #555a6e;
    line-height: 1.6;
}

/* CTA section */
.cta-section {
    border-top: 1px solid #1a1d2a;
    padding: 64px 0;
    text-align: center;
}
.cta-section h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    letter-spacing: -0.02em;
    color: #e2e4ea;
}
.cta-section p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--space-xl);
}

/* ── Section / Page Headers ─────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
    gap: var(--space-md);
}
.section-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Uppercase section label */
.section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #3a3f52;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}
.page-header h1 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

/* ── Footer ─────────────────────────────── */
.site-footer {
    border-top: 1px solid #1a1d2a;
    padding: 20px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #2a3045;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.site-footer a {
    color: #2a3045;
    text-decoration: none;
    transition: color var(--transition);
}
.site-footer a:hover {
    color: var(--text-muted);
    text-decoration: none;
}
.site-footer-links {
    display: flex;
    gap: 1rem;
}


/* ── Tags Row ───────────────────────────── */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

/* ── Dashboard snippet list — hover-reveal actions ── */
.snippet-row-actions {
    opacity: 0;
    transition: opacity var(--transition);
}
.card:hover .snippet-row-actions {
    opacity: 1;
}

/* ── Utility Classes ────────────────────── */
.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-success   { color: var(--success); }
.text-danger    { color: var(--danger); }
.text-center    { text-align: center; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.flex            { display: flex; }
.flex-wrap       { flex-wrap: wrap; }
.flex-col        { flex-direction: column; }
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-xs  { gap: var(--space-xs); }
.gap-sm  { gap: var(--space-sm); }
.gap-md  { gap: var(--space-md); }
.gap-lg  { gap: var(--space-lg); }
.hidden  { display: none !important; }

/* ── API Docs ───────────────────────────── */
.api-section {
    margin-bottom: var(--space-2xl);
}
.api-endpoint {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.125rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.02);
}
.api-method {
    font-family: var(--font-code);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    letter-spacing: 0.05em;
}
.method-get    { background: rgba(52,211,153,0.12);  color: #34d399; }
.method-post   { background: rgba(96,165,250,0.12);  color: #60a5fa; }
.method-put    { background: rgba(251,191,36,0.12);  color: #fbbf24; }
.method-delete { background: rgba(248,113,113,0.12); color: #f87171; }

.api-path {
    font-family: var(--font-code);
    font-size: 0.84rem;
    color: var(--text-primary);
}
.api-desc {
    margin-left: auto;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.api-detail {
    margin-bottom: var(--space-xl);
}
.api-detail h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    margin-top: var(--space-lg);
}
.api-detail p {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.7;
}

/* ── Responsive ─────────────────────────── */
@media (max-width: 900px) {
    .app-sidebar {
        width: 160px;
    }
    .app-main {
        padding: 20px 20px;
    }
}

@media (max-width: 768px) {
    .navbar-hamburger { display: flex; }

    /* Show search as icon-only on mobile */
    .navbar-search { width: auto; min-width: 0; padding: 0.3rem 0.5rem; }
    .navbar-search-text,
    .navbar-search-kbd { display: none; }

    /* Sidebar slides in from left via transform */
    .app-sidebar {
        position: fixed;
        left: 0;
        top: var(--navbar-h);
        bottom: 0;
        height: calc(100vh - var(--navbar-h));
        transform: translateX(-100%);
        transition: transform 200ms ease;
        z-index: 99;
        width: 200px;
    }
    .app-sidebar.open {
        transform: translateX(0);
    }

    .app-main { padding: 16px; }
    .snippet-grid { grid-template-columns: 1fr; }
    .stats-bar { flex-wrap: wrap; }
    .stat-item { min-width: 100%; }
    .hero h1 { font-size: 1.9rem; }
    .auth-card { padding: var(--space-lg); }
    .page-header { flex-direction: column; align-items: flex-start; }
    .site-footer { flex-direction: column; text-align: center; padding: 20px; }
    .snippet-preview { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .code-block { overflow-x: auto; }
    .features { grid-template-columns: repeat(2, 1fr); }
    .home-recent-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .container,
    .container-narrow {
        padding: 0 var(--space-md);
    }
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }
    .features {
        grid-template-columns: 1fr;
    }
    .home-recent-grid { grid-template-columns: 1fr; }
}

/* ── 3D Wave Background ─────────────────────────────────── */
#wave-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.landing-content {
    position: relative;
    z-index: 1;
}

/* === DASHBOARD CARD IMPROVEMENTS === */
.snippet-card {
    border-left: 3px solid var(--border);
    transition: border-color 0.15s ease, background 0.15s ease;
    padding: 14px 16px;
}
.snippet-card:hover {
    border-left-color: var(--text-secondary);
    background: var(--bg-tertiary);
}
.snippet-card[data-language="javascript"] { border-left-color: #f7df1e; }
.snippet-card[data-language="python"] { border-left-color: #3776ab; }
.snippet-card[data-language="ruby"] { border-left-color: #cc342d; }
.snippet-card[data-language="php"] { border-left-color: #8892be; }
.snippet-card[data-language="typescript"] { border-left-color: #3178c6; }
.snippet-card[data-language="go"] { border-left-color: #00add8; }
.snippet-card[data-language="rust"] { border-left-color: #f74c00; }
.snippet-card[data-language="css"] { border-left-color: #264de4; }
.snippet-card[data-language="html"] { border-left-color: #e34c26; }
.snippet-card[data-language="bash"] { border-left-color: #34d399; }
.snippet-card[data-language="sql"] { border-left-color: #e38c00; }
.snippet-card[data-language="java"] { border-left-color: #b07219; }
.snippet-card[data-language="c"] { border-left-color: #555555; }
.snippet-card[data-language="cpp"] { border-left-color: #f34b7d; }

.snippet-description {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin: 4px 0 8px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 600px;
}

.snippet-preview {
    background: #0d0f18;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #8b9eb0;
    text-align: left;
    max-height: 3rem;
    overflow: hidden;
    margin-top: 8px;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.snippet-row-actions a,
.snippet-row-actions button {
    font-size: 0.73rem;
    color: var(--text-hint);
    transition: color 0.15s ease;
}
.snippet-row-actions a:hover { color: var(--text-primary); }
.snippet-row-actions button:hover { color: #f87171 !important; }

/* === SNIPPET VIEW === */
.snippet-view-header[data-language="javascript"] { border-left: 3px solid #f7df1e; padding-left: 14px; }
.snippet-view-header[data-language="python"] { border-left: 3px solid #3776ab; padding-left: 14px; }
.snippet-view-header[data-language="ruby"] { border-left: 3px solid #cc342d; padding-left: 14px; }
.snippet-view-header[data-language="php"] { border-left: 3px solid #8892be; padding-left: 14px; }
.snippet-view-header[data-language="typescript"] { border-left: 3px solid #3178c6; padding-left: 14px; }
.snippet-view-header[data-language="go"] { border-left: 3px solid #00add8; padding-left: 14px; }
.snippet-view-header[data-language="rust"] { border-left: 3px solid #f74c00; padding-left: 14px; }
.snippet-view-header[data-language="css"] { border-left: 3px solid #264de4; padding-left: 14px; }
.snippet-view-header[data-language="html"] { border-left: 3px solid #e34c26; padding-left: 14px; }
.snippet-view-header[data-language="bash"] { border-left: 3px solid #34d399; padding-left: 14px; }
.snippet-view-header[data-language="sql"] { border-left: 3px solid #e38c00; padding-left: 14px; }
.snippet-view-header[data-language="java"] { border-left: 3px solid #b07219; padding-left: 14px; }
.snippet-view-header[data-language="c"] { border-left: 3px solid #555555; padding-left: 14px; }
.snippet-view-header[data-language="cpp"] { border-left: 3px solid #f34b7d; padding-left: 14px; }
