/* Highly Detailed Calm Teal Theme - Next-Gen UI */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Precision Theme: "Sophisticated Midnight Navy & Gold" */
    --pro-primary: #1E293B;
    --pro-primary-hover: #0F172A;
    --pro-accent: #D97706;
    --pro-accent-light: #FEF3C7;
    --pro-bg: #FDFCFB;
    --pro-surface: #F3F4F6;
    --pro-border: #E5E7EB;
    --pro-border-soft: #F3F4F6;
    --pro-text-main: #0F172A;
    --pro-text-muted: #4B5563;

    /* Detailed Shadows & Elevations (Tinted to #1E293B RGB 30, 41, 59) */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-premium: 0 10px 25px -5px rgba(30, 41, 59, 0.08), 0 8px 10px -6px rgba(30, 41, 59, 0.04);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

/* Base Body Application */
body,
.desk-page {
    font-family: 'Inter', -apple-system, sans-serif !important;
    background-color: var(--pro-bg) !important;
    color: var(--pro-text-main) !important;
    letter-spacing: -0.01em;
}

/* Edge-to-Edge Full Width Responsive DOM Injection */
.container, .page-container {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
}

.row.layout-main {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.col-lg-2.layout-side-section {
    padding-left: 15px !important;
}

.desk-sidebar {
    padding-left: 12px !important;
}

.col.layout-main-section-wrapper {
    padding-left: 15px !important;
    padding-right: 15px !important;
}

/* =====================================================
   DYNAMIC NAVBAR BANNER THEME — Phase 3 CSS
   Background and text driven by CSS variables injected
   by theme_manager.js. Fall back to the original teal
   when no theme is active.
   ===================================================== */
.navbar,
body[data-route="desk"] .navbar {
    background: var(--dynamic-navbar-bg, #1E293B) !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-bottom: 1px solid rgba(30, 41, 59, 0.15) !important;
    box-shadow: var(--shadow-sm) !important;
    height: 64px !important;
    padding: 0 20px !important;
    transition: background 0.4s ease !important;
}

/* Detailed Brand Typography — dynamic text colour */
.navbar .navbar-brand,
.navbar .navbar-brand span,
.navbar-brand.navbar-home {
    font-weight: 700 !important;
    color: var(--dynamic-navbar-text, #FFFFFF) !important;
    letter-spacing: -0.03em !important;
    font-size: 20px !important;
}

.navbar .nav-link {
    color: var(--dynamic-navbar-text, #FFFFFF) !important;
    font-weight: 500 !important;
    transition: color 0.2s ease;
}

.navbar-search {
    background: #FFFFFF !important;
    border-radius: 8px !important;
    padding: 2px 12px !important;
    height: 38px !important;
    display: flex !important;
    align-items: center !important;
    width: 320px !important;
    margin: 0 15px !important;
}

.navbar-search input {
    background: transparent !important;
    border: none !important;
    color: #111827 !important;
    font-size: 14px !important;
    width: 100% !important;
    padding-left: 8px !important;
}

.navbar-search input::placeholder {
    color: #6B7280 !important;
}

.navbar-search .search-icon {
    color: #6B7280 !important;
    font-size: 14px !important;
}


.navbar .nav-link:hover {
    color: var(--pro-accent) !important;
}

/* Detailed Desk Sidebar */
.layout-side-section {
    position: sticky !important;
    top: 60px !important;
    height: calc(100vh - 60px) !important;
    overflow-y: auto !important;
    z-index: 10 !important;
    clip-path: none !important;
    background: linear-gradient(180deg, #FFFFFF 0%, #E5E7EB 100%) !important;
    background-attachment: scroll !important;
    border-right: 1px solid #E5E7EB !important;
    box-shadow: 12px 0 25px -4px rgba(30, 41, 59, 0.25) !important;
    padding-top: 20px !important;
    margin-left: 0 !important;
}

.sidebar-item-container {
    margin: 4px 16px !important;
    padding: 2px 0 !important;
    border-radius: var(--radius-md) !important;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    border: 1px solid transparent !important;
}

.sidebar-item-container:hover {
    background-color: #FFFFFF !important;
    border: 1px solid var(--pro-border) !important;
    box-shadow: 0 4px 6px -1px rgba(30, 41, 59, 0.05) !important;
    transform: translateX(4px) scale(1.02);
}

.sidebar-item-container.active {
    background: linear-gradient(135deg, var(--pro-primary) 0%, var(--pro-accent) 100%) !important;
    color: white !important;
    border: 1px solid var(--pro-primary-hover) !important;
    box-shadow: 0 6px 12px -2px rgba(217, 119, 6, 0.35) !important;
    transform: scale(1.02);
}

.sidebar-item-container.active * {
    color: white !important;
}

/* Premium Dashboard Widgets & Cards */
.widget-group,
.form-container,
.dashboard-widget-box,
.shortcut-widget-box,
.links-widget-box,
.onboarding-widget-box,
.grid-row-open {
    background: var(--pro-surface) !important;
    border: 1px solid var(--pro-border) !important;
    border-top: 3px solid var(--pro-primary) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: 0 8px 16px -4px rgba(30, 41, 59, 0.06), 0 4px 6px -2px rgba(30, 41, 59, 0.03) !important;
    padding: 24px !important;
    margin-bottom: 24px !important;
    transition: box-shadow 0.3s ease, transform 0.3s ease !important;
}

.widget-group:hover,
.dashboard-widget-box:hover,
.shortcut-widget-box:hover,
.links-widget-box:hover,
.onboarding-widget-box:hover {
    box-shadow: 0 16px 24px -6px rgba(30, 41, 59, 0.1), 0 8px 10px -4px rgba(30, 41, 59, 0.05) !important;
    transform: translateY(-3px);
}

/* Detailed Headers within Cards */
.widget-title,
.form-section-heading {
    font-weight: 600 !important;
    color: var(--pro-text-main) !important;
    border-bottom: 2px solid var(--pro-accent-light) !important;
    padding-bottom: 10px !important;
    margin-bottom: 16px !important;
    font-size: 15px !important;
}

/* Beautiful Data Tables */
.grid-row {
    border-bottom: 1px solid var(--pro-border-soft) !important;
    transition: background-color 0.15s ease !important;
}

.grid-row:hover {
    background-color: var(--pro-accent-light) !important;
}

.grid-heading-row {
    background-color: var(--pro-bg) !important;
    border-top: 1px solid var(--pro-border) !important;
    border-bottom: 1px solid var(--pro-border) !important;
    font-weight: 600 !important;
    color: var(--pro-text-muted) !important;
    text-transform: uppercase !important;
    font-size: 11px !important;
    letter-spacing: 0.08em !important;
}

/* Interactive Refined Form Controls */
.form-control,
.input-with-feedback {
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--pro-border) !important;
    background-color: #ffffff !important;
    transition: all 0.2s ease !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.01) !important;
    color: var(--pro-text-main) !important;
    font-weight: 500 !important;
    height: 37px !important;
}

.form-control:focus {
    border-color: var(--pro-accent) !important;
    box-shadow: 0 0 0 4px rgba(0, 153, 163, 0.15) !important;
    outline: none !important;
}

/* Crisp Action Buttons */
.btn {
    border-radius: var(--radius-sm) !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em !important;
    transition: all 0.2s ease !important;
    padding: 8px 16px !important;
    text-transform: none !important;
}

.btn-primary {
    background-color: var(--pro-primary) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 4px 6px -1px rgba(30, 41, 59, 0.2) !important;
}

.btn-primary:hover {
    background-color: var(--pro-primary-hover) !important;
    box-shadow: 0 6px 12px -2px rgba(30, 41, 59, 0.3) !important;
    transform: translateY(-1px) !important;
}

.btn-default {
    background-color: white !important;
    border: 1px solid var(--pro-border) !important;
    color: var(--pro-text-main) !important;
    box-shadow: var(--shadow-sm) !important;
}

.btn-default:hover {
    background-color: var(--pro-bg) !important;
    border-color: var(--pro-accent) !important;
}

/* Refined Indicator Pills */
.indicator-pill {
    font-weight: 600 !important;
    border-radius: 20px !important;
    padding: 4px 12px !important;
    font-size: 11px !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: var(--shadow-sm);
}

/* Page Title Typography — dynamic text colour */
.page-title h3,
.navbar-breadcrumb h3,
.breadcrumb-container h3 {
    font-weight: 700 !important;
    color: var(--dynamic-navbar-text, #FFFFFF) !important;
    font-size: 24px !important;
    letter-spacing: -0.03em !important;
}

/* Notification Bell Icon — dynamic text colour */
.navbar .notifications-icon,
.navbar .notifications-icon svg,
.navbar .notifications-icon .icon,
.navbar .notifications-icon.text-muted,
.navbar .notifications-icon .frappe-icon {
    color: var(--dynamic-navbar-text, #FFFFFF) !important;
    fill: var(--dynamic-navbar-text, #FFFFFF) !important;
    stroke: var(--dynamic-navbar-text, #FFFFFF) !important;
    opacity: 1 !important;
}

/* Navbar Breadcrumbs (Path Text) — dynamic text colour */
#navbar-breadcrumbs li a,
.navbar-breadcrumbs li a,
.navbar .breadcrumb a {
    color: var(--dynamic-navbar-text, #FFFFFF) !important;
    font-weight: 500 !important;
    transition: color 0.2s ease !important;
    text-decoration: none !important;
}

#navbar-breadcrumbs li a:hover,
.navbar-breadcrumbs li a:hover,
.navbar .breadcrumb a:hover {
    color: var(--pro-accent) !important;
}

#navbar-breadcrumbs li:last-child a,
#navbar-breadcrumbs li:last-child span,
.navbar-breadcrumbs li:last-child span,
.navbar-breadcrumbs li:last-child a,
.navbar .breadcrumb li:last-child span,
.navbar .breadcrumb li:last-child a {
    color: #FFFFFF !important; /* White for the active/last item */
    font-weight: 600 !important;
    opacity: 1 !important;
}


/* =====================================================
   BREADCRUMB SEPARATOR - EXACT FIX
   DOM confirmed: <ul id="navbar-breadcrumbs"><li>...</li><li>...</li>
   Separator is a CSS pseudo-element: li + li::before  (no SVG, no HTML element)
   Frappe's desk.bundle.css sets color: rgb(82,82,82) on this pseudo-element.
   We beat it with max specificity using the full selector chain.
   ===================================================== */

/* Force the breadcrumb list items (and their pseudo-elements) to white */
ul#navbar-breadcrumbs > li + li::before,
ul.nav#navbar-breadcrumbs li + li::before,
.navbar ul#navbar-breadcrumbs li + li::before {
    color: #FFFFFF !important;
    opacity: 1 !important;
    filter: none !important;
}

/* Fallback: force ALL pseudo-elements in the breadcrumb to white */
ul#navbar-breadcrumbs li::before,
ul#navbar-breadcrumbs li::after {
    color: #FFFFFF !important;
    opacity: 1 !important;
}

/* Also target breadcrumb SVG separators (some Frappe versions use SVG) */
ul#navbar-breadcrumbs svg,
ul#navbar-breadcrumbs .breadcrumb-separator,
ul#navbar-breadcrumbs .breadcrumb-separator svg,
ul#navbar-breadcrumbs .breadcrumb-separator svg * {
    fill: #FFFFFF !important;
    stroke: #FFFFFF !important;
    color: #FFFFFF !important;
    filter: brightness(0) invert(1) !important;
    opacity: 1 !important;
}

/* Last item text - White */
ul#navbar-breadcrumbs li:last-child > a,
ul#navbar-breadcrumbs li:last-child > span {
    color: #FFFFFF !important;
}

/* Anchor link colors in breadcrumb - Muted */
ul#navbar-breadcrumbs li > a {
    color: #A38181 !important;
}






/* Navbar Brand Icon Box */
.navbar-brand .app-logo,
.navbar-brand .frappe-icon {
    background: #111827 !important;
    padding: 6px !important;
    border-radius: 6px !important;
    margin-right: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}


/* Fix Dropdown Clickability & Layering */
.dropdown-menu {
    z-index: 20000 !important;
    pointer-events: auto !important;
}

.navbar {
    z-index: 10001 !important;
    pointer-events: auto !important;
}

/* User Avatar Refinement */
.navbar .avatar-frame {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: #FEF3C7 !important; /* Creamy Yellow */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid rgba(0,0,0,0.05) !important;
}

.navbar .avatar-frame .standard-image {
    color: #D97706 !important; /* Golden Brown */
    font-weight: 700 !important;
    font-size: 13px !important;
}

/* Notification Dot */
.navbar .notifications-icon {
    position: relative !important;
}

.navbar .notifications-icon::after {
    content: '' !important;
    position: absolute !important;
    top: 2px !important;
    right: 2px !important;
    width: 8px !important;
    height: 8px !important;
    background: #10B981 !important;
    border-radius: 50% !important;
    border: 2px solid var(--dynamic-navbar-bg, #1E293B) !important;
}

/* Login Page Icon Fixes */
.for-login .page-card .page-card-body .field-icon, 
.for-forgot .page-card .page-card-body .field-icon, 
.for-login-with-email-link .page-card .page-card-body .field-icon, 
.for-signup .page-card .page-card-body .field-icon, 
.for-email-login .page-card .page-card-body .field-icon {
    left: 9px;
    top: 5px;
    position: absolute;
    margin-top: 5px !important;
    z-index: 2;
}


/* =====================================================================
   DYNAMIC NAVBAR THEME — Dialog Thumbnail Grid
   Theme selector grid shown inside frappe.ui.Dialog
   ===================================================================== */

#navbar-theme-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    padding: 8px 4px 16px;
}

.navbar-theme-card {
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.22s ease,
                border-color 0.18s ease;
    background: #f8fafc;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    position: relative;
}

.navbar-theme-card:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 10px 24px -4px rgba(30, 41, 59, 0.20),
                0 4px 8px -2px rgba(30, 41, 59, 0.10);
    border-color: var(--pro-accent, #D97706);
}

.navbar-theme-card.selected {
    border-color: var(--pro-primary, #1E293B);
    box-shadow: 0 0 0 3px rgba(30, 41, 59, 0.25),
                0 10px 24px -4px rgba(30, 41, 59, 0.22);
    transform: translateY(-2px) scale(1.02);
}

/* The large preview area (shows the actual background image) */
.theme-card-preview {
    width: 100%;
    height: 90px;
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: flex-end;
    padding: 6px 8px;
}

/* Mini fake navbar bar inside the preview card */
.theme-card-mini-navbar {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 4px;
    padding: 3px 7px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    line-height: 1;
}

/* Green checkmark badge when selected */
.theme-check-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    background: var(--pro-primary, #1E293B);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(30, 41, 59, 0.4);
    animation: badge-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes badge-pop {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* Card label text below preview */
.theme-card-label {
    padding: 8px 10px 9px;
    font-size: 12px;
    font-weight: 600;
    color: var(--pro-text-main, #203535);
    text-align: center;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-top: 1px solid rgba(30, 41, 59, 0.08);
    background: #ffffff;
}

/* Dialog size override — make sure the grid has breathing room */
.modal-dialog .modal-body {
    padding: 20px !important;
}
