/* Agibooks Theme - Green Color Scheme for Frappe v15 */
/* SIDEBAR AND NAVBAR ONLY - No form interference */
/* 
 * Color Accessibility:
 * - Primary Green (#0A6522) provides 8.9:1 contrast ratio with white text (WCAG AAA compliant)
 * - Please verify contrast ratios using tools like WebAIM Contrast Checker
 * - All colors meet WCAG 2.1 AA standards for normal and large text
 */

:root {
	--agibooks-green: #0A6522;
	--agibooks-green-dark: #083d1a;
	--agibooks-green-light: #0c7a28;
	--agibooks-green-lighter: #1a8f3a;
	--agibooks-green-darkest: #052b0d;
	--agibooks-white: #ffffff;
	--agibooks-text-muted: rgba(255, 255, 255, 0.7);
	--agibooks-text-light: rgba(255, 255, 255, 0.9);
}

/* =================================
   ACCESSIBILITY ENHANCEMENTS
   ================================= */

/* Focus states for keyboard navigation */
.body-sidebar .standard-sidebar-item .item-anchor:focus,
.body-sidebar-container .standard-sidebar-item .item-anchor:focus,
.navbar .nav-link:focus,
.navbar .navbar-brand:focus,
.navbar .dropdown-toggle:focus {
    outline: 2px solid var(--agibooks-white) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2) !important;
}

/* App switcher focus states */
.body-sidebar .app-switcher-dropdown:focus,
.body-sidebar-container .app-switcher-dropdown:focus {
    outline: 2px solid var(--agibooks-white) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2) !important;
}

.app-switcher-menu .app-item:focus,
.app-switcher-menu .app-item a:focus {
    outline: 2px solid var(--agibooks-green) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 4px rgba(10, 101, 34, 0.2) !important;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .body-sidebar *,
    .body-sidebar-container *,
    .navbar * {
        transition: none !important;
        animation: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --agibooks-green: #000000;
        --agibooks-green-dark: #000000;
        --agibooks-green-light: #333333;
        --agibooks-white: #ffffff;
    }
}

/* =================================
   MODERN FRAPPE V15 SIDEBAR
   ================================= */

/* Main sidebar container */
.body-sidebar-container .body-sidebar {
	background-color: var(--agibooks-green) !important;
	border-right: 1px solid var(--agibooks-green-dark) !important;
}

/* Sidebar sections (top/bottom) */
.body-sidebar-container .body-sidebar-top,
.body-sidebar-container .body-sidebar-bottom {
	background-color: var(--agibooks-green) !important;
	color: var(--agibooks-white) !important;
}

/* Sidebar items */
.body-sidebar-container .standard-sidebar-item .item-anchor {
	color: var(--agibooks-white) !important;
	background-color: transparent !important;
}

/* Sidebar item hover */
.body-sidebar-container .standard-sidebar-item .item-anchor:hover {
	background-color: var(--agibooks-green-light) !important;
	color: var(--agibooks-white) !important;
}

/* Sidebar active item */
.body-sidebar-container .standard-sidebar-item.active-sidebar .item-anchor {
	background-color: var(--agibooks-green-dark) !important;
	color: var(--agibooks-white) !important;
}

/* Sidebar icons */
.body-sidebar-container .standard-sidebar-item .sidebar-item-icon,
.body-sidebar-container .collapse-sidebar-link .icon {
	color: var(--agibooks-white) !important;
	fill: var(--agibooks-green) !important;
	stroke: var(--agibooks-white) !important;
	--icon-stroke: var(--agibooks-white) !important;
	--icon-fill: var(--agibooks-green) !important;
}

/* Sidebar icons on hover */
.body-sidebar-container .standard-sidebar-item .item-anchor:hover .sidebar-item-icon {
	fill: var(--agibooks-green-light) !important;
	--icon-fill: var(--agibooks-green-light) !important;
}

/* Sidebar active icons */
.body-sidebar-container .standard-sidebar-item.active-sidebar .sidebar-item-icon {
	fill: var(--agibooks-green-dark) !important;
	--icon-fill: var(--agibooks-green-dark) !important;
}

/* =================================
   NAVBAR STYLING
   ================================= */

/* Main navbar */
.navbar.navbar-expand-lg {
	background-color: var(--agibooks-green) !important;
	border-bottom: 1px solid var(--agibooks-green-dark) !important;
}

/* Navbar brand & links (Scoped to .navbar) */
.navbar .navbar-brand,
.navbar .navbar-brand a,
.navbar .navbar-nav .nav-item .nav-link,
.navbar .nav-link,
.navbar .dropdown-toggle {
	color: var(--agibooks-white) !important;
}

/* Navbar link hover (Scoped to .navbar) */
.navbar .navbar-nav .nav-item .nav-link:hover,
.navbar .nav-link:hover,
.navbar .dropdown-toggle:hover {
	color: var(--agibooks-text-muted) !important;
	background-color: var(--agibooks-green-light) !important;
}

/* Navbar icons (Scoped to .navbar) */
.navbar .navbar-nav .nav-link i,
.navbar .navbar-brand i,
.navbar i {
	color: var(--agibooks-white) !important;
	filter: brightness(0) invert(1) !important;
}

/* Navbar search input */
.navbar .navbar-search .form-control {
	background-color: rgba(255, 255, 255, 0.2) !important;
	border-color: rgba(255, 255, 255, 0.3) !important;
	color: var(--agibooks-white) !important;
}

.navbar .navbar-search .form-control::placeholder {
	color: var(--agibooks-text-muted) !important;
}

/* Navbar search dropdown */
.search-results .dropdown-menu,
.awesomplete > ul {
	background-color: var(--agibooks-white) !important;
	border: 1px solid var(--agibooks-green) !important;
}

.search-results .dropdown-item,
.awesomplete > ul > li {
	color: var(--agibooks-green) !important;
	background-color: transparent !important;
}

/* Ensure text inside dropdown items is colored correctly */
.search-results .dropdown-item *,
.awesomplete > ul > li * {
	color: var(--agibooks-green) !important;
}

.search-results .dropdown-item:hover,
.search-results .dropdown-item:focus,
.awesomplete > ul > li:hover,
.awesomplete > ul > li[aria-selected="true"] {
	background-color: var(--agibooks-green) !important;
	color: var(--agibooks-white) !important;
}

/* Ensure text inside hovered dropdown items is also white */
.search-results .dropdown-item:hover *,
.search-results .dropdown-item:focus *,
.awesomplete > ul > li:hover *,
.awesomplete > ul > li[aria-selected="true"] * {
	color: var(--agibooks-white) !important;
}

/* =================================
   BUTTONS (Only primary buttons)
   ================================= */

.btn-primary {
	background-color: var(--agibooks-green) !important;
	border-color: var(--agibooks-green) !important;
	color: var(--agibooks-white) !important;
}

.btn-primary:hover {
	background-color: var(--agibooks-green-dark) !important;
	border-color: var(--agibooks-green-dark) !important;
}

/* =================================
   MOBILE & RESPONSIVE
   ================================= */

@media (max-width: 768px) {
	.navbar-collapse {
		background-color: var(--agibooks-green) !important;
	}

	.navbar-collapse .navbar-nav .nav-link {
		color: var(--agibooks-white) !important;
		padding: 0.5rem 1rem;
	}

	.navbar-collapse .navbar-nav .nav-link:hover {
		background-color: var(--agibooks-green-light) !important;
	}
}

/* =================================
   LEGACY SIDEBAR SUPPORT
   ================================= */

/* Fallback for legacy sidebar (if still used in some pages) */
.layout-side-section,
.desk-sidebar {
	background-color: var(--agibooks-green) !important;
	color: var(--agibooks-white) !important;
}

/* =================================
   ENHANCED SIDEBAR STYLING
   ================================= */

/* Main sidebar container - all variations */
.body-sidebar-container,
.body-sidebar-container .body-sidebar,
.body-sidebar {
    background-color: var(--agibooks-green) !important;
    background: var(--agibooks-green) !important;
    border-right: 1px solid var(--agibooks-green-dark) !important;
}

/* Sidebar sections */
.body-sidebar-top,
.body-sidebar-bottom {
    background-color: var(--agibooks-green) !important;
    color: var(--agibooks-white) !important;
}

/* Sidebar items - SCOPED TO SIDEBAR ONLY */
.body-sidebar .standard-sidebar-item,
.body-sidebar .standard-sidebar-item .item-anchor,
.body-sidebar .standard-sidebar-item .sidebar-item-label,
.body-sidebar .sidebar-item-container,
.body-sidebar .sidebar-items,
.body-sidebar-container .standard-sidebar-item,
.body-sidebar-container .standard-sidebar-item .item-anchor,
.body-sidebar-container .standard-sidebar-item .sidebar-item-label,
.body-sidebar-container .sidebar-item-container {
    color: var(--agibooks-white) !important;
    background-color: transparent !important;
    background: transparent !important;
    text-decoration: none !important;
}

/* Sidebar item hover states - SCOPED TO SIDEBAR ONLY */
.body-sidebar .standard-sidebar-item:hover,
.body-sidebar .standard-sidebar-item .item-anchor:hover,
.body-sidebar .sidebar-item-container:hover,
.body-sidebar-container .standard-sidebar-item:hover,
.body-sidebar-container .standard-sidebar-item .item-anchor:hover,
.body-sidebar-container .sidebar-item-container:hover {
    background-color: var(--agibooks-green-light) !important;
    color: var(--agibooks-white) !important;
}

/* Sidebar icons - WHITE STROKE, GREEN FILL - SCOPED TO SIDEBAR ONLY */
.body-sidebar .standard-sidebar-item .sidebar-item-icon,
.body-sidebar .standard-sidebar-item .sidebar-item-icon svg,
.body-sidebar .standard-sidebar-item i,
.body-sidebar .collapse-sidebar-link,
.body-sidebar .collapse-sidebar-link svg,
.body-sidebar-container .standard-sidebar-item .sidebar-item-icon,
.body-sidebar-container .standard-sidebar-item .sidebar-item-icon svg,
.body-sidebar-container .standard-sidebar-item i,
.body-sidebar-container .collapse-sidebar-link,
.body-sidebar-container .collapse-sidebar-link svg {
    color: var(--agibooks-white) !important;
    fill: var(--agibooks-green) !important;
    stroke: var(--agibooks-white) !important;
    --icon-stroke: var(--agibooks-white) !important;
    --icon-fill: var(--agibooks-green) !important;
}

/* Sidebar icons on hover - maintain white stroke, slightly lighter green fill */
.body-sidebar .standard-sidebar-item:hover .sidebar-item-icon,
.body-sidebar .standard-sidebar-item:hover .sidebar-item-icon svg,
.body-sidebar .standard-sidebar-item .item-anchor:hover .sidebar-item-icon,
.body-sidebar .standard-sidebar-item .item-anchor:hover .sidebar-item-icon svg,
.body-sidebar-container .standard-sidebar-item:hover .sidebar-item-icon,
.body-sidebar-container .standard-sidebar-item:hover .sidebar-item-icon svg,
.body-sidebar-container .standard-sidebar-item .item-anchor:hover .sidebar-item-icon,
.body-sidebar-container .standard-sidebar-item .item-anchor:hover .sidebar-item-icon svg {
    fill: var(--agibooks-green-light) !important;
    stroke: var(--agibooks-white) !important;
    --icon-stroke: var(--agibooks-white) !important;
    --icon-fill: var(--agibooks-green-light) !important;
}

/* Sidebar active states */
.body-sidebar .standard-sidebar-item.active,
.body-sidebar .standard-sidebar-item.active-sidebar,
.body-sidebar .standard-sidebar-item.hover,
.body-sidebar-container .standard-sidebar-item.active,
.body-sidebar-container .standard-sidebar-item.active-sidebar,
.body-sidebar-container .standard-sidebar-item.hover {
    background-color: var(--agibooks-green-dark) !important;
    color: var(--agibooks-white) !important;
}

/* Sidebar active icons - white stroke, dark green fill */
.body-sidebar .standard-sidebar-item.active .sidebar-item-icon,
.body-sidebar .standard-sidebar-item.active .sidebar-item-icon svg,
.body-sidebar .standard-sidebar-item.active-sidebar .sidebar-item-icon,
.body-sidebar .standard-sidebar-item.active-sidebar .sidebar-item-icon svg,
.body-sidebar-container .standard-sidebar-item.active .sidebar-item-icon,
.body-sidebar-container .standard-sidebar-item.active .sidebar-item-icon svg,
.body-sidebar-container .standard-sidebar-item.active-sidebar .sidebar-item-icon,
.body-sidebar-container .standard-sidebar-item.active-sidebar .sidebar-item-icon svg {
    fill: var(--agibooks-green-dark) !important;
    stroke: var(--agibooks-white) !important;
    --icon-stroke: var(--agibooks-white) !important;
    --icon-fill: var(--agibooks-green-dark) !important;
}

/* Sidebar expanded state */
.body-sidebar-container.expanded .body-sidebar {
    background-color: var(--agibooks-green) !important;
    border-right: 1px solid var(--agibooks-green-dark) !important;
}

.body-sidebar-container.expanded .body-sidebar-placeholder {
    background-color: var(--agibooks-green) !important;
}

/* =================================
   SIDEBAR AND NAVBAR LINKS ONLY
   ================================= */

/* Theme links - ONLY affecting navbar and sidebar, NOT main content */
.navbar a,
.navbar-nav a,
.body-sidebar a,
.body-sidebar-container a,
.body-sidebar .standard-sidebar-item a,
.body-sidebar .sidebar-item-container a,
.body-sidebar-container .standard-sidebar-item a,
.body-sidebar-container .sidebar-item-container a {
    color: var(--agibooks-white) !important;
}

.navbar a:hover,
.navbar a:focus,
.navbar-nav a:hover,
.navbar-nav a:focus,
.body-sidebar a:hover,
.body-sidebar a:focus,
.body-sidebar-container a:hover,
.body-sidebar-container a:focus,
.body-sidebar .standard-sidebar-item a:hover,
.body-sidebar .standard-sidebar-item a:focus,
.body-sidebar .sidebar-item-container a:hover,
.body-sidebar .sidebar-item-container a:focus,
.body-sidebar-container .standard-sidebar-item a:hover,
.body-sidebar-container .standard-sidebar-item a:focus,
.body-sidebar-container .sidebar-item-container a:hover,
.body-sidebar-container .sidebar-item-container a:focus {
    color: var(--agibooks-white) !important;
    text-decoration: none !important;
}

/* =================================
   LEGACY SIDEBAR SUPPORT
   ================================= */

/* Legacy sidebar classes for backward compatibility */
.layout-side-section,
.desk-sidebar,
.sidebar-section {
    background-color: var(--agibooks-green) !important;
    color: var(--agibooks-white) !important;
}

.sidebar-section .sidebar-item,
.sidebar-section .sidebar-item a,
.sidebar-section .standard-sidebar-item,
.sidebar-section .standard-sidebar-item a {
    color: var(--agibooks-white) !important;
}

.sidebar-section .sidebar-item:hover,
.sidebar-section .sidebar-item a:hover,
.sidebar-section .standard-sidebar-item:hover,
.sidebar-section .standard-sidebar-item a:hover {
    background-color: var(--agibooks-green-light) !important;
    color: var(--agibooks-white) !important;
}

.sidebar-section .sidebar-item.selected,
.sidebar-section .sidebar-item.active,
.sidebar-section .standard-sidebar-item.selected,
.sidebar-section .standard-sidebar-item.active {
    background-color: var(--agibooks-green-dark) !important;
    color: var(--agibooks-white) !important;
}

/* Legacy sidebar icons - white stroke, green fill */
.sidebar-section .sidebar-item .icon,
.sidebar-section .standard-sidebar-item .icon,
.sidebar-section .sidebar-item i,
.sidebar-section .standard-sidebar-item i {
    color: var(--agibooks-white) !important;
    fill: var(--agibooks-green) !important;
    stroke: var(--agibooks-white) !important;
}

.sidebar-section .module-icon,
.sidebar-section .app-icon {
    filter: brightness(0) invert(1) !important;
}

.sidebar-section .sidebar-label,
.sidebar-section .standard-sidebar-label {
    color: var(--agibooks-text-muted) !important;
    font-weight: 600;
}

/* =================================
   RESPONSIVE DESIGN
   ================================= */

@media (max-width: 768px) {
    .body-sidebar-container,
    .body-sidebar {
        background-color: var(--agibooks-green) !important;
    }
    
    .body-sidebar .standard-sidebar-item {
        color: var(--agibooks-white) !important;
    }
    
    .sidebar-section {
        background-color: var(--agibooks-green) !important;
    }
    
    .sidebar-section .sidebar-item,
    .sidebar-section .standard-sidebar-item {
        color: var(--agibooks-white) !important;
    }
}

/* =================================
   HIGH SPECIFICITY OVERRIDES - SIDEBAR AND NAVBAR ONLY
   ================================= */

body .body-sidebar-container,
body .body-sidebar {
    background-color: var(--agibooks-green) !important;
}

body .body-sidebar .standard-sidebar-item,
body .body-sidebar-container .standard-sidebar-item {
    color: var(--agibooks-white) !important;
}

body .navbar,
body nav.navbar {
    background-color: var(--agibooks-green) !important;
}

/* =================================
   PERFORMANCE OPTIMIZATIONS
   ================================= */

/* Optimize repaints for sidebar animations */
.body-sidebar,
.body-sidebar-container,
.body-sidebar .standard-sidebar-item,
.body-sidebar-container .standard-sidebar-item {
    will-change: auto;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* =================================
   ADDITIONAL THEME FEATURES
   ================================= */

/* Loading states */
.body-sidebar .standard-sidebar-item.loading::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid var(--agibooks-text-muted);
    border-top: 2px solid var(--agibooks-white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* Custom scrollbar for sidebar */
.body-sidebar::-webkit-scrollbar {
    width: 6px;
}

.body-sidebar::-webkit-scrollbar-track {
    background: var(--agibooks-green-dark);
}

.body-sidebar::-webkit-scrollbar-thumb {
    background: var(--agibooks-green-light);
    border-radius: 3px;
}

.body-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--agibooks-green-lighter);
}

/* Theme toggle indicator (if needed) */
.agibooks-theme-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--agibooks-green);
    color: var(--agibooks-white);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.agibooks-theme-indicator.show {
    opacity: 1;
}

/* Print styles */
@media print {
    .body-sidebar,
    .body-sidebar-container,
    .navbar {
        background: white !important;
        color: black !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* =================================
   APP SWITCHER STYLING
   ================================= */

/* App switcher dropdown button in sidebar */
.body-sidebar .app-switcher-dropdown,
.body-sidebar-container .app-switcher-dropdown {
    background-color: transparent !important;
    color: var(--agibooks-white) !important;
    text-decoration: none !important;
}

/* App switcher dropdown button hover */
.body-sidebar .app-switcher-dropdown:hover,
.body-sidebar-container .app-switcher-dropdown:hover {
    background-color: var(--agibooks-green-light) !important;
    color: var(--agibooks-white) !important;
}

/* App switcher dropdown button active/expanded */
.body-sidebar .app-switcher-dropdown.active-sidebar,
.body-sidebar-container .app-switcher-dropdown.active-sidebar {
    background-color: var(--agibooks-green-dark) !important;
    color: var(--agibooks-white) !important;
}

/* App switcher standard sidebar item */
.body-sidebar .app-switcher-dropdown .standard-sidebar-item,
.body-sidebar-container .app-switcher-dropdown .standard-sidebar-item {
    color: var(--agibooks-white) !important;
    background-color: transparent !important;
}

/* App switcher item labels */
.body-sidebar .app-switcher-dropdown .sidebar-item-label,
.body-sidebar .app-switcher-dropdown .app-title,
.body-sidebar-container .app-switcher-dropdown .sidebar-item-label,
.body-sidebar-container .app-switcher-dropdown .app-title {
    color: var(--agibooks-white) !important;
}

/* App switcher dropdown arrow/icon */
.body-sidebar .app-switcher-dropdown .sidebar-item-control,
.body-sidebar .app-switcher-dropdown .drop-icon,
.body-sidebar-container .app-switcher-dropdown .sidebar-item-control,
.body-sidebar-container .app-switcher-dropdown .drop-icon {
    color: var(--agibooks-white) !important;
}

.body-sidebar .app-switcher-dropdown .sidebar-item-control svg,
.body-sidebar .app-switcher-dropdown .drop-icon svg,
.body-sidebar-container .app-switcher-dropdown .sidebar-item-control svg,
.body-sidebar-container .app-switcher-dropdown .drop-icon svg {
    fill: var(--agibooks-white) !important;
    stroke: var(--agibooks-white) !important;
    --icon-stroke: var(--agibooks-white) !important;
    --icon-fill: var(--agibooks-white) !important;
}

/* App switcher menu (dropdown) */
.app-switcher-menu {
    background-color: var(--agibooks-white) !important;
    border: 1px solid var(--agibooks-green) !important;
    box-shadow: 0 4px 12px rgba(10, 101, 34, 0.15) !important;
    border-radius: 8px !important;
}

/* App items in the switcher menu */
.app-switcher-menu .app-item {
    color: var(--agibooks-green) !important;
    background-color: transparent !important;
}

.app-switcher-menu .app-item a {
    color: var(--agibooks-green) !important;
    text-decoration: none !important;
}

.app-switcher-menu .app-item .app-item-title {
    color: var(--agibooks-green) !important;
}

/* App item hover states */
.app-switcher-menu .app-item:hover,
.app-switcher-menu .app-item:focus {
    background-color: var(--agibooks-green) !important;
    color: var(--agibooks-white) !important;
}

.app-switcher-menu .app-item:hover a,
.app-switcher-menu .app-item:focus a,
.app-switcher-menu .app-item:hover .app-item-title,
.app-switcher-menu .app-item:focus .app-item-title {
    color: var(--agibooks-white) !important;
}

/* Dividers in app switcher menu */
.app-switcher-menu .divider {
    border-top: 1px solid rgba(10, 101, 34, 0.15) !important;
    margin: 4px 0 !important;
}

/* App logos in switcher menu */
.app-switcher-menu .app-item .app-logo {
    opacity: 0.8;
}

.app-switcher-menu .app-item:hover .app-logo,
.app-switcher-menu .app-item:focus .app-logo {
    opacity: 1;
}

/* =================================
   END OF MAIN THEME CSS
   ================================= */

/* Financial Reports styling moved to separate file: agibooks_financial_reports.css */