/**
 * Toolium - Premium Design System (Apple + Stripe style CSS overrides)
 */

/* Root Variables */
:root {
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --text-gradient-color: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    
    /* Light Mode Tokens */
    --bg-app: #f8fafc;
    --bg-glass: rgba(255, 255, 255, 0.7);
    --border-glass: rgba(255, 255, 255, 0.6);
    --shadow-soft: 0 8px 30px 0 rgba(0, 0, 0, 0.04), 0 1px 2px 0 rgba(0, 0, 0, 0.02);
    --card-shadow-hover: 0 20px 40px 0 rgba(0, 0, 0, 0.06);
}

/* Dark Mode Tokens */
[data-bs-theme="dark"] {
    --bg-app: #0f172a;
    --bg-glass: rgba(15, 23, 42, 0.75);
    --border-glass: rgba(255, 255, 255, 0.05);
    --shadow-soft: 0 8px 30px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 20px 40px 0 rgba(0, 0, 0, 0.4);
    
    background-color: #0f172a !important;
}

/* Global Styles */
body {
    background-color: var(--bg-app);
    font-family: var(--font-body);
    color: #334155;
    transition: background-color 0.3s ease, color 0.3s ease;
}

[data-bs-theme="dark"] body {
    color: #e2e8f0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
}

.fw-black {
    font-weight: 900;
}

/* Glassmorphism Card System */
.glass-card {
    background: var(--bg-glass) !important;
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid var(--border-glass) !important;
    border-radius: 1rem;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-card:hover {
    box-shadow: var(--card-shadow-hover);
}

/* Custom Overrides for Bootstrap Theme Selector */
[data-bs-theme="dark"] .navbar {
    background: rgba(15, 23, 42, 0.85) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

[data-bs-theme="dark"] .dropdown-menu {
    background: rgba(15, 23, 42, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

[data-bs-theme="dark"] .dropdown-item {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* Text Gradient Classes */
.text-gradient {
    background: var(--text-gradient-color);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Micro-animations and hover effect utilities */
.hover-up {
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.hover-up:hover {
    transform: translateY(-4px);
}

/* Custom Buttons styles */
.btn-primary {
    background: var(--primary-gradient);
    border: none;
}

.btn-primary:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

/* User avatar placeholder */
.avatar-placeholder {
    width: 80px;
    height: 80px;
    background: var(--primary-gradient);
    color: white;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin: 0 auto;
}

/* Note Editor Utilities */
.btn-color-dot {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    border: 2px solid transparent;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.btn-color-dot.active {
    border-color: #6366f1;
    transform: scale(1.15);
}

.active-card {
    background: rgba(99, 102, 241, 0.08) !important;
    border-left-color: #6366f1 !important;
}

/* Tool output styling */
.tool-output-panel {
    background: #0f172a;
    color: #38bdf8;
    border-radius: 0.5rem;
    padding: 1.5rem;
    font-family: 'SFMono-Regular', Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    position: relative;
    border: 1px solid rgba(255,255,255,0.05);
}

[data-bs-theme="dark"] .tool-output-panel {
    background: #020617;
}

/* Custom Scrollbar for better UI experience */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.4);
}

/* Helper Text Sizes */
.text-xs {
    font-size: 0.75rem;
}
.text-sm {
    font-size: 0.875rem;
}
.fs-7 {
    font-size: 0.8rem;
}

.focus-none:focus {
    box-shadow: none !important;
    outline: none !important;
}

/* Mega Menu Structure */
.mega-menu {
    width: 100%;
    left: 0;
    right: 0;
}

/* Command Palette Styles */
.command-palette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1050;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 15vh;
}

.command-palette-modal {
    width: 90%;
    max-width: 600px;
    background: var(--bg-glass) !important;
    backdrop-filter: blur(15px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(15px) saturate(180%) !important;
    border: 1px solid var(--border-glass) !important;
    border-radius: 1.25rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), var(--shadow-soft) !important;
    overflow: hidden;
    animation: paletteReveal 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes paletteReveal {
    from {
        opacity: 0;
        transform: scale(0.97) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.command-palette-header {
    display: flex;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-glass);
}

.command-palette-header .search-icon {
    font-size: 1.25rem;
    color: #64748b;
    margin-right: 0.75rem;
}

.command-palette-header input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1.1rem;
    color: inherit;
    outline: none;
    box-shadow: none;
}

.command-palette-body {
    max-height: 350px;
    overflow-y: auto;
    padding: 0.75rem;
}

.palette-results-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.palette-result-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: inherit;
    text-decoration: none;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.palette-result-item:hover, .palette-result-item.active {
    background: rgba(99, 102, 241, 0.08) !important;
    border-left-color: #6366f1;
    text-decoration: none;
    color: inherit;
}

[data-bs-theme="dark"] .palette-result-item:hover, 
[data-bs-theme="dark"] .palette-result-item.active {
    background: rgba(255, 255, 255, 0.05) !important;
    border-left-color: #8b5cf6;
    color: inherit;
}

.palette-result-item .item-icon {
    font-size: 1.25rem;
    margin-right: 0.75rem;
    color: #6366f1;
}

[data-bs-theme="dark"] .palette-result-item .item-icon {
    color: #a78bfa;
}

.palette-result-item .item-meta {
    flex: 1;
    min-width: 0;
}

.palette-result-item .item-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.1rem;
}

.palette-result-item .item-desc {
    font-size: 0.8rem;
    color: #64748b;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.command-palette-footer {
    padding: 0.75rem 1.25rem;
    background: rgba(0, 0, 0, 0.01);
    border-top: 1px solid var(--border-glass);
}

kbd {
    font-family: inherit;
    background-color: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 0 rgba(0,0,0,0.1);
    border-radius: 4px;
    padding: 0.1rem 0.3rem;
}

[data-bs-theme="dark"] kbd {
    background-color: #1e293b;
    color: #94a3b8;
    border-color: #334155;
}


/* Tool Card Fix for Dark Mode */
.tool-card-btn { background: rgba(255,255,255,0.5); transition: all 0.3s ease; }
[data-bs-theme="dark"] .tool-card-btn { background: rgba(15, 23, 42, 0.5); }
[data-bs-theme="dark"] .tool-card-btn:hover { background: rgba(15, 23, 42, 0.8); }
