/* ============================================================
   WebIdeas — Complete Stylesheet
   Warm editorial design · DM Sans + Playfair Display
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
    --bg:           #1a1814;
    --bg-raised:    #222019;
    --bg-card:      #2a2720;
    --bg-input:     #1f1d18;
    --border:       #38352c;
    --border-light: #2e2b24;
    --text:         #e8e2d8;
    --text-muted:   #8a8070;
    --text-dim:     #605850;
    --accent:       #d4622b;
    --accent-hover: #c0561f;
    --accent-dim:   rgba(212,98,43,0.12);
    --sidebar-w:    260px;

    /* Status colors */
    --status-active:   #4caf7d;
    --status-draft:    #8a8070;
    --status-on-hold:  #e8a040;
    --status-archived: #555050;

    /* Unread */
    --unread-color: #f0d060;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--bg-raised);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 18px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}
.logo span { color: var(--accent); }

/* Nav links */
.sidebar-nav {
    padding: 10px 10px 4px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
}
.sidebar-nav-link:hover, .sidebar-nav-link.active {
    background: var(--bg-card);
    color: var(--text);
}

/* Ideas list */
.sidebar-ideas {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.sidebar-group { margin-bottom: 4px; }

.sidebar-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px 3px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-dot-active   { background: var(--status-active); box-shadow: 0 0 5px var(--status-active); }
.status-dot-draft    { background: var(--status-draft); }
.status-dot-on_hold  { background: var(--status-on-hold); }
.status-dot-archived { background: var(--status-archived); }


.group-count {
    font-size: 0.7rem;
    color: var(--text-dim);
    min-width: 18px;
    text-align: right;
}

.unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 5px;
    min-width: 18px;
}

.sidebar-idea-list { list-style: none; }

.sidebar-idea-item { position: relative; }

.sidebar-idea-link {
    display: block;
    padding: 7px 14px;
    border-radius: 0;
    transition: background 0.12s;
}
.sidebar-idea-link:hover { background: var(--bg-card); }
.sidebar-idea-item.active .sidebar-idea-link { background: var(--bg-card); }
.sidebar-idea-item.active .sidebar-idea-link::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}

.idea-title {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s;
}
.idea-meta {
    display: block;
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.meta-user { font-weight: 500; }

/* Unread state — yellow highlight */
.sidebar-idea-item.has-unread .idea-title {
    color: var(--unread-color);
    font-weight: 600;
}
.sidebar-idea-item.has-unread .sidebar-idea-link::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--unread-color);
}

.sidebar-empty {
    padding: 20px 14px;
    font-size: 0.8rem;
    color: var(--text-dim);
    line-height: 1.5;
}
.sidebar-empty a { color: var(--accent); }

/* Sidebar footer */
.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 1;
    min-width: 0;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.15s;
}
.sidebar-user:hover { background: var(--bg-card); }

.user-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.user-info { min-width: 0; }
.user-name {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role {
    display: block;
    font-size: 0.68rem;
    color: var(--text-dim);
    text-transform: capitalize;
}
.sidebar-logout {
    color: var(--text-dim);
    padding: 4px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.sidebar-logout:hover { color: var(--accent); background: var(--accent-dim); }

/* ── Main content ──────────────────────────────────────────── */
.main-content {
    flex: 1;
    min-width: 0;
    padding: 32px 36px;
    max-width: 960px;
}

/* ── Page header ───────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
}
.page-title {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
}
.page-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }

/* ── Stats ─────────────────────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
}
.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Playfair Display', serif;
    line-height: 1;
}
.stat-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Sections ──────────────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.section-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.section-count {
    font-size: 0.75rem;
    color: var(--text-dim);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1px 7px;
}
.dashboard-section { margin-bottom: 32px; }
.idea-section { margin-bottom: 36px; }

/* ── Idea cards (dashboard grid) ───────────────────────────── */
.ideas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}
.idea-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    position: relative;
    transition: border-color 0.2s, transform 0.15s;
    display: block;
}
.idea-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}
.idea-card.has-unread {
    border-color: rgba(240, 208, 96, 0.35);
}
.card-unread-dot {
    position: absolute;
    top: 12px; right: 12px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--unread-color);
}
.idea-card-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    line-height: 1.3;
    color: var(--text);
}
.idea-card.has-unread .idea-card-title { color: var(--unread-color); }
.idea-card-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 12px;
}
.idea-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}
.idea-card-user { font-weight: 500; }
.idea-card-time { color: var(--text-dim); }

/* ── Idea detail header ────────────────────────────────────── */
.idea-header-block {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.idea-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}
.idea-header-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.idea-title-large {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 10px;
}
.idea-description {
    color: var(--text-muted);
    line-height: 1.65;
    font-size: 0.95rem;
}
.idea-created { font-size: 0.8rem; color: var(--text-dim); }
.idea-header-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Status select */
.status-select {
    appearance: none;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    padding: 3px 20px 3px 8px;
    border-radius: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a8070'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
}
.status-select.status-active   { color: var(--status-active);   background-color: rgba(76,175,125,0.12); }
.status-select.status-draft    { color: var(--status-draft);    background-color: rgba(138,128,112,0.12); }
.status-select.status-on_hold  { color: var(--status-on-hold);  background-color: rgba(232,160,64,0.12); }
.status-select.status-archived { color: var(--status-archived); background-color: rgba(85,80,80,0.12); }
.status-select option { background: var(--bg-card); color: var(--text); }

/* ── Link cards ────────────────────────────────────────────── */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.link-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, transform 0.15s;
    position: relative;
}
.link-card:hover { border-color: var(--accent); transform: translateY(-1px); }

.link-card-thumb {
    height: 110px;
    position: relative;
    overflow: hidden;
    background: var(--bg);
}
.link-thumb-img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.link-thumb-placeholder {
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-raised) 0%, var(--bg-card) 100%);
}
.link-domain-icon {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dim);
    font-family: 'Playfair Display', serif;
}

.thumb-upload-btn {
    position: absolute;
    bottom: 6px; right: 6px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    border-radius: 5px;
    padding: 4px 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    opacity: 0;
    transition: opacity 0.15s;
}
.link-card:hover .thumb-upload-btn { opacity: 1; }

.link-card-body {
    padding: 10px 12px;
    flex: 1;
}
.link-title {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
    margin-bottom: 4px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    transition: color 0.15s;
}
.link-title:hover { color: var(--accent); }
.link-url-display {
    display: block;
    font-size: 0.72rem;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s;
}
.link-url-display:hover { color: var(--accent); }
.link-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

.link-card-actions {
    padding: 6px 8px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
}

/* Add link card */
.link-card-add {
    border-style: dashed;
    min-height: 110px;
    justify-content: center;
    align-items: center;
}
.add-link-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-dim);
    background: none;
    border: none;
    font-size: 0.8rem;
    padding: 16px;
    width: 100%;
    transition: color 0.15s;
}
.add-link-toggle:hover { color: var(--accent); }
.add-link-form { padding: 12px; width: 100%; }
.add-link-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}
.fetch-status { font-size: 0.75rem; color: var(--text-dim); flex: 1; }

/* ── Notes thread ──────────────────────────────────────────── */
.notes-thread {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}
.note-bubble {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.note-bubble.note-own { flex-direction: row-reverse; }

.note-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.note-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    max-width: 75%;
    min-width: 120px;
}
.note-bubble.note-own .note-content {
    background: var(--bg-raised);
    border-color: var(--border-light);
}

.note-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    flex-wrap: wrap;
}
.note-author {
    font-size: 0.78rem;
    font-weight: 600;
}
.note-time {
    font-size: 0.72rem;
    color: var(--text-dim);
}
.note-delete {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
    margin-left: auto;
    transition: color 0.15s;
}
.note-delete:hover { color: #e74c3c; }
.note-text {
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--text);
}

/* Note compose */
.note-compose {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.note-compose-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    margin-top: 2px;
}
.note-compose-field { flex: 1; }
.note-textarea {
    resize: vertical;
    min-height: 64px;
}
.note-compose-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}
.note-hint { font-size: 0.72rem; color: var(--text-dim); }

/* ── Files ─────────────────────────────────────────────────── */
.files-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
}
.file-icon {
    font-size: 0.65rem;
    font-weight: 700;
    width: 38px; height: 38px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.file-info { flex: 1; min-width: 0; }
.file-name {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s;
}
.file-name:hover { color: var(--accent); }
.file-meta { font-size: 0.72rem; color: var(--text-dim); }

.file-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1.5px dashed var(--border);
    border-radius: 10px;
    padding: 24px;
    color: var(--text-dim);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    text-align: center;
    font-size: 0.85rem;
}
.file-drop-zone:hover, .file-drop-zone.dragging {
    border-color: var(--accent);
    color: var(--text-muted);
    background: var(--accent-dim);
}
.file-drop-sub { font-size: 0.75rem; color: var(--text-dim); }
.file-limit-note { font-size: 0.8rem; color: var(--text-dim); padding: 12px 0; }

/* ── Forms & inputs ────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 5px;
}
.form-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 9px 12px;
    color: var(--text);
    font-size: 0.875rem;
    transition: border-color 0.15s;
    outline: none;
}
.form-input:focus { border-color: var(--accent); }
textarea.form-input { resize: vertical; line-height: 1.5; }
select.form-input { cursor: pointer; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s, transform 0.1s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-dim); }
.btn-danger { background: rgba(231,76,60,0.15); color: #e74c3c; border: 1px solid rgba(231,76,60,0.3); }
.btn-danger:hover { background: rgba(231,76,60,0.25); }
.btn-danger-ghost { background: none; color: var(--text-dim); border: 1px solid var(--border); font-size: 0.85rem; padding: 8px 14px; border-radius: 7px; transition: color 0.15s, border-color 0.15s; }
.btn-danger-ghost:hover { color: #e74c3c; border-color: rgba(231,76,60,0.4); }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 6px;
    border: none;
    background: var(--bg);
    color: var(--text-dim);
    transition: background 0.15s, color 0.15s;
}
.btn-icon:hover { background: var(--bg-raised); }
.btn-icon-danger:hover { color: #e74c3c; background: rgba(231,76,60,0.1); }

/* ── Cards (generic) ───────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}
.card-header {
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--border);
}
.card-title { font-size: 1rem; font-weight: 600; }
.card-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; }
.card-body { padding: 20px; }

/* ── Profile page ──────────────────────────────────────────── */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.profile-grid .card:first-child { grid-column: 1 / -1; }

.color-preview-large {
    width: 72px; height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    transition: background 0.2s;
}
.avatar-preview {
    color: #fff;
    font-size: 1.8rem;
    font-weight: 700;
}

.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.color-swatch {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--accent);
    transform: scale(1.1);
}

.custom-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.color-input-native {
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
    background: var(--bg-card);
}
.color-hex-display {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.profile-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
}
.profile-info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); }
.info-value { font-weight: 500; }

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 20px;
    border: 1px solid;
}
.alert-success { background: rgba(76,175,125,0.12); border-color: rgba(76,175,125,0.3); color: #4caf7d; }
.alert-error   { background: rgba(231,76,60,0.12);  border-color: rgba(231,76,60,0.3);  color: #e74c3c; }
.alert-info    { background: rgba(52,152,219,0.12); border-color: rgba(52,152,219,0.3); color: #3498db; }

/* ── Badge (status) ────────────────────────────────────────── */
.badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* ── Empty states ──────────────────────────────────────────── */
.empty-state { color: var(--text-dim); font-size: 0.85rem; padding: 16px 0; }
.empty-dashboard {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-dashboard h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin-bottom: 8px;
}
.empty-dashboard p { margin-bottom: 20px; }

/* ── Login page ────────────────────────────────────────────── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    padding: 20px;
}
.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 36px 40px;
    width: 100%;
    max-width: 380px;
}
.login-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
}
.login-sub { text-align: center; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 28px; }


::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Mobile hamburger button ───────────────────────────────── */
.mobile-header {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 200;
}
.hamburger {
    background: none;
    border: none;
    color: var(--text);
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.15s;
    cursor: pointer;
}
.hamburger:hover { background: var(--bg-card); }
.mobile-logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    flex: 1;
}
.mobile-logo span { color: var(--accent); }
.mobile-new-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    font-size: 1.2rem;
    line-height: 1;
    text-decoration: none;
    flex-shrink: 0;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 299;
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
}
.sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ── Responsive: tablet & mobile ──────────────────────────── */
@media (max-width: 768px) {

    /* Show mobile header */
    .mobile-header { display: flex; }

    /* Sidebar becomes a fixed slide-in drawer */
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100dvh;
        z-index: 300;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
        width: 280px;
        min-width: 280px;
        box-shadow: 4px 0 24px rgba(0,0,0,0.4);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay { display: block; }

    /* Push content down below mobile header */
    .main-content {
        padding: 68px 16px 32px;
        width: 100%;
        max-width: 100%;
    }

    /* Login */
    .login-page { padding: 20px; align-items: center; padding-top: 10vh; }
    .login-box { padding: 28px 22px; }
    .login-title { font-size: 1.5rem; }

    /* Page header stacks on mobile */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 18px;
    }
    .page-title { font-size: 1.5rem; }

    /* Stats */
    .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }

    /* Ideas grid */
    .ideas-grid { grid-template-columns: 1fr; gap: 10px; }

    /* Links grid — horizontal card layout on mobile */
    .links-grid { grid-template-columns: 1fr; gap: 10px; }
    .link-card { flex-direction: row; }
    .link-card-thumb { width: 90px; min-width: 90px; height: auto; min-height: 80px; flex-shrink: 0; border-radius: 0; }
    .link-card-add { flex-direction: column; min-height: 80px; }

    /* Idea detail header */
    .idea-header-top { flex-direction: column; gap: 14px; }
    .idea-title-large { font-size: 1.4rem; }
    .idea-header-actions { flex-wrap: wrap; }

    /* Notes */
    .note-content { max-width: 85%; }
    .note-compose { gap: 8px; }

    /* Profile grid */
    .profile-grid { grid-template-columns: 1fr; }
    .profile-grid .card:first-child { grid-column: 1; }

    /* Section */
    .section-header { margin-bottom: 10px; }

    /* Dashboard section */
    .dashboard-section { margin-bottom: 24px; }
}

@media (max-width: 420px) {
    .stats-row { grid-template-columns: 1fr; }
    .main-content { padding: 64px 12px 24px; }
    .link-card { flex-direction: column; }
    .link-card-thumb { width: 100%; height: 120px; min-height: 120px; border-radius: 0; }
    .idea-title-large { font-size: 1.25rem; }
    .color-swatches { gap: 6px; }
    .color-swatch { width: 26px; height: 26px; }
}

/* ── Sidebar mode toggle ───────────────────────────────────── */
.sidebar-mode-toggle {
    display: flex;
    gap: 4px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.mode-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    justify-content: center;
    padding: 5px 8px;
    border-radius: 5px;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-dim);
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}
.mode-btn:hover { color: var(--text-muted); background: var(--bg-card); }
.mode-btn.active { background: var(--bg-card); color: var(--text); }

/* Category dot in sidebar */
.cat-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Sub-status grouping inside category */
.sidebar-substatus { margin-bottom: 2px; }
.substatus-label {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 14px 1px 22px;
    font-size: 0.67rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-dim);
}

/* ── Form card (new/edit idea) ─────────────────────────────── */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    max-width: 680px;
}
.form-input-lg {
    font-size: 1.05rem;
    padding: 11px 14px;
}
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* Category field combo */
.category-field {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.btn-cancel-new {
    position: absolute;
    right: 8px;
    bottom: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    display: none;
}
.btn-cancel-new:hover { color: var(--accent); }

/* Category badge on idea header */
.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 9px 2px 6px;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
}
.category-badge-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .form-row-2 { grid-template-columns: 1fr; }
    .form-card { padding: 20px 16px; }
}

/* ── Category vs status hierarchy ─────────────────────────── */
.group-label { flex: 1; }

/* Category headers — prominent */
.sidebar-group-header .group-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.01em;
    text-transform: none;
}

/* Status sub-labels inside category — clearly secondary */
.substatus-label {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 14px 2px 26px;
    font-size: 0.67rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
}

/* Indent idea items under sub-status */
.sidebar-substatus .sidebar-idea-link {
    padding-left: 28px;
}
