﻿/* Custom Color Theme
   Primary: #BECF91 (Sage Green)
   Secondary: #874B36 (Brown)
   Accent: #0D022C (Dark Purple)
*/

:root {
    /* Core Palette */
    --sage-light: #D4E3B3;
    --sage-main: #BECF91;
    --sage-dark: #9CAF71;
    --sage-darker: #4A6741;
    
    --brown-light: #A35D42;
    --brown-main: #874B36;
    --brown-dark: #6A3B2A;
    
    --purple-light: #1F0D4E;
    --purple-main: #0D022C;
    
    /* Semantic Functional Colors - Light Mode Default */
    --primary-color: var(--sage-main);
    --primary-fg: var(--purple-main);
    
    --action-color: var(--sage-darker);
    --action-hover: var(--sage-dark);
    
    --link-color: var(--action-color);
    
    --bg-color: #F9FAFB;
    --surface-color: #FFFFFF;
    --surface-border: #E5E7EB;
    
    --text-color: #1F2937;
    --text-muted: #6B7280;
    
    --sidebar-bg: #FFFFFF;
    --card-bg: #FFFFFF;
    --border-color: #E5E7EB;
    --input-bg: #FFFFFF;
    --input-border: #D1D5DB;
    
    --hover-bg: #F3F4F6;
    
    --header-text: #111827;
}

/* Dark Mode Overrides */
[data-theme='dark'] {
    /* Semantic Functional Colors - Dark Mode */
    --primary-color: var(--sage-main);
    --primary-fg: var(--purple-main);
    
    --action-color: var(--sage-light);
    --action-hover: #FFFFFF;
    
    --link-color: var(--action-color);
    
    --bg-color: #111827;
    --surface-color: #1F2937;
    --surface-border: #374151;
    
    --text-color: #F9FAFB;
    --text-muted: #9CA3AF;
    
    --sidebar-bg: #1F2937;
    --card-bg: #1F2937;
    --border-color: #374151;
    --input-bg: #111827;
    --input-border: #4B5563;
    
    --hover-bg: #374151;
    
    --header-text: #FFFFFF;
}

/* Global Resets & Utilities */
body {
    background-color: var(--bg-color) !important;
    color: var(--text-color) !important;
}

#app, .page {
    background-color: var(--bg-color);
}

/* Improved Typography Contrast */
h1, h2, h3, h4, h5, h6 {
    color: var(--header-text) !important;
}

/* Placeholders (Search, Forms) */
::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.8;
}

[data-theme='dark'] ::placeholder {
    color: #6B7280 !important; /* Lighter gray for visibility on dark */
    opacity: 1;
}

/* Links */
a, .btn-link {
    color: var(--action-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover, .btn-link:hover {
    color: var(--action-hover);
    text-decoration: underline;
}

/* Buttons - Primary */
.btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: var(--primary-fg) !important;
    font-weight: 600;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--sage-light) !important;
    border-color: var(--sage-light) !important;
    color: var(--purple-main) !important;
}

.btn-outline-primary {
    color: var(--action-color) !important;
    border-color: var(--action-color) !important;
    background-color: transparent !important;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: var(--primary-fg) !important;
}

/* Buttons - Secondary */
.btn-secondary, .btn-info {
    background-color: var(--brown-main) !important;
    border-color: var(--brown-main) !important;
    color: #FFFFFF !important;
}

.btn-secondary:hover, .btn-info:hover {
    background-color: var(--brown-light) !important;
    border-color: var(--brown-light) !important;
}

/* Sidebar & NavMenu specific fixes */
.sidebar {
    background-color: var(--sidebar-bg) !important;
    border-right: 1px solid var(--border-color) !important;
}

.nav-header {
    color: var(--header-text);
    border-bottom: 1px solid var(--border-color);
}

.folder-header {
    color: var(--text-color);
    font-weight: 500;
}

.folder-header:hover {
    color: var(--primary-color);
}

.user-section {
    color: var(--text-color);
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
}

.user-section:hover {
    border-color: var(--primary-color);
}

/* Input Fields */
.form-control, .form-select, textarea {
    background-color: var(--input-bg) !important;
    border-color: var(--input-border) !important;
    color: var(--text-color) !important;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.25rem rgba(190, 207, 145, 0.25) !important;
}

/* Explorer Page Specifics */
.explorer-namespace-title {
    color: var(--header-text);
    font-weight: 700;
}

.entity-column-header {
    background-color: var(--hover-bg) !important;
    color: var(--header-text) !important;
    border-bottom: 2px solid var(--border-color) !important;
}

/* Entity List Items */
.entity-item {
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

.entity-item:hover {
    background-color: var(--hover-bg) !important;
}

.entity-item.active {
    background-color: var(--primary-color) !important;
    color: var(--primary-fg) !important;
    border-color: var(--primary-color);
}

/* Custom Favorites Toggle Button (Explorer) */
.favorite-toggle-btn {
    background: none;
    border: none;
    color: #F59E0B; /* Amber */
    font-size: 1.75rem; /* Match the visual weight of H1 */
    line-height: 1;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.favorite-toggle-btn:hover {
    transform: scale(1.2);
    color: #D97706; /* Amber-600 */
}

.favorite-toggle-btn.not-favorited {
    color: var(--text-muted); /* Gray when not favorite */
    opacity: 0.5;
}

.favorite-toggle-btn.not-favorited:hover {
    color: #F59E0B;
    opacity: 1;
}

/* Namespace Cards (Home) */
.namespace-card {
    background-color: var(--surface-color) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-color) !important;
}

.namespace-card:hover {
    border-color: var(--primary-color) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--surface-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
    border: 2px solid var(--surface-color);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Alerts */
.alert-info {
    background-color: rgba(190, 207, 145, 0.1) !important;
    border-color: var(--sage-main) !important;
    color: var(--text-color) !important;
}

[data-theme='dark'] .alert-info {
    background-color: rgba(190, 207, 145, 0.05) !important;
    color: var(--sage-light) !important;
}

/* Modal Fixes */
.modal-content {
    background-color: var(--surface-color) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
}

.modal-header, .modal-footer {
    border-color: var(--border-color) !important;
}

[data-theme='dark'] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}
