:root {
    --primary: #7C3AED;
    --secondary: #3B82F6;
    --bg-dark: #1E293B;
    --bg-darker: #0f172a;
    --bg-card: #2D3748;
    --text-main: #F7FAFC;
    --text-muted: #A0AEC0;
    --border-subtle: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(45, 55, 72, 0.8);
    --gradient-primary: linear-gradient(135deg, var(--primary), var(--secondary));
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Light Mode Theme */
.light-theme {
    --bg-dark: #F7FAFC;
    --bg-darker: #EDF2F7;
    --bg-card: #FFFFFF;
    --text-main: #2D3748;
    --text-muted: #718096;
    --border-subtle: rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.light-theme .glass-header,
.light-theme .glass-panel,
.light-theme .card,
.light-theme .sidebar {
    background: var(--glass-bg);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.light-theme .gradient-text {
    /* Keep gradient or adjust? Keep for now as it uses primary/secondary */
}

.light-theme .nav-item:hover,
.light-theme .nav-item.active {
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary);
}

.light-theme .nav-section h3 {
    color: var(--text-main);
}

.light-theme .nav-section.collapsible h3:hover {
    background: rgba(124, 58, 237, 0.05);
    color: var(--primary);
}

.light-theme .nav-item:hover,
.light-theme .nav-sub-item:hover {
    color: var(--text-main);
}

.light-theme .nav-item:hover i {
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary);
}

.light-theme .nav-item.active i {
    background: linear-gradient(135deg, #7c3aed 0%, #3b82f6 100%);
    color: #fff;
}

.light-theme .nav-sub-item.active {
    color: var(--primary);
}

.light-theme .pinned-templates-container .card-header h3 {
    color: var(--text-main);
}

.light-theme .nav-item {
    color: var(--text-main);
}

.light-theme .card-description,
.light-theme .pinned-templates-container .card-description {
    color: var(--text-muted);
}

.light-theme i,
.light-theme .fa-solid,
.light-theme .fa-regular,
.light-theme .fas,
.light-theme .far {
    color: inherit;
}

.light-theme .nav-item i {
    color: var(--text-main);
}

.light-theme .panel-header h3 {
    color: var(--text-main);
}

.light-theme .btn-icon-sm {
    color: rgba(0, 0, 0, 0.4);
}

.light-theme .btn-icon-sm:hover {
    color: var(--text-main);
}

.light-theme .form-section label i {
    color: var(--primary);
}

.light-theme .cat-cloud-chip {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--text-main);
}

.light-theme .cat-cloud-chip:hover {
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary);
    border-color: rgba(124, 58, 237, 0.3);
}

.light-theme .fav-card {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.light-theme .fav-card:hover {
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.3);
}

.light-theme .fav-info h4 {
    color: var(--text-main);
}

.light-theme .fav-info p {
    color: var(--text-muted);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* Dropdown Menu */
.dropdown-container {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.dropdown-menu.hidden {
    display: none;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
}

.dropdown-item i {
    width: 20px;
    margin-right: 0.5rem;
    text-align: center;
}

/* Light theme adjustments for dropdown */
.light-theme .dropdown-menu {
    background: var(--glass-bg);
    border-color: rgba(0,0,0,0.1);
}

.light-theme .dropdown-item:hover {
    background: rgba(0,0,0,0.05);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark); 
}
::-webkit-scrollbar-thumb {
    background: var(--bg-card); 
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary); 
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

main {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Header */
.glass-header {
    height: 70px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.5rem;
}

.search-bar {
    position: relative;
    width: 400px;
}

.search-bar input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 9999px;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    color: var(--text-main);
    font-family: inherit;
    transition: all 0.3s ease;
}

.search-bar i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stats {
    margin-right: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Buttons */
.btn {
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
}

.btn-text {
    background: transparent;
    color: var(--text-muted);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-text:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.05);
}

/* Sidebar */
.sidebar {
    grid-area: sidebar;
    background: linear-gradient(180deg, rgba(30, 30, 46, 0.95) 0%, rgba(15, 15, 25, 0.98) 100%);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
}

.nav-section h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    font-weight: 700;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
}

.nav-section.collapsible h3 {
    cursor: pointer;
}

.nav-section.collapsible h3:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.nav-section.collapsible .toggle-icon {
    font-size: 0.8rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.7;
}

.nav-section.collapsible h3:hover .toggle-icon {
    opacity: 1;
    color: var(--primary);
}

.nav-section.collapsible.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.nav-section.collapsible.collapsed ul {
    display: none;
}

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

/* Sidebar Item Base */
.nav-item {
    padding: 0.8rem 1rem;
    border-radius: 16px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    user-select: none;
    position: relative;
    border: 1px solid transparent;
}

.nav-item i {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

.nav-item:hover i {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: scale(1.1);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(30, 30, 46, 0.8) 0%, rgba(20, 20, 30, 0.9) 100%);
    color: #fff;
    border: 1px solid rgba(124, 58, 237, 0.5);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.15), inset 0 0 20px rgba(124, 58, 237, 0.05);
}

.nav-item.active i {
    background: linear-gradient(135deg, #7c3aed 0%, #3b82f6 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
    transform: scale(1.05);
}

/* Badge count style */
.nav-badge {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.3s;
    border: 1px solid rgba(255,255,255,0.05);
}

.nav-item.active .nav-badge {
    background: rgba(124, 58, 237, 0.2);
    color: #a78bfa;
    border-color: rgba(124, 58, 237, 0.3);
}

/* Nested Categories Tree */
.nav-group {
    margin-bottom: 0.5rem;
}

.nav-group-header {
    justify-content: space-between;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
}

.nav-group-header .toggle-icon {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
}

.nav-group-header:hover .toggle-icon {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.nav-group.expanded .toggle-icon {
    transform: rotate(90deg);
    background: rgba(124, 58, 237, 0.2);
    color: #a78bfa;
}

.nav-sub-list {
    margin-left: 1.5rem;
    padding-left: 1rem;
    border-left: 2px solid rgba(255, 255, 255, 0.05);
    display: none;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.nav-group.expanded .nav-sub-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.nav-sub-item {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.nav-sub-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
    transform: translateX(5px);
}

.nav-sub-item.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.1) 0%, transparent 100%);
    border-left: 2px solid #7c3aed; /* Replaces ::before for a cleaner look */
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Remove old line connector to use border instead for sub-items */
.nav-sub-item::before {
    display: none;
}

/* Settings Modal */
.settings-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    height: 60vh;
}

.settings-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.manager-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.manager-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
}

.manager-item-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.manager-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.manager-item:hover .manager-actions {
    opacity: 1;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.sub-category-indicator {
    margin-left: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-left: 2px solid var(--primary);
    padding-left: 0.5rem;
}

/* Responsive Settings */
@media (max-width: 768px) {
    .settings-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
}

/* List View Mode */
.templates-grid.view-list {
    grid-template-columns: 1fr !important;
    gap: 1rem;
}

.templates-grid.view-list .card {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 1rem;
    height: auto;
    gap: 1.5rem;
}

.templates-grid.view-list .card-header {
    flex: 0 0 250px;
    margin-bottom: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    border-bottom: none;
    padding-bottom: 0;
}

.templates-grid.view-list .card-badge {
    margin-bottom: 0.5rem;
}

.templates-grid.view-list .card-body {
    flex: 1;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.templates-grid.view-list .card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.templates-grid.view-list .card p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0;
    font-size: 0.9rem;
}

.templates-grid.view-list .card-preview {
    display: none;
}

.templates-grid.view-list .card-footer {
    display: none;
}

.templates-grid.view-list .card-actions {
    position: static;
    opacity: 1;
    background: none;
    padding: 0;
    flex-direction: row;
    gap: 0.5rem;
    box-shadow: none;
    border: none;
}

.templates-grid.view-list .card:hover {
    transform: none;
    background: var(--bg-card);
    border-color: var(--primary);
}

.templates-grid.view-list .card::before {
    width: 4px;
    height: 100%;
    top: 0;
    left: 0;
}

/* --- New Dashboard Styles --- */

/* Header & Stats Banner */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
}

.stats-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(30, 30, 46, 0.6);
    backdrop-filter: blur(10px);
    padding: 0.5rem 0.5rem;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.stat-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
    color: #fff;
}

.stat-pill i {
    color: #a78bfa;
    font-size: 1rem;
}

.stat-pill span {
    font-weight: 700;
    color: #fff;
}

/* Quick Prompt Button Override */
#btnQuickPrompt {
    font-size: 1rem;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    background: linear-gradient(135deg, #7c3aed 0%, #3b82f6 100%);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
    border: none;
    transition: all 0.3s ease;
}

#btnQuickPrompt:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.6);
}

/* Dashboard Grid Layout */
.dashboard-content-grid {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 2rem;
}

@media (max-width: 992px) {
    .dashboard-content-grid {
        grid-template-columns: 1fr;
    }
    
    .header-right {
        align-items: flex-start;
        width: 100%;
    }
    
    .stats-banner {
        width: 100%;
        justify-content: space-between;
        overflow-x: auto;
    }
}

.dash-col-main, .dash-col-side {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Favorites Grid */
.fav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.fav-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    position: relative;
    overflow: hidden;
}

.fav-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.03), transparent);
    transform: translateX(-100%);
    transition: 0.5s;
}

.fav-card:hover::before {
    transform: translateX(100%);
}

.fav-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(124, 58, 237, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.fav-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(124, 58, 237, 0.1);
    color: #a78bfa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.fav-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #e2e8f0;
}

.fav-info p {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.3rem;
}

/* Category Cloud */
.categories-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.cat-cloud-chip {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cat-cloud-chip:hover {
    background: rgba(124, 58, 237, 0.1);
    color: #a78bfa;
    border-color: rgba(124, 58, 237, 0.2);
}

.cat-count {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Panel Header tweaks */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.panel-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.btn-icon-sm {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: color 0.2s;
    font-size: 0.9rem;
}

.btn-icon-sm:hover {
    color: #fff;
}

.text-warning { color: #fbbf24; }


.dashboard-panel {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    padding: 1.5rem;
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.dashboard-panel:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(124, 58, 237, 0.3);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.panel-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Sub-Category Filters */
.sub-category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    animation: fadeIn 0.3s ease-out;
}

.sub-category-chip {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sub-category-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    transform: translateY(-2px);
}

.sub-category-chip.active {
    background: rgba(124, 58, 237, 0.2);
    color: #a78bfa;
    border-color: rgba(124, 58, 237, 0.4);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.1);
}

/* Recent List */
.recent-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.recent-item:hover {
    background: rgba(255,255,255,0.08);
}

.recent-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(124, 58, 237, 0.15);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.recent-content {
    flex: 1;
}

.recent-content h4 {
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.recent-content p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.recent-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Category Chart (Simple Bars) */
.chart-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
}

.chart-label {
    width: 120px;
    color: var(--text-muted);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.chart-bar-bg {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
}

.chart-value {
    width: 30px;
    text-align: right;
    font-weight: 600;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding-bottom: 3rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    animation: fadeIn 0.4s ease-out forwards;
    display: flex;
    flex-direction: column;
    height: 100%;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card:hover::before {
    opacity: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.card-badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    background: rgba(124, 58, 237, 0.15);
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.card:hover .card-actions {
    opacity: 1;
}

.card-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s;
}

.card-actions button:hover {
    color: var(--text-main);
}

.card-actions button.active {
    color: #F59E0B; /* Gold for star */
}

.card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    line-height: 1.4;
}

.card-preview {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 1rem;
}

.project-type-tag {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.project-type-tag::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--secondary);
}

.app-footer {
    margin-top: auto;
    padding-top: 3rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.02);
    margin-bottom: 1.5rem; /* Added spacing */
}

.modal-body {
    padding: 0 2rem 2rem 2rem; /* Adjusted padding */
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 2rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: rgba(255,255,255,0.02);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
}

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

/* Form */
.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.form-group label, .form-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.form-section label i {
    margin-left: 0.5rem;
    color: var(--secondary);
    cursor: help;
}

.form-group input, .form-group select, .form-section textarea {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-main);
    font-family: inherit;
    transition: all 0.2s;
}

.form-group input:focus, .form-group select:focus, .form-section textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
}

.form-grid-7 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.form-section textarea {
    min-height: 80px;
    resize: vertical;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 2000;
}

.toast {
    background: var(--bg-card);
    border-left: 4px solid var(--primary);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideIn 0.3s ease-out;
    color: var(--text-main);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 1024px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        padding: 1rem;
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
    }

    .nav-section {
        min-width: 200px;
    }

    .search-bar {
        width: 200px;
    }

    .search-bar input {
        padding-left: 2rem;
    }
    
    .search-bar i {
        left: 0.75rem;
    }
}

@media (max-width: 480px) {
    .header-actions span {
        display: none;
    }
    
    .search-bar {
        display: none;
    }
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.hidden {
    display: none !important;
}

/* Quick Prompt Styles */
.quick-actions-bar {
    margin-bottom: 2rem;
    animation: fadeIn 0.5s ease-out;
}

#btnQuickPrompt {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    width: 100%;
    justify-content: center;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
    border-radius: 12px;
}

#btnQuickPrompt:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
}

/* Quick Prompt Modal Layout */
.qp-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    height: 100%;
    overflow: hidden; /* Manage scroll internally */
    padding: 0 2rem 2rem 2rem; /* Override default padding */
}

.qp-inputs {
    overflow-y: auto;
    padding-right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.qp-preview-col {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-header {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.preview-badge {
    font-size: 0.7rem;
    background: rgba(16, 185, 129, 0.2);
    color: #10B981;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 700;
}

.preview-content {
    padding: 1.5rem;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace; /* Monospace for prompt clarity */
    white-space: pre-wrap;
    line-height: 1.6;
    color: #e2e8f0;
    flex: 1;
}

.preview-placeholder {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    margin-top: 2rem;
    font-family: 'Montserrat', sans-serif;
}

.qp-collapsible summary {
    cursor: pointer;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    user-select: none;
    transition: background 0.2s;
}

.qp-collapsible summary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.mt-2 {
    margin-top: 1rem;
}

/* ============================================
   SECTION ÉPINGLÉS (SIDEBAR)
   ============================================ */

.pinned-section {
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.pinned-section-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.pin-counter {
    margin-left: auto;
}

.pinned-templates-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.pinned-templates-container .card {
    background: rgba(124, 58, 237, 0.08);
    border: 1px solid rgba(124, 58, 237, 0.2);
    padding: 0.8rem;
    border-radius: 12px;
    cursor: grab;
    transition: all 0.3s ease;
}

.pinned-templates-container .card:hover {
    background: rgba(124, 58, 237, 0.12);
    border-color: rgba(124, 58, 237, 0.3);
    transform: translateY(-2px);
}

.pinned-templates-container .card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.pinned-templates-container .card-header h3 {
    font-size: 0.9rem;
    margin: 0;
    color: #fff;
    font-weight: 600;
}

.pinned-templates-container .card-actions {
    display: flex;
    gap: 0.3rem;
}

.pinned-templates-container .btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.pinned-templates-container .card-description {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0.5rem 0;
    line-height: 1.4;
}

.pinned-templates-container .card-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0.5rem 0;
}

.pinned-templates-container .card-badge,
.pinned-templates-container .project-type-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
}

.pinned-templates-container .card-footer {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.8rem;
}

.pinned-templates-container .btn-sm {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
}

.pinned-templates-container .empty-state {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

/* Pin button dans cards */
.btn-pin {
    position: relative;
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.5);
}

.btn-pin:hover {
    color: #7C3AED;
    transform: scale(1.1);
}

.btn-pin.active {
    color: #7C3AED;
}

.btn-pin.active:hover {
    color: #EC4899;
}

/* Responsive QP */
@media (max-width: 1024px) {
    .qp-layout {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .qp-inputs {
        overflow-y: visible;
        padding-right: 0;
    }

    .qp-preview-col {
        height: 300px; /* Fixed height on mobile */
    }
}
