/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    /* Sidebar */
    --sidebar-bg:           #000000;
    --sidebar-hover:        rgba(255,255,255,0.09);
    --sidebar-active:       rgba(255,255,255,0.16);
    --sidebar-text:         #b0bac8;
    --sidebar-text-muted:   #6b7280;
    --sidebar-text-active:  #ffffff;
    --sidebar-section-label:#4a5260;
    --sidebar-border:       rgba(255,255,255,0.08);

    --bg-canvas:    #f4f7fe;
    --bg-card:      #ffffff;
    --bg-card-hover:#f8faff;
    --bg-topbar:    #ffffff;
    --bg-input:     #f4f7fe;

    --text-main:    #1a202c;
    --text-muted:   #718096;

    --border:       #e8ecf4;
    --border-input: #dde3ee;
    --border-focus: #2d3748;

    --accent:          #000000;
    --accent-hover:    #1a1a1a;
    --accent-btn-text: #ffffff;
    --accent-glow:     rgba(45,55,72,0.12);

    --red: #e53e3e;

    --tag-bg:     #edf2f7;
    --tag-text:   #4a5568;
    --tag-border: #e2e8f0;

    --code-bg:     #3b3b3f;
    --code-border: #55555a;
    --code-text:   #d0d0d0;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 20px 40px rgba(0,0,0,0.12);

    --stat-blue:    #4299e1;
    --stat-blue-bg: rgba(66,153,225,0.1);
    --stat-dark:    #2d3748;
    --stat-dark-bg: rgba(45,55,72,0.08);
    --stat-red:     #e53e3e;
    --stat-red-bg:  rgba(229,62,62,0.08);
}


/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background-color: var(--bg-canvas);
    color: var(--text-main);
    cursor: default;
}

/* ============================================
   UTILITIES
   ============================================ */
.hidden { display: none !important; }
.mt-1   { margin-top: 1rem; }
.mb-2   { margin-bottom: 2rem; }

/* Prevent accidental text selection and text cursor on UI chrome */
.nav-link,
.sidebar-logout,
.sidebar-toggle-btn,
.topbar-title,
.topbar-user,
.topbar-user-name,
.stat-card,
.stat-label,
.stat-value,
.snippets-section-title,
.nav-section-label,
.login-brand,
.login-brand-name,
.illustration-label,
.illustration-icon,
.snippet-card h3,
.snippet-card .snippet-meta,
.snippet-card .snippet-card-header,
.snippet-desc,
.snippet-creator,
.tag-group-count,
.detail-creator,
.user-avatar,
.brand,
.sub-view h2,
.tag-create-card h3,
.empty-state,
.modal-header h3 {
    user-select: none;
    cursor: default;
}

.badge {
    user-select: none;
}

/* ============================================
   VIEWS
   ============================================ */
#app {
    width: 100vw;
    height: 100vh;
    display: flex;
}

.view {
    width: 100%;
    height: 100%;
    display: flex;
}

/* ============================================
   LOGIN - SPLIT PANEL
   ============================================ */
#login-view {
    flex-direction: row;
    align-items: stretch;
}

.login-split {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Left dark panel */
.login-left {
    width: 44%;
    background-color: #000000;
    display: flex;
    flex-direction: column;
    padding: 2rem 2.5rem;
    position: relative;
    overflow: hidden;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    z-index: 2;
}

.login-brand-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.login-brand-icon svg {
    width: 32px;
    height: 32px;
}

.login-brand-name {
    font-weight: 700;
    font-size: 4.5rem;
    width: 380px;
    color: #e2e8f0;
    text-align: center;
    user-select: none;
    line-height: 1;
}

.login-illustration {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    z-index: 2;
}

.login-logo-large {
    width: 380px;
    height: 380px;
    opacity: 0.85;
}

.login-left::before {
    content: '';
    position: absolute;
    width: 320px;
    height: 320px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
    top: -100px;
    right: -100px;
}

.login-left::after {
    content: '';
    position: absolute;
    width: 220px;
    height: 220px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
    bottom: -70px;
    left: -50px;
}

/* Right form panel */
.login-right {
    flex: 1;
    background-color: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-form-container {
    width: 100%;
    max-width: 380px;
}

.login-form-container h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    text-align: center;
}

.login-form-container .login-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 2rem;
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
#dashboard-view {
    flex-direction: row;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: 240px;
    min-width: 240px;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0;
    transition: width 0.2s ease, min-width 0.2s ease;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0 0.75rem 1.5rem;
    border-bottom: 1px solid var(--sidebar-border);
    margin-bottom: 1rem;
    white-space: nowrap;
}

.sidebar-brand-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand-icon svg {
    width: 40px;
    height: 40px;
}

.brand {
    font-weight: 700;
    font-size: 1.6rem;
    font-family: inherit;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    flex: 1;
    user-select: none;
}

.brand-accent {
    font-size: inherit;
    font-weight: inherit;
    font-family: inherit;
    color: #6b7280;
}

.sidebar-toggle-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s, color 0.15s;
    padding: 0;
}

.sidebar-toggle-btn:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
}

.sidebar-toggle-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
}

/* Nav sections */
.sidebar-nav {
    flex: 1;
    overflow: hidden;
    padding: 0 0.75rem;
}

.nav-section {
    margin-bottom: 1.25rem;
}

.nav-section-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--sidebar-section-label);
    padding: 0 0.5rem;
    margin-bottom: 0.4rem;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.nav-link {
    text-decoration: none;
    color: var(--sidebar-text);
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: background-color 0.15s, color 0.15s;
    cursor: pointer;
    white-space: nowrap;
}

.nav-icon {
    width: 16px;
    height: 16px;
    min-width: 16px;
    flex-shrink: 0;
    stroke: currentColor;
}

.nav-text {
    overflow: hidden;
}

.nav-link:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
}

.nav-link.active {
    background-color: var(--sidebar-active);
    color: var(--sidebar-text-active);
    font-weight: 600;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--sidebar-border);
    margin-top: auto;
}

.sidebar-logout {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    white-space: nowrap;
    font-family: inherit;
}

.sidebar-logout:hover {
    background-color: rgba(229,62,62,0.15);
    color: #fc8181;
}

/* ---- Collapsed sidebar ---- */
.sidebar-collapsed .sidebar {
    width: 64px;
    min-width: 64px;
}

.sidebar-collapsed .brand,
.sidebar-collapsed .nav-section-label,
.sidebar-collapsed .nav-text,
.sidebar-collapsed .sidebar-brand-icon {
    display: none;
}

.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 0 0.75rem 1.5rem;
}

.sidebar-collapsed .nav-link,
.sidebar-collapsed .sidebar-logout {
    justify-content: center;
    padding: 0.65rem;
}

.sidebar-collapsed .folders-submenu,
.sidebar-collapsed .nav-expand-btn {
    display: none;
}

.sidebar-collapsed .nav-link.active {
    background-color: var(--sidebar-active);
    border-radius: 10px;
    outline: none;
    box-shadow: none;
}

.sidebar-collapsed .nav-link-row {
    justify-content: center;
}

.sidebar-collapsed .nav-link-row .nav-link {
    flex: none;
    padding-right: 0.65rem;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-canvas);
    min-width: 0;
    overflow: hidden;
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
    height: 64px;
    min-height: 64px;
    background-color: var(--bg-topbar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    box-shadow: var(--shadow-sm);
    gap: 1rem;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Search */
.search-container {
    position: relative;
    width: 300px;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    width: 15px;
    height: 15px;
    stroke: currentColor;
}

.search-container input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    border-radius: 8px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-input);
    color: var(--text-main);
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: text;
}

.search-container input::placeholder {
    color: var(--text-muted);
}

.search-container input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background-color: var(--bg-card);
}

/* Icon button */
.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}

.btn-icon:hover {
    background-color: var(--bg-canvas);
    color: var(--text-main);
    border-color: var(--border-focus);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
}

/* Topbar user */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.6rem 0.3rem 0.3rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    cursor: default;
}

.topbar-user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
}

/* ============================================
   CONTENT AREA
   ============================================ */
.content-area {
    padding: 1.75rem 2rem;
    overflow-y: auto;
    flex: 1;
}

.sub-view h2 {
    margin-bottom: 1.5rem;
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--text-main);
}

/* ============================================
   STAT CARDS
   ============================================ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    border-top-width: 1px;
    position: relative;
    overflow: hidden;
}


.stat-body {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

.stat-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-box svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.stat-icon-box--blue {
    background-color: var(--stat-blue-bg);
    color: var(--stat-blue);
}

.stat-icon-box--dark {
    background-color: var(--stat-dark-bg);
    color: var(--stat-dark);
}


.stat-icon-box--red {
    background-color: var(--stat-red-bg);
    color: var(--stat-red);
}

/* ============================================
   SNIPPET GRID & CARDS
   ============================================ */
.snippets-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.snippets-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.snippet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.snippet-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.snippet-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-focus);
}

.snippet-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.snippet-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0;
}

/* ============================================
   BADGES & TAGS
   ============================================ */
.badge {
    background-color: var(--tag-bg);
    color: var(--tag-text);
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--tag-border);
    transition: background-color 0.15s;
}

.badge:hover {
    background-color: var(--border);
}

/* ============================================
   BUTTONS
   ============================================ */
button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--accent);
    color: var(--accent-btn-text);
    padding: 0.55rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

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

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-main);
    padding: 0.55rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-weight: 500;
    font-size: 0.875rem;
}

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

.btn-text {
    background: none;
    color: var(--text-muted);
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    font-size: 0.85rem;
}

.btn-text:hover {
    color: var(--text-main);
    background-color: var(--bg-canvas);
}

.btn-close {
    background: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
}

.btn-close:hover {
    color: var(--text-main);
    background-color: var(--bg-canvas);
}

.btn-ghost-danger {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
}

.btn-ghost-danger:hover {
    border-color: var(--red);
    color: var(--red);
    background-color: rgba(229,62,62,0.08);
}

.btn-primary-full {
    width: 100%;
    padding: 0.7rem 1rem;
    background-color: #1e2235;
    color: #ffffff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-bottom: 1rem;
}

.btn-primary-full:hover {
    background-color: #0d1117;
}

/* ============================================
   USER AVATAR
   ============================================ */
.user-avatar {
    width: 30px;
    height: 30px;
    background-color: #2d3748;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: #ffffff;
    flex-shrink: 0;
}

/* ============================================
   CODE BLOCK
   ============================================ */
.code-wrapper {
    position: relative;
    background-color: var(--code-bg);
    border-radius: 8px;
    border: 1px solid var(--code-border);
    overflow: hidden;
}

.code-wrapper pre {
    margin: 0;
    padding: 1rem;
    font-family: "Courier New", Courier, monospace;
    font-size: 0.82rem;
    color: var(--code-text);
    overflow: hidden;
    line-height: 1.6;
    height: calc(5 * 1.6em + 2.25rem);
}

/* Legacy syntax tokens (kept for compatibility) */
.token-keyword  { color: #569cd6; }
.token-string   { color: #ce9178; }
.token-function { color: #dcdcaa; }
.token-comment  { color: #6a9955; font-style: italic; }
.token-operator { color: #d4d4d4; }
.token-number   { color: #b5cea8; }


/* ============================================
   PRISM SYNTAX TOKENS (VS Code Dark+ / Monaco)
   ============================================ */
.token.keyword     { color: #569cd6; }
.token.string      { color: #ce9178; }
.token.function    { color: #dcdcaa; }
.token.comment     { color: #6a9955; font-style: italic; }
.token.operator    { color: #d4d4d4; }
.token.number      { color: #b5cea8; }
.token.class-name  { color: #4ec9b0; }
.token.builtin     { color: #4ec9b0; }
.token.punctuation { color: #d4d4d4; }
.token.property    { color: #9cdcfe; }
.token.attr-name   { color: #9cdcfe; }
.token.attr-value  { color: #ce9178; }
.token.tag         { color: #569cd6; }


/* Copy button */
.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 0.25rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
}

.code-wrapper:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    color: var(--text-main);
    border-color: var(--border-focus);
}

/* ============================================
   INPUTS & FORMS
   ============================================ */
.input-group {
    margin-bottom: 1rem;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
}

.input-group input,
.input-group textarea,
.input-group select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border-input);
    background-color: var(--bg-card);
    color: var(--text-main);
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: text;
}

.input-group select {
    cursor: pointer;
    background-color: var(--bg-card);
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.error-msg {
    color: var(--red);
    font-size: 0.82rem;
    margin-bottom: 0.85rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    background-color: rgba(229,62,62,0.06);
    border: 1px solid rgba(229,62,62,0.15);
    display: block;
}

.error-msg:empty { display: none; }

/* ============================================
   ADMIN TABLE
   ============================================ */
.users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background-color: var(--bg-card);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.users-table th,
.users-table td {
    padding: 0.85rem 1.1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.users-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: var(--bg-canvas);
}

.users-table tbody tr:last-child td {
    border-bottom: none;
}

.users-table tbody tr {
    transition: background-color 0.15s;
}

.users-table tbody tr:hover {
    background-color: var(--bg-card-hover);
}

.admin-panel {
    max-width: 900px;
}

/* ============================================
   DRIVE
   ============================================ */
.drive-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.drive-upload-card {
    background: var(--bg-card);
    border: 2px dashed var(--border-input);
    border-radius: 12px;
    padding: 2rem 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    transition: border-color 0.2s, background 0.2s;
    cursor: default;
}

.drive-upload-card.drag-over {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.drive-upload-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    text-align: center;
}

.drive-upload-icon {
    width: 40px;
    height: 40px;
    stroke: var(--text-muted);
    margin-bottom: 0.25rem;
}

.drive-upload-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
}

.drive-upload-link {
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
    font-weight: 600;
}

.drive-upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.drive-upload-options {
    width: 100%;
    display: flex;
    justify-content: center;
}

.drive-share-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.drive-share-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
    cursor: pointer;
}

.drive-progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.drive-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.3s ease;
    width: 0%;
}

.drive-file-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.drive-file-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.drive-file-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.drive-empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ── Drive breadcrumb ───────────────────────────── */
.drive-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
}

.drive-breadcrumb-root {
    color: var(--text-muted);
    font-weight: 500;
}

.drive-breadcrumb-back,
.drive-breadcrumb-seg {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0;
    font-weight: 500;
    text-decoration: underline;
}

.drive-breadcrumb-sep {
    color: var(--text-muted);
}

.drive-breadcrumb-current {
    color: var(--text-main);
    font-weight: 600;
}

/* ── Drive folder cards ────────────────────────── */
.drive-folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
    padding: 0.75rem;
}

.drive-folder-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 1rem 0.75rem 0.75rem;
    aspect-ratio: 4 / 3;
    border-radius: 10px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    cursor: pointer;
    position: relative;
    transition: border-color 0.15s, background 0.15s;
    text-align: center;
    min-width: 0;
    user-select: none;
    overflow: hidden;
}

.drive-folder-card:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.drive-folder-icon {
    width: 36px;
    height: 36px;
    color: var(--accent);
}

.drive-folder-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
}

.drive-folder-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-main);
    word-break: break-word;
    line-height: 1.3;
    max-width: 100%;
}

.drive-folder-delete {
    position: absolute;
    top: 4px;
    right: 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}

.drive-folder-card:hover .drive-folder-delete {
    opacity: 1;
}

.drive-folder-delete:hover {
    color: var(--red);
}

.btn-action-preview {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #2563eb;
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-action-preview:hover {
    background: #dbeafe;
}

/* ── Preview modal ───────────────────────────── */
.modal-onlyoffice-content {
    width: 96vw;
    max-width: 1600px;
    height: 95vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: 12px;
}

.modal-onlyoffice-content .modal-header {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.onlyoffice-modal-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.onlyoffice-filename {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.onlyoffice-editor-area {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #f7f7f7;
}

.onlyoffice-editor-area > div,
#oo-editor-mount,
#oo-editor-mount iframe {
    width: 100% !important;
    height: 100% !important;
    border: none;
}

.onlyoffice-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

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

.oo-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: oo-spin 0.7s linear infinite;
}

/* ============================================
   ADMIN CENTER
   ============================================ */
.admin-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.admin-center {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.admin-charts-col {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.admin-chart-body {
    position: relative;
    height: 220px;
    padding: 0.75rem;
}

.admin-chart-body canvas {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    width: calc(100% - 1.5rem) !important;
    height: calc(100% - 1.5rem) !important;
}

.admin-big-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

.admin-big-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
}

.admin-stats-row {
    display: flex;
    gap: 1rem;
}

.admin-stat-card {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.1rem 1.4rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.admin-stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    user-select: none;
}

.admin-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
    user-select: none;
}

.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.admin-card-header {
    padding: 1rem 1.4rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-canvas);
}

.admin-card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    user-select: none;
}

.admin-create-form {
    padding: 1.25rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.admin-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.admin-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.admin-toggle-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.admin-toggle-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    user-select: none;
}

.admin-form-error {
    background: rgba(229, 62, 62, 0.08);
    border: 1px solid rgba(229, 62, 62, 0.3);
    color: var(--red);
    border-radius: 6px;
    padding: 0.55rem 0.8rem;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Users table enhancements */
.users-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-card);
}

.id-cell {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.username-cell strong {
    font-weight: 600;
}

.snippets-cell {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.date-cell {
    color: var(--text-muted);
    font-size: 0.82rem;
    white-space: nowrap;
}

.text-muted-cell {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.action-btns {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-action-edit {
    background: var(--bg-canvas);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-action-edit:hover {
    background: var(--border);
    border-color: var(--border-focus);
}

.badge-admin {
    background: var(--accent);
    color: var(--accent-btn-text);
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-user {
    background: var(--bg-canvas);
    color: var(--text-muted);
    border: 1px solid var(--border);
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 500;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1.5rem 1rem;
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    background-color: var(--bg-card);
    width: 520px;
    max-width: 100%;
    border-radius: 14px;
    border: 1px solid var(--border);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    margin: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

/* ============================================
   SNIPPETS EXPAND / FOLDER SUBMENU
   ============================================ */
.nav-item-with-sub {
    display: flex;
    flex-direction: column;
}

.nav-link-row {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-link-row .nav-link {
    flex: 1;
    padding-right: 2rem;
}

.nav-expand-btn {
    position: absolute;
    right: 0.45rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--sidebar-text);
    opacity: 0.55;
    cursor: pointer;
    padding: 0.2rem;
    display: flex;
    align-items: center;
    transition: opacity 0.15s;
    border-radius: 4px;
}

.nav-expand-btn:hover {
    opacity: 1;
}

.nav-link-row:has(.nav-link.active) .nav-expand-btn {
    color: var(--sidebar-text-active);
    opacity: 0.85;
}

.nav-expand-icon {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    transition: transform 0.2s ease;
}

.nav-item-with-sub.open .nav-expand-icon {
    transform: rotate(90deg);
}

.folders-submenu {
    display: none;
    padding-left: 1.25rem;
    margin-top: 0.15rem;
}

.nav-item-with-sub.open .folders-submenu {
    display: block;
}

.folders-submenu-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.nav-link-sub {
    font-size: 0.82rem;
    padding: 0.45rem 0.65rem;
}

.folders-submenu-header {
    display: flex;
    justify-content: flex-end;
    padding: 0.1rem 0.25rem 0.25rem 0;
}

/* ============================================
   FOLDERS VIEW
   ============================================ */
.folders-view-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.25rem;
}

.folders-view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
}

.folder-view-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 1rem 0.75rem 0.75rem;
    aspect-ratio: 4 / 3;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    cursor: pointer;
    position: relative;
    transition: border-color 0.15s, background 0.15s;
    text-align: center;
    min-width: 0;
    user-select: none;
    overflow: hidden;
}

.folder-view-card:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.folder-view-icon {
    width: 36px;
    height: 36px;
    color: var(--accent);
    flex-shrink: 0;
}

.folder-view-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
}

.folder-view-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.folder-view-delete {
    position: absolute;
    top: 4px;
    right: 6px;
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    padding: 0;
    line-height: 1;
    transition: opacity 0.15s, color 0.15s;
}

.folder-view-card:hover .folder-view-delete {
    opacity: 1;
}

.folder-view-delete:hover {
    color: var(--red);
}

/* ============================================
   FOLDER NAV
   ============================================ */
.nav-section-folder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.5rem;
    margin-bottom: 0.4rem;
}

.nav-section-folder-header .nav-section-label {
    padding: 0;
    margin-bottom: 0;
}

.folder-add-btn {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--sidebar-section-label);
    color: var(--sidebar-section-label);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
    transition: border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}

.folder-add-btn:hover {
    border-color: var(--sidebar-text);
    color: var(--sidebar-text);
}

.folder-nav-item {
    display: flex;
    align-items: center;
    border-radius: 7px;
    overflow: hidden;
}

.folder-nav-item .folder-nav-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sidebar-text);
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 7px;
    transition: background-color 0.15s, color 0.15s;
    font-family: inherit;
    min-width: 0;
}

.folder-nav-item .folder-nav-btn:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
}

.folder-nav-item.active .folder-nav-btn {
    background-color: var(--sidebar-active);
    color: #ffffff;
}

.folder-nav-item .folder-nav-btn .nav-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-nav-item .folder-delete-btn {
    width: 22px;
    height: 22px;
    display: none;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--sidebar-text-muted);
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-right: 0.3rem;
    transition: color 0.15s, background-color 0.15s;
}

.folder-nav-item:hover .folder-delete-btn {
    display: flex;
}

.folder-nav-item .folder-delete-btn:hover {
    color: #ef4444;
    background-color: rgba(239,68,68,0.12);
}

/* ============================================
   TOGGLE SWITCH
   ============================================ */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border);
    transition: .2s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px; width: 14px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .2s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2d3748;
}

input:checked + .slider:before {
    transform: translateX(16px);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    margin-top: 5rem;
    color: var(--text-muted);
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.empty-state h3 {
    color: var(--text-main);
    font-weight: 500;
}

/* ============================================
   SNIPPET CARD UPDATES
   ============================================ */
.snippet-card-header {
    min-height: 4.2rem;
    margin-bottom: 0.75rem;
}

.snippet-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.snippet-card-top h3 {
    margin-bottom: 0;
    flex: 1;
}

.lang-badge {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    background-color: var(--bg-canvas);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
    cursor: default;
}

/* ============================================
   COPY ICON BUTTON
   ============================================ */
.copy-btn-icon {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #3b3b3f;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    border-radius: 6px;
    padding: 0.3rem;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s;
}

.copy-btn-icon svg {
    width: 14px;
    height: 14px;
    stroke: #ffffff;
    fill: none;
}

.copy-btn-icon:hover {
    background: #4f4f54;
    border-color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   TAG CREATE CARD (Tags view)
   ============================================ */
.tag-create-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.tag-create-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 1rem;
}

.tag-create-form {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.tag-name-input {
    padding: 0.55rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border-input);
    background-color: var(--bg-input);
    color: var(--text-main);
    font-size: 0.875rem;
    font-family: inherit;
    min-width: 200px;
}

.tag-name-input:focus {
    outline: none;
    border-color: var(--border-focus);
}

/* ============================================
   COLOR PALETTE
   ============================================ */
.color-palette {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}

.color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.1s, border-color 0.1s;
    flex-shrink: 0;
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.selected {
    border-color: var(--text-main);
    transform: scale(1.1);
}

/* ============================================
   TAG SUGGESTIONS / SELECTED TAGS
   ============================================ */
.tag-suggestions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    min-height: 28px;
}

.selected-tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    min-height: 28px;
}

.new-tag-inline {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.new-tag-inline input {
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-input);
    background-color: var(--bg-input);
    color: var(--text-main);
    font-size: 0.85rem;
    font-family: inherit;
    width: 160px;
}

.new-tag-inline input:focus {
    outline: none;
    border-color: var(--border-focus);
}

/* ============================================
   TAG GROUPS (Tags view)
   ============================================ */
.tag-group-section {
    margin-bottom: 2rem;
}

.tag-group-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.tag-group-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    user-select: none;
    cursor: default;
}

.tag-group-grid {
    margin-top: 0;
}

.tag-group-badge {
    font-size: 0.9rem;
    padding: 0.35rem 0.9rem;
}

.tag-edit-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}

.tag-edit-btn:hover {
    background-color: var(--bg-canvas);
    border-color: var(--border);
    color: var(--text-main);
}

.tag-edit-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
}

/* ============================================
   DETAIL MODAL
   ============================================ */
.modal-detail {
    width: 680px;
    max-width: 95%;
}

.detail-creator {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.2rem;
}

.detail-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ============================================
   CODE EDITOR TEXTAREA
   ============================================ */
.code-editor {
    font-family: 'Courier New', Courier, monospace !important;
    font-size: 0.875rem;
    line-height: 1.6;
    tab-size: 4;
    background-color: var(--code-bg) !important;
    border: 1px solid var(--code-border) !important;
    color: var(--code-text) !important;
    border-radius: 8px;
    padding: 1rem !important;
    resize: vertical;
    min-height: 180px;
}

.code-editor:focus {
    outline: none;
    border-color: var(--border-focus) !important;
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.monaco-editor-container {
    height: 280px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--code-border);
}

.monaco-editor-readonly {
    height: 400px;
}

/* Card code preview: max 8 lines with fade-out */
.snippet-card .code-wrapper {
    max-height: 10.5rem;
    overflow: hidden;
}

.snippet-card .code-wrapper pre {
    padding-bottom: 2.5rem;
}

.snippet-card .code-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3rem;
    background: linear-gradient(to bottom, transparent, var(--code-bg));
    pointer-events: none;
    border-radius: 0 0 8px 8px;
}

/* Detail modal copy button: always visible, above Monaco */
.detail-copy-btn {
    opacity: 1;
    z-index: 10;
}

/* ============================================
   TAG MODAL & MINI BUTTON
   ============================================ */
.modal-tag-content {
    width: 400px;
    max-width: 95%;
}

.btn-tag-mini {
    background: none;
    border: 1px dashed var(--border-input);
    color: var(--text-muted);
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    margin-top: 0.25rem;
}

.btn-tag-mini:hover {
    border-color: var(--border-focus);
    color: var(--text-main);
}
