/* ═══════════════════════════════════════════════════════════════════════════
   GetJustly — Frappe v15 CSS overrides
   Petite B/W design system. No core files touched.
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ─────────────────────────────────────────────────────────────────────────
   1. BRAND TOKENS — Light Mode (B/W)
   ───────────────────────────────────────────────────────────────────────── */

:root,
[data-theme="light"] {
    /* ── Typography ── */
    --font-stack: "Inter", -apple-system, BlinkMacSystemFont,
        "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue",
        Arial, sans-serif;
    --weight-regular: 400;

    /* ── Primary — neutral black ── */
    --btn-primary: #171717;
    --primary-color: #171717;
    --brand-color: #171717;
    --border-primary: #171717;

    /* ── Focus rings ── */
    --focus-default: 0 0 0 2px rgba(23, 23, 23, 0.15);

    /* ── Checkbox & progress ── */
    --checkbox-gradient: linear-gradient(180deg, #171717 0%, #262626 100%);
    --progress-bar-bg: #171717;

    /* ── App tokens ── */
    --gj-primary: #171717;
    --gj-primary-hover: #262626;
    --gj-primary-active: #404040;
    --gj-primary-subtle: rgba(23, 23, 23, 0.04);
    --gj-primary-light: #525252;
    --gj-transition-fast: 0.12s ease;
    --gj-transition: 0.18s ease;
    --gj-transition-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    /* ── Shadows ── */
    --shadow-base: 0 0 0 1px rgba(0, 0, 0, 0.04),
                   0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 0 0 1px rgba(0, 0, 0, 0.03),
                 0 2px 4px rgba(0, 0, 0, 0.04),
                 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 0 0 1px rgba(0, 0, 0, 0.03),
                 0 4px 8px -2px rgba(0, 0, 0, 0.06),
                 0 8px 24px -4px rgba(0, 0, 0, 0.08);
    --shadow-2xl: 0 0 0 1px rgba(0, 0, 0, 0.04),
                  0 8px 16px -4px rgba(0, 0, 0, 0.08),
                  0 16px 40px -8px rgba(0, 0, 0, 0.12);

    /* ── Sidebar ── */
    --sidebar-select-color: var(--gj-primary-subtle);
}


/* ─────────────────────────────────────────────────────────────────────────
   2. BRAND TOKENS — Dark Mode (B/W)
   ───────────────────────────────────────────────────────────────────────── */

[data-theme="dark"] {
    /* ── Primary — near-white ── */
    --btn-primary: #f5f5f5;
    --primary-color: #f5f5f5;
    --brand-color: #f5f5f5;
    --border-primary: #f5f5f5;

    /* ── Focus rings ── */
    --focus-default: 0 0 0 2px rgba(245, 245, 245, 0.2);

    /* ── Checkbox & Progress ── */
    --checkbox-gradient: linear-gradient(180deg, #e5e5e5 0%, #f5f5f5 100%);
    --progress-bar-bg: #f5f5f5;

    /* ── App tokens ── */
    --gj-primary: #f5f5f5;
    --gj-primary-hover: #e5e5e5;
    --gj-primary-active: #d4d4d4;
    --gj-primary-subtle: rgba(245, 245, 245, 0.06);
    --gj-primary-light: #a3a3a3;

    /* ── Shadows ── */
    --shadow-base: 0 0 0 1px rgba(255, 255, 255, 0.04),
                   0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 0 0 1px rgba(255, 255, 255, 0.04),
                 0 2px 4px rgba(0, 0, 0, 0.15),
                 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.04),
                 0 4px 8px -2px rgba(0, 0, 0, 0.2),
                 0 8px 24px -4px rgba(0, 0, 0, 0.25);

    /* ── Sidebar ── */
    --sidebar-select-color: var(--gj-primary-subtle);
}


/* ─────────────────────────────────────────────────────────────────────────
   3. GLOBAL POLISH
   ───────────────────────────────────────────────────────────────────────── */

body {
    font-family: var(--font-stack);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    letter-spacing: -0.003em;
}

::selection {
    background: rgba(23, 23, 23, 0.1);
    color: inherit;
}
[data-theme="dark"] ::selection {
    background: rgba(245, 245, 245, 0.15);
}

h1, h2, h3, .h1, .h2, .h3 {
    letter-spacing: -0.02em;
    font-weight: 500;
}
h4, h5, h6, .h4, .h5, .h6 {
    letter-spacing: -0.01em;
    font-weight: 500;
}


/* ─────────────────────────────────────────────────────────────────────────
   4. TRANSITIONS
   ───────────────────────────────────────────────────────────────────────── */

.btn {
    transition: background-color var(--gj-transition-fast),
                box-shadow var(--gj-transition-fast),
                color var(--gj-transition-fast),
                transform 0.1s ease !important;
}

.form-control {
    transition: box-shadow var(--gj-transition),
                border-color var(--gj-transition),
                background-color var(--gj-transition) !important;
}

.standard-sidebar-item {
    transition: background-color var(--gj-transition-fast),
                color var(--gj-transition-fast) !important;
}

.dropdown-item {
    transition: background-color 0.08s ease,
                color 0.08s ease !important;
}

.list-row {
    transition: background-color var(--gj-transition-fast) !important;
}

.widget {
    transition: box-shadow var(--gj-transition-smooth),
                transform var(--gj-transition-smooth) !important;
}

.frappe-card,
.layout-main-section.frappe-card {
    transition: box-shadow var(--gj-transition-smooth) !important;
}

a {
    transition: color var(--gj-transition-fast);
}

.nav-link {
    transition: color var(--gj-transition-fast),
                border-color var(--gj-transition) !important;
}


/* ─────────────────────────────────────────────────────────────────────────
   5. BUTTONS (B/W)
   ───────────────────────────────────────────────────────────────────────── */

.btn.btn-primary {
    background: #171717;
    border: none;
    color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.btn.btn-primary:hover {
    background: #262626;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18),
                inset 0 1px 0 rgba(255, 255, 255, 0.06);
    color: #fff !important;
    transform: translateY(-0.5px);
}

.btn.btn-primary:active,
.btn.btn-primary:active:focus {
    background: #404040 !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2) !important;
    color: #fff !important;
    transform: translateY(0);
}

.btn.btn-primary:focus-visible {
    box-shadow: 0 0 0 3px rgba(23, 23, 23, 0.2) !important;
}

/* ── Dark mode ── */
[data-theme="dark"] .btn.btn-primary {
    background: #f5f5f5;
    color: #171717;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .btn.btn-primary:hover {
    background: #e5e5e5;
    color: #171717 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .btn.btn-primary:active,
[data-theme="dark"] .btn.btn-primary:active:focus {
    background: #d4d4d4 !important;
    color: #171717 !important;
}

/* ── Secondary buttons ── */
.btn.btn-default:hover,
.btn.btn-secondary:hover {
    transform: translateY(-0.5px);
}

.btn.btn-default:active,
.btn.btn-secondary:active {
    transform: translateY(0);
}

.btn-primary-light {
    color: var(--gj-primary) !important;
}
.btn-primary-light:hover,
.btn-primary-light:active {
    color: var(--gj-primary) !important;
}


/* ─────────────────────────────────────────────────────────────────────────
   6. FORM CONTROLS
   ───────────────────────────────────────────────────────────────────────── */

.form-control:focus {
    box-shadow: var(--focus-default) !important;
    border-color: var(--gj-primary) !important;
    background-color: var(--control-bg);
}

.form-control:hover:not(:focus):not(:disabled):not([readonly]) {
    box-shadow: 0 0 0 1px var(--border-color);
}

input[type="checkbox"]:checked {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 8 7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 4.00001L2.66667 5.80001L7 1.20001' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
        var(--checkbox-gradient) !important;
}

.custom-control-input:checked ~ .custom-control-label::before {
    background: var(--gj-primary) !important;
    border-color: var(--gj-primary) !important;
}

.custom-control-label::before {
    transition: background-color var(--gj-transition),
                border-color var(--gj-transition) !important;
}
.custom-control-label::after {
    transition: transform var(--gj-transition) !important;
}

.frappe-control .link-btn {
    transition: opacity var(--gj-transition-fast);
}

/* Control labels */
.frappe-control .control-label, .frappe-control label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}


/* ─────────────────────────────────────────────────────────────────────────
   7. FORM TABS
   ───────────────────────────────────────────────────────────────────────── */

.form-tabs .nav-link.active {
    border-bottom: 2px solid var(--gj-primary) !important;
    color: var(--text-color) !important;
    font-weight: 600;
    margin-bottom: -1px;
}

.form-tabs .nav-link:hover:not(.active) {
    color: var(--text-color);
    background-color: var(--gj-primary-subtle);
    border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
}

[data-theme="dark"] .form-tabs .nav-link.active {
    border-bottom-color: var(--gj-primary) !important;
}


/* ─────────────────────────────────────────────────────────────────────────
   8. AWESOMEBAR
   ───────────────────────────────────────────────────────────────────────── */

.search-bar .awesomplete input:focus {
    box-shadow: var(--shadow-lg) !important;
}


/* ─────────────────────────────────────────────────────────────────────────
   9. SIDEBAR
   ───────────────────────────────────────────────────────────────────────── */

.standard-sidebar-item:hover:not(.selected) {
    background-color: var(--subtle-fg);
}

.sidebar-action {
    color: var(--gj-primary) !important;
}

.standard-sidebar-item > a {
    color: var(--text-muted) !important;
    transition: color var(--gj-transition-fast),
                background-color var(--gj-transition-fast);
}
.standard-sidebar-item:hover > a {
    color: var(--text-color) !important;
}

.standard-sidebar-item.selected {
    background: var(--gj-primary-subtle) !important;
    border-left: 2px solid var(--gj-primary) !important;
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
}
.standard-sidebar-item.selected > a {
    color: var(--gj-primary) !important;
    font-weight: 600 !important;
}


/* ─────────────────────────────────────────────────────────────────────────
   10. LIST VIEW
   ───────────────────────────────────────────────────────────────────────── */

.list-row:hover:not(.list-row-head) {
    background-color: var(--gj-primary-subtle);
}

.like-active-item .like-action {
    color: var(--gj-primary);
}


/* ─────────────────────────────────────────────────────────────────────────
   11. MODALS & DIALOGS
   ───────────────────────────────────────────────────────────────────────── */

.modal-backdrop.show {
    opacity: 0.5;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal .modal-content {
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: var(--shadow-2xl);
    border-radius: var(--border-radius-lg);
}

[data-theme="dark"] .modal .modal-content {
    border-color: rgba(255, 255, 255, 0.06);
}

.modal .modal-header {
    border-bottom-color: var(--border-color);
}

.modal .modal-footer {
    border-top-color: var(--border-color);
}


/* ─────────────────────────────────────────────────────────────────────────
   12. WORKSPACE WIDGETS
   ───────────────────────────────────────────────────────────────────────── */

.widget-group {
    margin-bottom: 28px !important;
}

.widget-group-title {
    font-size: 17px !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em;
    color: var(--heading-color) !important;
    margin-bottom: 14px !important;
}

.widget.quick-list-widget-box .quick-list-item:hover {
    background-color: var(--gj-primary-subtle);
}

.widget.links-widget-box {
    padding: 14px 16px !important;
}
.widget.links-widget-box .widget-head .widget-label .widget-title {
    font-size: 15px !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em;
}

/* ── Shortcut cards ── */
.widget.shortcut-widget-box {
    border-radius: 12px !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: none !important;
    padding: 10px 14px !important;
    min-height: 44px !important;
    transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.18s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.18s ease !important;
}
.widget.shortcut-widget-box:hover {
    transform: translateY(-2px) !important;
    box-shadow: var(--shadow-lg) !important;
    border-color: var(--gj-primary) !important;
}
.widget.shortcut-widget-box .widget-title {
    font-size: 13.5px !important;
    font-weight: 600 !important;
}

/* ── Number cards ── */
.widget.number-widget-box {
    border-radius: 14px !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: none !important;
    min-height: 120px !important;
    padding: 20px 22px !important;
    transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.18s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.widget.number-widget-box:hover {
    transform: translateY(-2px) !important;
    box-shadow: var(--shadow-lg) !important;
}
.widget.number-widget-box .widget-head .widget-title {
    font-size: 11.5px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    color: var(--text-muted) !important;
}
.number-widget .number {
    font-size: 36px !important;
    font-weight: 700 !important;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.025em;
    line-height: 1.1 !important;
}
.number-widget .widget-content {
    padding-top: 10px !important;
}


/* ─────────────────────────────────────────────────────────────────────────
   13. TOASTS
   ───────────────────────────────────────────────────────────────────────── */

.desk-alert {
    border-radius: var(--border-radius-lg) !important;
    box-shadow: var(--shadow-2xl) !important;
    border: 1px solid rgba(0, 0, 0, 0.04);
    animation-duration: 400ms !important;
}

[data-theme="dark"] .desk-alert {
    border-color: rgba(255, 255, 255, 0.06);
}


/* ─────────────────────────────────────────────────────────────────────────
   14. SCROLLBAR
   ───────────────────────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 100px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.2); }

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}


/* ─────────────────────────────────────────────────────────────────────────
   15. DROPDOWN MENUS
   ───────────────────────────────────────────────────────────────────────── */

.dropdown-menu {
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: var(--shadow-2xl) !important;
    border-radius: var(--border-radius-md) !important;
    animation: gj-dropdown-in 0.15s ease;
}

[data-theme="dark"] .dropdown-menu {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

.dropdown-item:active {
    background-color: var(--gj-primary) !important;
    color: #fff !important;
}

@keyframes gj-dropdown-in {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* ─────────────────────────────────────────────────────────────────────────
   16. POPOVER
   ───────────────────────────────────────────────────────────────────────── */

.popover {
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: var(--shadow-2xl) !important;
    border-radius: var(--border-radius-lg) !important;
}

[data-theme="dark"] .popover {
    border-color: rgba(255, 255, 255, 0.06) !important;
}


/* ─────────────────────────────────────────────────────────────────────────
   17. PROGRESS BARS
   ───────────────────────────────────────────────────────────────────────── */

.progress-bar {
    transition: width var(--gj-transition-smooth) !important;
}

.progress {
    border-radius: var(--border-radius-full);
    overflow: hidden;
}


/* ─────────────────────────────────────────────────────────────────────────
   18. FORM CARD & SECTIONS
   ───────────────────────────────────────────────────────────────────────── */

.std-form-layout > .form-layout > .form-page {
    box-shadow: none;
    border: 1px solid var(--border-color);
}

.inline-graph-bar-inner.dark {
    background-color: var(--gj-primary) !important;
}

.document-link .badge-link:hover,
.document-link .report-link:hover {
    color: var(--gj-primary);
}

.form-section,
.section-body {
    border-radius: 8px !important;
}

.modal-content {
    border-radius: 14px !important;
}


/* ─────────────────────────────────────────────────────────────────────────
   19. CHILD TABLE GRID
   ───────────────────────────────────────────────────────────────────────── */

.form-grid {
    border-color: var(--border-color);
}

.grid-heading-row {
    border-bottom-color: var(--border-color);
}

.editable-row .form-control:focus {
    box-shadow: inset 0 0 0 1px var(--gj-primary) !important;
    border-color: var(--gj-primary) !important;
}


/* ─────────────────────────────────────────────────────────────────────────
   20. NAVBAR
   ───────────────────────────────────────────────────────────────────────── */

.navbar {
    background: rgba(255, 255, 255, 0.82) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

[data-theme="dark"] .navbar {
    background: rgba(30, 30, 30, 0.82) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

.navbar .navbar-brand img,
.navbar .app-logo {
    filter: none;
}

/* Dark mode: invert the B/W logo */
[data-theme="dark"] .navbar .navbar-brand img,
[data-theme="dark"] .navbar .app-logo {
    filter: invert(1);
}

.navbar .badge {
    background: #171717 !important;
    color: #fff !important;
    font-weight: 600;
}
[data-theme="dark"] .navbar .badge {
    background: #f5f5f5 !important;
    color: #171717 !important;
}

.navbar .avatar-frame,
.navbar .avatar {
    border: none !important;
    transition: opacity var(--gj-transition-fast);
}
.navbar .avatar-frame:hover,
.navbar .avatar:hover {
    opacity: 0.8;
}

[data-theme="dark"] .navbar .avatar-frame,
[data-theme="dark"] .navbar .avatar {
    border: none !important;
}


/* ─────────────────────────────────────────────────────────────────────────
   21. THEME SWITCHER
   ───────────────────────────────────────────────────────────────────────── */

.theme-mode.active {
    border-color: var(--gj-primary);
    box-shadow: 0 0 0 2px var(--gj-primary-subtle);
}


/* ─────────────────────────────────────────────────────────────────────────
   22. INDICATOR PILLS
   ───────────────────────────────────────────────────────────────────────── */

.indicator-pill {
    border-radius: 100px !important;
    padding: 2px 10px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em;
}


/* ─────────────────────────────────────────────────────────────────────────
   23. ANIMATIONS
   ───────────────────────────────────────────────────────────────────────── */

@keyframes gj-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes gj-slide-up {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.std-form-layout > .form-layout > .form-page {
    animation: gj-fade-in 0.2s ease;
}

.frappe-list .list-row-container {
    animation: gj-slide-up 0.2s ease both;
}
.frappe-list .list-row-container:nth-child(1) { animation-delay: 0s; }
.frappe-list .list-row-container:nth-child(2) { animation-delay: 0.02s; }
.frappe-list .list-row-container:nth-child(3) { animation-delay: 0.04s; }
.frappe-list .list-row-container:nth-child(4) { animation-delay: 0.06s; }
.frappe-list .list-row-container:nth-child(5) { animation-delay: 0.08s; }
.frappe-list .list-row-container:nth-child(6) { animation-delay: 0.1s; }
.frappe-list .list-row-container:nth-child(7) { animation-delay: 0.12s; }
.frappe-list .list-row-container:nth-child(8) { animation-delay: 0.14s; }
.frappe-list .list-row-container:nth-child(9) { animation-delay: 0.16s; }
.frappe-list .list-row-container:nth-child(10) { animation-delay: 0.18s; }


/* ─────────────────────────────────────────────────────────────────────────
   24. FORM VIEW — Section headers & labels
   ───────────────────────────────────────────────────────────────────────── */

.form-page .section-head,
.form-page .section-head .collapse-indicator {
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gj-primary) !important;
}

.form-page .control-label,
.form-page .frappe-control .label-area label {
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.form-page .form-section:not(:first-child) {
    margin-top: 8px;
}
