/* GraceERP Solution theme
 * Navy primary, globe-blue accents, gold highlights (sampled from the logo),
 * soft grey canvas, white rounded cards. Light mode only; dark mode keeps the
 * default palette (logos switch to their light versions).
 * Colors are defined once here: change the --grace-* values to rebrand.
 */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap");

:root {
	--grace-primary: #0f2f6e; /* navy */
	--grace-primary-hover: #0a2252;
	--grace-primary-tint: #eaf1fb;
	--grace-accent: #3070c8; /* globe blue */
	--grace-gold: #b88020;
	--grace-canvas: #f4f5f7;
	--grace-success-bg: #e8f7ee;
	--grace-success-fg: #1f9254;
	--grace-danger-bg: #fdecef;
	--grace-danger-fg: #c0364f;
	--grace-radius-card: 16px;
	--grace-radius-control: 10px;
	--grace-card-shadow: 0 1px 2px rgba(15, 47, 110, 0.05), 0 4px 16px rgba(15, 47, 110, 0.05);
}

[data-theme="light"] {
	--primary: var(--grace-primary);
	--primary-color: var(--grace-primary);
	--btn-primary: var(--grace-primary);
	--bg-color: var(--grace-canvas);
	--sidebar-select-color: var(--grace-primary-tint);
	--border-radius-lg: var(--grace-radius-card);
	--border-radius-xl: 20px;
	--border-radius-md: var(--grace-radius-control);
	--card-shadow: var(--grace-card-shadow);
}

/* Arabic: same layout, Arabic-friendly font */
[dir="rtl"] body,
[dir="rtl"] {
	--font-stack: "IBM Plex Sans Arabic", "InterVariable", "Inter", system-ui, sans-serif;
	font-family: var(--font-stack);
}

/* ---------- Canvas & cards ---------- */
[data-theme="light"] body,
[data-theme="light"] .page-container,
[data-theme="light"] .layout-main-section-wrapper {
	background-color: var(--grace-canvas);
}

[data-theme="light"] .frappe-card,
[data-theme="light"] .widget,
[data-theme="light"] .number-widget-box,
[data-theme="light"] .dashboard-widget-box,
[data-theme="light"] .layout-main-section,
[data-theme="light"] .form-page,
[data-theme="light"] .report-wrapper {
	background-color: #fff;
	border-radius: var(--grace-radius-card);
	border-color: transparent;
	box-shadow: var(--grace-card-shadow);
}

[data-theme="light"] .widget .widget-head .widget-title,
[data-theme="light"] .number-widget-box .widget-title {
	font-weight: 600;
	color: var(--heading-color);
}

/* ---------- Buttons ---------- */
[data-theme="light"] .btn-primary,
[data-theme="light"] .btn.btn-primary {
	background-color: var(--grace-primary);
	border-color: var(--grace-primary);
	color: #fff;
	border-radius: var(--grace-radius-control);
}

[data-theme="light"] .btn-primary:hover,
[data-theme="light"] .btn-primary:focus,
[data-theme="light"] .btn-primary:active {
	background-color: var(--grace-primary-hover);
	border-color: var(--grace-primary-hover);
	color: #fff;
}

/* New-style (v16) buttons: navy for the default theme; red/other themes untouched */
html:not([data-theme="dark"]) .es-button:not([data-theme]) {
	--bt-solid-bg: var(--grace-primary);
	--bt-solid-bg-hover: var(--grace-primary-hover);
	--bt-solid-bg-active: var(--grace-primary-hover);
}

[data-theme="light"] .btn-default,
[data-theme="light"] .btn-secondary {
	border-radius: var(--grace-radius-control);
}

/* ---------- Sidebar: active item is solid navy ---------- */
[data-theme="light"] .body-sidebar {
	background-color: #fff;
}

[data-theme="light"] .body-sidebar .standard-sidebar-item.active-sidebar {
	background-color: var(--grace-primary);
	border-radius: var(--grace-radius-control);
}

[data-theme="light"] .body-sidebar .standard-sidebar-item.active-sidebar .item-anchor,
[data-theme="light"] .body-sidebar .standard-sidebar-item.active-sidebar .sidebar-item-label,
[data-theme="light"] .body-sidebar .standard-sidebar-item.active-sidebar .sidebar-item-icon,
[data-theme="light"] .body-sidebar .standard-sidebar-item.active-sidebar .sidebar-item-control {
	color: #fff;
	--icon-stroke: #fff;
}

/* ---------- Inputs & search ---------- */
[data-theme="light"] .form-control,
[data-theme="light"] .search-bar .form-control,
[data-theme="light"] .awesomplete input {
	border-radius: var(--grace-radius-control);
}

/* ---------- Status pills (Paid / Unpaid / Overdue ...) ---------- */
[data-theme="light"] .indicator-pill,
[data-theme="light"] .badge {
	border-radius: 999px;
	font-weight: 500;
}

[data-theme="light"] .indicator-pill.green {
	background-color: var(--grace-success-bg);
	color: var(--grace-success-fg);
}

[data-theme="light"] .indicator-pill.red {
	background-color: var(--grace-danger-bg);
	color: var(--grace-danger-fg);
}

/* ---------- List & report tables ---------- */
[data-theme="light"] .list-row-head,
[data-theme="light"] .dt-row-header {
	background-color: #fafafb;
	color: var(--text-muted);
	font-weight: 500;
}

[data-theme="light"] .list-row-container .list-row:hover,
[data-theme="light"] .dt-row:hover {
	background-color: var(--grace-primary-tint);
}

/* ---------- Charts: globe-blue series ---------- */
[data-theme="light"] .frappe-chart .line-graph-path,
[data-theme="light"] .frappe-chart path.line {
	stroke: var(--grace-accent);
}

/* ---------- Links and focus: globe blue ---------- */
[data-theme="light"] a:not(.btn):not(.item-anchor):not(.dropdown-item):hover {
	color: var(--grace-accent);
}

[data-theme="light"] .form-control:focus {
	border-color: var(--grace-accent);
	box-shadow: 0 0 0 2px rgba(48, 112, 200, 0.18);
}

/* ---------- Login page ---------- */
.page-card,
.login-content.page-card {
	border-radius: 20px;
	box-shadow: var(--grace-card-shadow);
}

.for-login .btn-primary,
.for-signup .btn-primary,
.for-forgot .btn-primary {
	background-color: var(--grace-primary);
	border-color: var(--grace-primary);
}

/* ---------- Upstream tutorial videos in onboarding panels ---------- */
.onboarding-step-media:has(.onboarding-video),
.onboarding-video {
	display: none !important;
}

/* ---------- Replace upstream logos wherever they still appear ---------- */
img[src*="/assets/erpnext/images/erpnext-logo"],
img[src*="/assets/frappe/images/frappe-logo"],
img[src*="/assets/frappe/images/frappe-favicon"] {
	content: url("/assets/grace_accounting/images/grace-logo.svg");
}

img[src*="/assets/hrms/images/frappe-hr-logo"] {
	content: url("/assets/grace_accounting/images/grace-hr-logo.svg");
}

img[src*="/assets/frappe/images/frappe-framework-logo"],
img[src*="/assets/frappe/images/frappe-comp-logo"],
img[src*="/assets/frappe/images/frappe-wordmark"] {
	content: url("/assets/grace_accounting/images/grace-wordmark.svg");
}

/* Arabic (RTL): hidden off-screen helper elements (left: -9999px) otherwise
   stretch the page sideways and add a long horizontal scrollbar. */
html[dir="rtl"],
html[dir="rtl"] body {
	overflow-x: clip;
}

/* ---------- Logo: the animated globe ----------
 * The globe floats and rotates inside its own SVG (and stops for users who
 * prefer reduced motion). Give it a little more room on the login page. */
.login-content .page-card-head img.app-logo,
.page-card .page-card-head img.app-logo {
	width: 76px;
	height: 76px;
	max-height: none;
}

/* Dark mode: wordmark with light text */
[data-theme="dark"] img[src*="/assets/grace_accounting/images/grace-wordmark.svg"] {
	content: url("/assets/grace_accounting/images/grace-wordmark-light.svg");
}
