/* -------------------------------------------------------------------------------- */
/* Globalne ustawienia wszystkich kontrolek autocomplete */
/* -------------------------------------------------------------------------------- */

fieldset.grp-module .grp-row {
    overflow: visible !important;
}

.autocomplete-light-widget .deck {
    padding-left: 0px;
    width: 100%;
    display: inline;
    background: none;
}

.autocomplete-light-widget .deck li {
    background: none;
    border-radius: 0px;
    display: inline;
}

.autocomplete-light-widget .deck [data-value]:last-child {
    background: none;
    display: inline;
}

/* -------------------------------------------------------------------------------- */
/* Nawigacja na górze administratora */
/* -------------------------------------------------------------------------------- */

/* Kontrolka <input> wyszukiwania nawigacyjnego */
#navigation_autocomplete {
    width: 15%;
    top: 6px;
    position: relative;
    float: right;
    display: inline;
}

/* wyskakująca lista z elementami do wyboru */
.yourlabs-autocomplete.inner-container {
    width: 400px;
}

.navigation-autocomplete-icon {
    width: 16px;
    height: 16px;
}

/* -------------------------------------------------------------------------------- */
/* Nadpisane style Grappelli */
/* -------------------------------------------------------------------------------- */

.grp-tabular .grp-table .grp-tbody .grp-th.grp-tools-container, .grp-tabular .grp-table .grp-tbody .grp-td.grp-tools-container {
    width: 5% !important;
}

.grp-td a.add-another {
    float: none !important;
}

#grp-navigation #bookmark-button {
    background: url('/static/bpp/images/star_white.png') !important;
    background-position: 0px 0px !important;
    width: 25px !important;
}

#grp-navigation #bookmark-button.bookmarked {
    background: url('/static/bpp/images/star_yellow.png') !important;
    background-position: 0px 0px !important;
    width: 25px !important;
}

/* global nav */

#global-nav-table {
    border: 0;
    border-collapse: collapse;
}

.global-nav td {
    padding: 0;
}

/* ---- */

textarea.charmap {
    float: left;
}

textarea {
    height: auto;
}

button.charmap {
    width: 24px;
    height: 24px;
    cursor: pointer;
    position: relative;
    left: 40px;
    top: 15px;
    float: left;
    color: black;
    font-weight: bold;
}

#global-nav-table {
    border: none;
    border-collapse: collapse;
}

.global-nav tbody tr td, table tbody tr th {
    border-bottom: none;
    border-left: none;
}


.grp-related-widget-tools {
    z-index: -9999 !important;
}

/* Select2 */

.select2-container {
    font-size: 12px;
    font-weight: bold;
    /* min-width: 350px; */
}

select.admin-autocomplete {
    min-width: 500px;
}

.select2-container--default .select2-selection--single {
    border-radius: 3px;
    border: 1px solid #aaa;
}

/* TODO: tam jest <span> i nie przyjmuje :focus... */

.select2-selection--single:hover {
    box-shadow: #ccc 0 0 6px;
}

#id_global_nav .select2-dropdown {
    box-shadow: #ccc 0 0 8px;
    min-height: 5vw;
    max-height: 80vw;
    overflow: scroll;
}

.select2 {
    min-width: 600px;
}

.select2-container--default .select2-results > .select2-results__options {
    max-height: 20vw !important;
}

.globalNavAdmin .select2-results > .select2-results__options {
    max-height: 40vw !important;
}

.select2-results__options {
    margin-left: 2px;
    background: white;

}

.globalNavAdmin .select2-results__group, .select2-results__group {
    background: #eeeeee;
    font-weight: bold;
}

/* -------------------------------------------------------------------------------- */
/* Responsive global navigation select2 widget */
/* -------------------------------------------------------------------------------- */
/*
   Aggressive shrinking strategy to prevent menu wrapping:
   - >1590px: Comfortable width (350-550px)
   - 1490-1590px: Reduced width (300-450px)
   - 1400-1490px: Further reduced (250-400px)
   - 1320-1400px: Even smaller (220-350px)
   - 1200-1320px: More reduced (200-300px)
   - 1100-1200px: Narrow (180-250px)
   - 1050-1100px: Narrower (150-220px)
   - 900-1050px: Very narrow (120-180px)
   - ≤900px: Minimal (no min-width, max 150px)
*/

/* Base styling for large screens */
#div_id_global_nav_value .select2-container {
    width: 100% !important;
    min-width: 350px;
    max-width: 550px;
}

/* First reduction at 1590px */
@media (max-width: 1590px) {
    #div_id_global_nav_value .select2-container {
        min-width: 300px;
        max-width: 450px;
    }
}

/* Second reduction at 1490px - align with menu font reduction */
@media (max-width: 1490px) {
    #div_id_global_nav_value .select2-container {
        min-width: 250px;
        max-width: 400px;
    }
}

/* Third reduction at 1400px - align with menu font reduction */
@media (max-width: 1400px) {
    #div_id_global_nav_value .select2-container {
        min-width: 220px;
        max-width: 350px;
    }
}

/* Fourth reduction at 1320px - align with menu padding reduction */
@media (max-width: 1320px) {
    #div_id_global_nav_value .select2-container {
        min-width: 200px;
        max-width: 300px;
    }
}

/* Further reduction at 1200px - align with menu font reduction */
@media (max-width: 1200px) {
    #div_id_global_nav_value .select2-container {
        min-width: 180px;
        max-width: 250px;
    }
}

/* More reduction at 1100px */
@media (max-width: 1100px) {
    #div_id_global_nav_value .select2-container {
        min-width: 150px;
        max-width: 220px;
    }
}

/* Before text disappears - align with menu icons-only at 1050px */
@media (max-width: 1050px) {
    #div_id_global_nav_value .select2-container {
        min-width: 120px;
        max-width: 180px;
    }
}

/* Very small screens - no min-width, allow maximum shrinking */
@media (max-width: 900px) {
    #div_id_global_nav_value .select2-container {
        min-width: unset;
        max-width: 150px;
        font-size: 11px;
    }

    button#bookmark-button {
        display: none !important;
    }
}

/* -------------------------------------------------------------------------------- */
/* Disabled submit buttons readability fix */
/* -------------------------------------------------------------------------------- */

input[type="submit"]:disabled,
input[type="submit"].grp-button:disabled {
    color: #666 !important;
    background-color: #f5f5f5 !important;
    border-color: #ccc !important;
}

input[type="submit"]:disabled:hover,
input[type="submit"].grp-button:disabled:hover {
    color: #666 !important;
    background-color: #f5f5f5 !important;
}

/* -------------------------------------------------------------------------------- */
/* Breadcrumbs truncation for long object titles */
/* -------------------------------------------------------------------------------- */

nav#grp-breadcrumbs {
    overflow: hidden;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
}

nav#grp-breadcrumbs ul li {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40vw;
}

/* Responsive font size for breadcrumbs */
@media (max-width: 768px) {
    nav#grp-breadcrumbs {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    nav#grp-breadcrumbs {
        font-size: 8px;
    }
}

/* -------------------------------------------------------------------------------- */
/* Discipline fields styling - make select2 fields for disciplines wider */
/* -------------------------------------------------------------------------------- */

.grp-td.dyscyplina_naukowa .select2-container,
.grp-td.subdyscyplina_naukowa .select2-container {
    min-width: 200px !important;
    width: 200px !important;
}

.grp-td.dyscyplina_naukowa select.admin-autocomplete,
.grp-td.subdyscyplina_naukowa select.admin-autocomplete {
    min-width: 200px !important;
    width: 200px !important;
}

/* json widget */

div.json-actions .button {
    width: auto !important;
    height: auto !important;
    margin-right: 20px;
}

.json-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.json-copy-btn, .json-download-btn {
    background: #007cba;
    color: white;
    border: none;
    padding: 8px 16px;
        font-size: inherit !important;

    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.json-copy-btn:hover, .json-download-btn:hover {
    background: #005a87;
    font-size: inherit !important;
    color: white !important;
}

.json-copy-btn.success {
    background: #28a745;
}

.json-copy-btn.success:hover {
    background: #218838;
}

/* -------------------------------------------------------------------------------- */
/* Admin table row hover effect */
/* -------------------------------------------------------------------------------- */

/* Hover effect colors are defined dynamically in base_site.html based on THEME_NAME */

/* Make clickable rows have pointer cursor - added via JavaScript */
#result_list tbody tr.clickable-row {
    cursor: pointer;
}

/* -------------------------------------------------------------------------------- */
/* Global nav select2 loading state */
/* -------------------------------------------------------------------------------- */

.select2-container.select2-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

/* CSS Spinner */
.select2-container.select2-loading::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #ccc;
    border-top-color: #417690;
    border-radius: 50%;
    animation: select2-spinner-rotate 0.6s linear infinite;
}

@keyframes select2-spinner-rotate {
    from {
        transform: translateY(-50%) rotate(0deg);
    }
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* -------------------------------------------------------------------------------- */
/* Change form row hover effect */
/* -------------------------------------------------------------------------------- */

/* Hover effect colors are defined dynamically in base_site.html based on THEME_NAME */

/* -------------------------------------------------------------------------------- */
/* Reduced spacing for messages and content title */
/* -------------------------------------------------------------------------------- */

.grp-messagelist {
    padding-bottom: 5px !important;
}

#grp-content-title h1 {
    margin-top: 5px !important;
}
