/* DairyOps color theme on top of DashLite (dashlite9b70.css). Layout/components come from DashLite only. */

:root,
[data-bs-theme="light"] {
    --brand-900: #103f33;
    --brand-800: #155443;
    --brand-700: #1f7a63;
    --brand-600: #2f8d76;
    --brand-500: #49a08b;
    --accent: #2d9cdb;
    --bs-primary: var(--brand-700);
    --bs-primary-rgb: 31, 122, 99;
    --bs-link-color: var(--brand-600);
    --bs-link-hover-color: var(--brand-800);
    --bs-link-color-rgb: 47, 141, 118;
    --bs-link-hover-color-rgb: 21, 84, 67;
    --bs-focus-ring-color: rgba(31, 122, 99, 0.28);
}

[data-bs-theme="dark"] {
    --bs-primary: #49a08b;
    --bs-primary-rgb: 73, 160, 139;
    --bs-link-color: #74baaa;
    --bs-link-hover-color: #9ccfc3;
    --bs-link-color-rgb: 116, 186, 170;
    --bs-link-hover-color-rgb: 156, 207, 195;
}

/* Skip link — keyboard / screen-reader entry */
.skip-to-content {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 10000;
    padding: 0.75rem 1rem;
    background: #fff;
    color: var(--brand-800);
    font-weight: 600;
    border-radius: 0 0 0.5rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.skip-to-content:focus {
    left: 0.5rem;
    top: 0.5rem;
    outline: 3px solid var(--brand-700);
    outline-offset: 2px;
}

/* Visible focus for keyboard users */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.form-control:focus-visible,
.page-link:focus-visible,
.nk-menu-link:focus-visible,
.nk-quick-nav-icon:focus-visible {
    outline: 3px solid var(--brand-700);
    outline-offset: 2px;
}

.app-header-brand {
    background: linear-gradient(90deg, #155443 0%, #1f7a63 55%, #2f8d76 100%) !important;
}

.app-header-brand .logo-link {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    min-height: 44px;
}

.brand-logo-image {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    object-fit: cover;
    display: inline-block;
    background: rgba(255, 255, 255, 0.14);
    flex-shrink: 0;
}

.brand-wordmark {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-header-brand .nk-menu-main > li > .nk-menu-link,
.app-header-brand .user-name,
.app-header-brand .user-status,
.app-header-brand .nk-quick-nav {
    color: rgba(255, 255, 255, 0.92);
}

.app-header-brand .nk-menu-main > li > .nk-menu-link:hover,
.app-header-brand .nk-menu-main > li.active > .nk-menu-link {
    color: #fff;
}

/* Touch-friendly header controls */
.app-header-brand .nk-quick-nav-icon,
.app-header-brand .user-toggle {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Page action / icon-only controls — WCAG 2.5.5 target size */
.btn-icon.btn-trigger,
.btn.btn-icon,
.form-icon.passcode-switch,
.page-link {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.page-link {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
}

.nk-tb-list.is-compact .nk-tb-item {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.nk-tb-list.is-compact .nk-tb-col {
    min-width: 0;
}

.nk-tb-list.is-compact .tb-sub,
.nk-tb-list.is-compact .sub-text {
    white-space: normal;
    word-break: break-word;
}

.nk-auth-body .logo-link .brand-logo-image {
    height: 36px;
    width: auto;
}

.nk-auth-body .brand-wordmark {
    font-size: 1.4rem;
    font-weight: 700;
    vertical-align: middle;
    max-width: none;
}

/* Prevent horizontal page scroll from wide tables / toolbars */
.nk-content-body,
.nk-content-inner {
    max-width: 100%;
    overflow-x: clip;
}

.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* Listing pagination — stack on narrow screens */
.listing-pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.listing-pagination-bar .pagination {
    flex-wrap: wrap;
    row-gap: 0.25rem;
}

/* Page toolbars that use nk-block-between */
.nk-block-between {
    gap: 0.75rem;
}

/* Auth card breathing room on phones */
.nk-auth-body {
    padding-left: 1rem;
    padding-right: 1rem;
}

.nk-auth-body .card-inner-lg {
    padding: 1.25rem;
}

/* Prefer 16px inputs on iOS to avoid zoom-on-focus */
@media (max-width: 991.98px) {
    .form-control,
    .form-select,
    input.form-control-lg,
    .form-control-lg {
        font-size: 16px !important;
    }

    .brand-wordmark {
        font-size: 0.95rem;
        max-width: 36vw;
    }

    .brand-logo-image {
        width: 36px;
        height: 36px;
    }

    .nk-content.nk-content-fluid {
        padding-top: 1rem;
    }

    .container-xl.wide-xl {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .nk-block-title.page-title {
        font-size: 1.25rem;
        line-height: 1.3;
    }

    .nk-block-tools {
        flex-wrap: wrap;
    }

    .nk-block-tools .btn span {
        display: inline;
    }

    /* Compact KPI / pipeline cards */
    .pipeline-step {
        padding: 0.65rem 0.4rem;
    }

    .dash-chart-wrap {
        height: 220px;
    }

    .hero-strip {
        padding: 1rem !important;
    }

    .hero-strip h4 {
        font-size: 1.15rem;
    }

    /* Modals full-bleed feel on small screens */
    .modal-dialog {
        margin: 0.5rem;
    }

    /* Color inputs in branding — full width */
    input[type="color"].form-control {
        min-height: 44px;
        padding: 0.25rem;
    }
}

@media (max-width: 575.98px) {
    .nk-auth-body .brand-wordmark {
        font-size: 1.15rem;
        display: block;
        margin-top: 0.5rem;
        margin-left: 0 !important;
    }

    .nk-auth-body .logo-link {
        flex-direction: column;
        gap: 0.25rem;
    }

    .listing-pagination-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .listing-pagination-bar .pagination {
        justify-content: center !important;
    }

    .card-inner-lg {
        padding: 1rem !important;
    }

    /* Stack filter rows */
    .g-3 > [class*="col-"] {
        min-width: 0;
    }

    .btn-block,
    .btn.btn-lg.btn-primary.btn-block {
        width: 100%;
    }
}

/* Reduce motion for vestibular accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
