/* Chappy AI - Design System (V2 Layout) */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-dark: #05050a;
    --bg-card: rgba(12, 12, 20, 0.8);
    --glass-bg: rgba(18, 18, 35, 0.6);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-shine: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);

    --accent-1: #8b5cf6;
    --accent-2: #06b6d4;
    --accent-3: #ec4899;
    --glow-purple: rgba(139, 92, 246, 0.5);
    --glow-cyan: rgba(6, 182, 212, 0.4);
    --success: #10b981;
    --error: #f43f5e;
    --warning: #f59e0b;

    --text-1: #fafaff;
    --text-2: #94a3b8;
    --text-3: #475569;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-1);
    height: 100vh;
    overflow: hidden;
    position: relative;
    perspective: 1000px;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 15% 15%, rgba(139, 92, 246, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 85% 20%, rgba(6, 182, 212, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 50% 80%, rgba(236, 72, 153, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
    top: -80px;
    right: -80px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--accent-1), var(--accent-2)); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--accent-2), var(--accent-1)); }

/* ============ AUTH PAGE ============ */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: auto;
}

.auth-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.auth-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 40px 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.auth-header { text-align: center; margin-bottom: 32px; }

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon { width: 36px; height: 36px; object-fit: contain; }

.logo-text {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, #c4b5fd 0%, #67e8f9 50%, #f9a8d4 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer { to { background-position: 200% center; } }

.auth-subtitle { color: var(--text-2); font-size: 14px; }

.auth-form { display: none; }
.auth-form.active { display: block; }
.auth-form h2 { font-size: 18px; font-weight: 600; margin-bottom: 20px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.form-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text-1);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s;
}
.form-group input:focus { outline: none; border-color: var(--accent-1); }
.form-group input::placeholder { color: var(--text-3); }
.form-hint { display: block; font-size: 11px; color: var(--text-3); margin-top: 4px; }

.auth-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 8px;
}
.auth-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 20px var(--glow-purple); }
.auth-btn.secondary { background: transparent; border: 1px solid var(--glass-border); color: var(--text-2); }
.auth-btn.secondary:hover { border-color: var(--accent-1); color: var(--text-1); box-shadow: none; }

.auth-switch { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-2); }
.auth-switch a { color: var(--accent-1); text-decoration: none; font-weight: 500; }
.auth-switch a:hover { color: var(--accent-2); }

.auth-error { text-align: center; color: var(--error); font-size: 13px; margin-top: 12px; opacity: 0; transition: opacity 0.3s; }
.auth-error.visible { opacity: 1; }

/* ============ APP LAYOUT (V2 Structure) ============ */
.app-container {
    display: flex;
    height: calc(100vh - 32px);
    position: relative;
    z-index: 1;
}

/* ============ SIDEBAR (V2 Style) ============ */
.sidebar {
    width: 280px;
    background: var(--glass-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
}

.sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--glass-shine);
    pointer-events: none;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    font-weight: 700;
    font-size: 14px;
    color: var(--text-1);
}

.sidebar-logo-icon { width: 28px; height: 28px; object-fit: contain; }

.sidebar-header h2 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-1);
}

.sidebar-session-actions {
    padding: 8px 12px;
    border-bottom: 1px solid var(--glass-border);
}

.new-session-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border: 1px dashed var(--glass-border);
    border-radius: 10px;
    background: transparent;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.new-session-btn:hover {
    border-color: var(--accent-1);
    color: var(--accent-1);
    background: rgba(139, 92, 246, 0.1);
}

.file-browser {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* Session Items (like file items in V2) */
.session-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 10px;
    border-radius: 8px;
    margin: 2px 8px;
    color: var(--text-2);
    font-size: 13px;
    border: none;
    background: none;
    width: calc(100% - 16px);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-item:hover {
    background: rgba(139, 92, 246, 0.15);
    transform: translateX(4px);
    color: var(--text-1);
}

.session-item.active {
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent-1);
}

.session-icon { font-size: 14px; width: 16px; flex-shrink: 0; }

/* Sidebar Footer */
.sidebar-user-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.user-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.user-avatar-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.user-name-text {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-icon-btn {
    background: none;
    border: 1px solid var(--glass-border);
    color: var(--text-2);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.logout-icon-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
    border-color: var(--error);
}

.logout-icon-btn svg { width: 14px; height: 14px; }

/* ============ MAIN CONTENT ============ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    position: relative;
    z-index: 1;
}

/* ============ HEADER (V2 3D Card) ============ */
.chat-header {
    padding: 12px 24px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--glass-bg);
    position: relative;
    z-index: 10;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.4),
        0 1px 0 rgba(255, 255, 255, 0.05) inset;
}

.chat-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--glass-shine);
    pointer-events: none;
    border-radius: inherit;
}

.chat-header h1 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.chat-header h1 svg { width: 18px; height: 18px; }

.chat-header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo-text {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, #c4b5fd 0%, #67e8f9 50%, #f9a8d4 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3s linear infinite;
    letter-spacing: -0.5px;
}

.header-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    position: relative;
    z-index: 1;
}

/* 3D Buttons (V2 Style) */
.header-btn {
    position: relative;
    padding: 10px 14px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: var(--bg-card);
    color: var(--text-1);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.05) inset,
        0 -1px 0 rgba(0, 0, 0, 0.2) inset;
    transform-style: preserve-3d;
}

.header-btn:hover {
    transform: translateY(-3px) rotateX(5deg);
    box-shadow:
        0 12px 24px rgba(0, 0, 0, 0.4),
        0 1px 0 rgba(255, 255, 255, 0.1) inset;
}

.header-btn:active {
    transform: translateY(0) rotateX(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) inset;
}

.header-btn.active {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
}

.header-btn svg { width: 16px; height: 16px; stroke-width: 2.5; }

/* ============ CHAT CONTAINER (replaces Terminal) ============ */
#chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(5, 5, 10, 0.5);
    position: relative;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Welcome */
.welcome-message {
    text-align: center;
    padding: 60px 20px;
    max-width: 500px;
    margin: auto;
}

.welcome-icon { margin-bottom: 16px; }
.welcome-icon img { width: 64px; height: 64px; object-fit: contain; }

.welcome-message h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #c4b5fd, #67e8f9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-message p { color: var(--text-2); font-size: 14px; line-height: 1.6; margin-bottom: 24px; }

.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.quick-btn {
    padding: 8px 16px;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    background: transparent;
    color: var(--text-2);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quick-btn svg { width: 14px; height: 14px; }

.quick-btn:hover {
    border-color: var(--accent-1);
    color: var(--accent-1);
    background: rgba(139, 92, 246, 0.1);
}

/* Messages */
.message {
    display: flex;
    gap: 12px;
    max-width: 800px;
}

.message-user { flex-direction: row-reverse; align-self: flex-end; }
.message-assistant { align-self: flex-start; }

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.message-user .message-avatar {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
    color: white;
    font-weight: 600;
}

.message-assistant .message-avatar {
    background: rgba(6, 182, 212, 0.2);
    font-size: 18px;
}

.message-bubble { max-width: 600px; }

.message-name { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.message-user .message-name { text-align: right; }

.message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    user-select: text;
    cursor: text;
}

.message-user .message-content {
    background: linear-gradient(135deg, var(--accent-1), rgba(139, 92, 246, 0.8));
    color: white;
    border-bottom-right-radius: 4px;
}

.message-assistant .message-content {
    background: rgba(30, 30, 50, 0.8);
    border: 1px solid var(--glass-border);
    color: var(--text-1);
    border-bottom-left-radius: 4px;
}

/* Message Content Markdown */
.message-content p { margin-bottom: 8px; }
.message-content p:last-child { margin-bottom: 0; }

.message-content pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    font-size: 13px;
}

.message-content code {
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: 13px;
}

.message-content :not(pre) > code {
    background: rgba(139, 92, 246, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.message-content ul, .message-content ol { margin: 8px 0; padding-left: 20px; }
.message-content li { margin-bottom: 4px; }
.message-content h1, .message-content h2, .message-content h3,
.message-content h4, .message-content h5, .message-content h6 { margin-top: 12px; margin-bottom: 6px; }
.message-content a { color: var(--accent-2); text-decoration: none; }
.message-content a:hover { text-decoration: underline; }
.message-content table { border-collapse: collapse; margin: 8px 0; width: 100%; }
.message-content th, .message-content td { border: 1px solid var(--glass-border); padding: 6px 10px; font-size: 13px; }
.message-content th { background: rgba(0, 0, 0, 0.3); }
.message-content blockquote { border-left: 3px solid var(--accent-1); padding-left: 12px; margin: 8px 0; color: var(--text-2); }

/* Tool Indicator */
.tool-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    font-size: 12px;
    color: var(--accent-1);
    margin: 4px 0;
}

.tool-spinner {
    width: 12px; height: 12px;
    border: 2px solid rgba(139, 92, 246, 0.3);
    border-top: 2px solid var(--accent-1);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-text {
    color: var(--error);
    font-size: 13px;
    padding: 8px 12px;
    background: rgba(244, 63, 94, 0.1);
    border-radius: 8px;
    margin: 4px 0;
}

/* Chat Input Area (V2 Voice Input Style) */
.chat-input-area {
    padding: 16px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: rgba(0, 0, 0, 0.2);
}

#chat-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px;
    color: var(--text-1);
    font-size: 14px;
    resize: none;
    font-family: inherit;
    transition: all 0.3s;
    min-height: 44px;
    max-height: 150px;
    line-height: 1.5;
}

#chat-input:focus { outline: none; border-color: var(--accent-1); }
#chat-input::placeholder { color: var(--text-3); }

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--accent-2), var(--accent-1));
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover { transform: translateY(-2px); }
.send-btn svg { width: 18px; height: 18px; }

/* ============ STATUS BAR (V2 Style) ============ */
.status-bar {
    height: 32px;
    background: var(--glass-bg);
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 24px;
    font-size: 12px;
    position: relative;
    z-index: 1;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-2);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.status-dot.busy {
    background: var(--accent-1);
    animation: pulse 1s ease-in-out infinite;
}

.status-dot.error {
    background: var(--error);
    box-shadow: 0 0 10px var(--error);
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ============ SHOPIFY PANEL (V2 Slide-out) ============ */
.shopify-panel {
    position: fixed;
    top: 0;
    right: -500px;
    width: 500px;
    height: 100vh;
    background: var(--glass-bg);
    border-left: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    z-index: 900;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.3);
}

.shopify-panel.open { right: 0; }

.shopify-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
}

.shopify-header h3 {
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, #95bf47, #67e8f9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.shopify-header h3 svg { width: 18px; height: 18px; }

.shopify-header-actions { display: flex; gap: 8px; }

.shopify-header-actions button {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: all 0.2s;
    color: var(--text-2);
}

.shopify-header-actions button:hover {
    background: rgba(139, 92, 246, 0.2);
    color: var(--text-1);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-2);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

/* Shopify Tabs */
.shopify-tabs {
    display: flex;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tab-btn:hover {
    color: var(--text-1);
    background: rgba(139, 92, 246, 0.1);
    transform: translateY(-1px);
}

.tab-btn.active {
    color: var(--accent-1);
    border-bottom-color: var(--accent-1);
    background: rgba(139, 92, 246, 0.1);
}

.tab-btn svg { width: 14px; height: 14px; }

/* Shopify List */
.shopify-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.shopify-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.shopify-item:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--accent-1);
    transform: translateX(4px);
}

.item-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: rgba(0, 0, 0, 0.3);
}

.item-info { flex: 1; min-width: 0; }

.item-title {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-meta { font-size: 11px; color: var(--text-2); margin-top: 2px; }

/* Shopify Preview Links */
.shopify-preview-link {
    padding: 16px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.preview-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.preview-btn:hover { transform: translateY(-3px); }

.preview-btn.admin {
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-1);
    border: 1px solid var(--glass-border);
}

.preview-btn.admin:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--accent-1);
}

.preview-btn svg { width: 16px; height: 16px; }

/* ============ SHARED STATES ============ */
.loading, .error, .empty {
    padding: 20px;
    text-align: center;
    color: var(--text-2);
    font-size: 13px;
}

.error { color: var(--error); }

/* ============ ONBOARDING OVERLAY ============ */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 10, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.overlay.hidden { display: none; }

.overlay-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 40px 32px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.overlay-header { text-align: center; margin-bottom: 24px; }

.overlay-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin-top: 8px;
    margin-bottom: 4px;
    background: linear-gradient(135deg, #c4b5fd, #67e8f9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.overlay-header p { color: var(--text-2); font-size: 14px; }

/* ============ NOTIFICATION ============ */
.notification {
    position: fixed;
    bottom: 60px;
    right: 20px;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.notification.show { transform: translateY(0); opacity: 1; }
.notification-success { background: linear-gradient(135deg, var(--success), var(--accent-2)); color: white; box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4); }
.notification-error { background: linear-gradient(135deg, var(--error), #f97316); color: white; }
.notification-info { background: linear-gradient(135deg, var(--accent-1), var(--accent-2)); color: white; }

/* ============ BUTTON SHINE EFFECT ============ */
.btn, .action-btn, .header-btn, .tab-btn { position: relative; overflow: hidden; }
.btn::before, .action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}
.btn:hover::before, .action-btn:hover::before { left: 100%; }

/* ============ UI Inspector ============ */
#ui-inspector-btn.active {
    background: linear-gradient(135deg, var(--accent-3), var(--accent-1));
    color: white;
    animation: pulse-ui-inspector 1.5s ease-in-out infinite;
}
@keyframes pulse-ui-inspector {
    0%, 100% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.5); }
    50% { box-shadow: 0 0 0 8px rgba(236, 72, 153, 0); }
}

.chappy-ui-hover {
    outline: 3px solid #ec4899 !important;
    outline-offset: 2px;
    cursor: crosshair !important;
}

.chappy-ui-selected {
    outline: 3px solid #8b5cf6 !important;
    outline-offset: 2px;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

.ui-selected-element-bar {
    display: none;
    position: fixed;
    bottom: 32px;
    left: 280px;
    right: 0;
    height: 36px;
    background: rgba(12, 12, 20, 0.95);
    border-top: 1px solid var(--glass-border);
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    z-index: 100;
    font-size: 12px;
}
.ui-selected-element-bar.visible {
    display: flex;
}
.ui-label {
    background: var(--accent-3);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 10px;
}
.ui-element-tag {
    background: var(--accent-1);
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 500;
}
.ui-element-selector {
    color: rgba(255,255,255,0.7);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Fira Code', monospace;
}
.ui-element-classes {
    color: var(--accent-2);
    font-family: 'Fira Code', monospace;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ui-selected-element-bar button {
    background: none;
    border: 1px solid var(--glass-border);
    color: rgba(255,255,255,0.6);
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}
.ui-selected-element-bar button:hover {
    background: var(--accent-1);
    color: white;
    border-color: var(--accent-1);
}
.ui-selected-element-bar button svg {
    width: 14px;
    height: 14px;
}
