:root {
    --font-size: 13px;
    --spacing: 0.3rem;

    --primary: #4659A5 !important;

    --form-element-spacing-vertical: 0.1rem;
    --form-element-spacing-horizontal: 0.5rem;

    --grid-spacing-horizontal: 1rem;
    --grid-spacing-vertical: 1rem;

    --border-radius: 0.25rem;

    --success: #28a745;
    --info: #17a2b8;
    --warning: #ffc107;
    --danger: #dc3545;
}

html {
    background-color: #fcfcfc;
}

body,
h1,
h2,
h3,
h4,
h5 {
    font-family: 'Fira Sans', Sans-serif;
}

h4 {
    margin: 0;
}

.container {
    max-width: min(1880px, 98%) !important;
}

body>header {
    position: fixed;
    top: 0;
    z-index: 1100;
    padding: 0 1rem !important;
    background-color: #b3d1c9;
    box-shadow: rgba(0, 0, 0, 0.15) 0px 1px 3px, rgba(0, 0, 0, 0.15) 0px 3px 6px;
}

body>header strong {
    color: #000;
    opacity: 0.9;
    font-size: 1.75rem;
}

body>header strong span {
    color: red;
    left: 4em;
    position: absolute;
    top: 1.2em;
}

body>header a {
    color: #000;
    opacity: 0.9;
}

body>header a:hover {
    opacity: 1;
}

dialog article {
    padding: 1.5em 2em;
}

#nav-logo {
    margin: 0;
    width: 25rem;
}

#nav-logo a {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
}

#nav-logo img {
    width: 12em;
    margin: 0;
    margin-top: -12px;
    margin-right: 1rem;
}

summary {
    padding: 0 !important;
    border: 0 !important;
    color: #000 !important;
    opacity: 0.9 !important;
}

main {
    margin-top: 5rem;
}

body>header strong {
    display: inline-block;
    white-space: nowrap;
    line-height: 1.05;
}

#tagline {
    position: static;
    margin-left: 0.35rem;
    vertical-align: middle;
    font-size: 0.55em;
}

@media (max-width: 992px) {
    #nav-logo {
        width: auto;
    }

    #nav-logo img {
        width: 8em;
        margin-top: 0;
        margin-right: 0.5rem;
    }

    body>header strong {
        font-size: 1.3rem;
    }

    main {
        margin-top: 6rem;
    }
}

@media (max-width: 768px) {
    #nav-logo img {
        width: 6.5em;
    }

    body>header strong {
        font-size: 1.1rem;
    }

    #tagline {
        display: none;
    }

    main {
        margin-top: 6.5rem;
    }
}

h2,
h3 {
    margin-bottom: 0.5rem;
}

h5 {
    margin: 0.5rem 0 0 0;
    text-transform: uppercase;
    color: var(--primary);
}

input,
select,
textarea {
    background-color: #fff;
    border: 1px solid #d0d0d0;
}

.input,
.input li {
    margin: 0;
    padding: 0;
}

.input li {
    list-style-type: none;
}

[type=text]:read-only {
    background-color: var(--form-element-disabled-background-color);
    border-color: var(--form-element-disabled-border-color);
    opacity: var(--form-element-disabled-opacity);
    cursor: not-allowed;
}

[type=checkbox]:checked,
[type=checkbox]:checked:active,
[type=checkbox]:checked:focus,
[type=radio]:checked,
[type=radio]:checked:active,
[type=radio]:checked:focus {
    background-color: var(--primary);
}

table {
    background-color: #fff;
}

table th {
    font-weight: bold;
}

tr:nth-child(even):not(#bkb-date-picker-dialog tr) {
    background-color: rgba(0, 0, 0, 0.03);
}

td,
th {
    vertical-align: top;
}

[role=button],
button,
input[type=button],
input[type=reset],
input[type=submit] {
    display: inline-block;
    width: unset !important;
}

input:disabled,
button:disabled {
    cursor: not-allowed;
}

select:not([multiple]) {
    height: calc(1rem * var(--line-height) + var(--form-element-spacing-vertical) * 2 + var(--border-width) * 2);
}

label small {
    color: gray;
}

span.error,
p.error,
ul.error,
.invalid-feedback {
    color: rgb(255, 10, 10);
}

ul.error {
    list-style-type: none;
}

img {
    margin: 1rem 0;
}

#table-search {
    width: 30%;
    float: right;
}

#table-search .clear-search {
    float: right;
}

.text-gray-500 {
    color: #a0aec0;
}

.hide {
    display: none;
}

#map img {
    /* Fixar bort ovan marginal i google maps karta */
    margin: 0;
}

.nowrap {
    white-space: nowrap;
}

.right {
    float: right;
    margin-left: 0.4rem;
}

.clear {
    clear: both;
}

.button-round {
    border-radius: 50%;
    height: 2rem;
    width: 2rem;
    background-color: #96a9e5;
    border-color: #96a9e5;
}

button.button-danger,
input[type=submit].button-danger,
input[type=button].button-danger,
[role=button].button-danger {
    background-color: var(--danger);
    border-color: var(--danger);
}

button.button-danger:hover,
button.button-danger:focus,
button.button-danger:active,
input[type=submit].button-danger:hover,
input[type=submit].button-danger:focus,
input[type=submit].button-danger:active,
input[type=button].button-danger:hover,
input[type=button].button-danger:focus,
input[type=button].button-danger:active,
[role=button].button-danger:hover,
[role=button].button-danger:focus,
[role=button].button-danger:active {
    background-color: var(--danger);
    border-color: var(--danger);
    opacity: 0.85;
}

#lines th {
    vertical-align: bottom;
}

#lines tbody tr {
    cursor: pointer;
}

#lines .delete {
    display: none;
}

#lines .edit {
    background-color: rgba(0, 0, 0, 0.15);
}

.alert {
    box-shadow: rgba(0, 0, 0, 0.15) 0px 1px 3px, rgba(0, 0, 0, 0.15) 0px 3px 6px;
    border-radius: 0.25rem;
    /* padding/margin/line-height ligger i basregeln så att även .alert-persistent
       (som har animation: none) får rätt utseende. hideAnimation-keyframen sätter
       samma värden i 0%/90% och kollapsar dem först i 100% (fade-out). */
    padding: 1em;
    margin: 0.5em 0;
    line-height: 1.4;
    animation: hideAnimation 5s forwards;
}

.alert.alert-info {
    background-color: var(--info);
    color: white;
}

.alert.alert-success {
    background-color: var(--success);
    color: white;
}

.alert.alert-warning {
    background-color: var(--warning);
}

.alert.alert-danger {
    background-color: var(--danger);
    color: white;
}

/* Opt-out från auto-döljningen: används av persistenta flash-meddelanden
   (t.ex. "Körningar genereras i bakgrunden"). */
.alert.alert-persistent {
    animation: none;
}

@keyframes hideAnimation {
    0% {
        opacity: 1;
        line-height: 1.4;
        padding: 1em;
        margin: 0.5em 0;
    }

    90% {
        opacity: 1;
        line-height: 1.4;
        padding: 1em;
        margin: 0.5em 0;
    }

    100% {
        display: hidden;
        opacity: 0;
        line-height: 0;
        padding: 0;
        margin: 0;
    }
}

/* https://www.computerhope.com/jargon/w/w3c-color-names.htm */
.alert.info {
    background-color: PaleGreen;
    color: black;
}

.alert.warning {
    background-color: Gold;
    color: black;
}

.alert.error {
    background-color: OrangeRed;
    color: white;
}

/* PRINT */
@media print {

    .hide-print,
    #table-search,
    a[role="button"] {
        display: none;
    }

    .container {
        width: 100%;
        max-width: 100%;
    }

    .grid {
        display: block;
    }
}

/* SCREEN */
@media screen {
    .show-print {
        display: none;
    }
}

/* KALENDER */
#calendar-nav {
    margin-top: 1.5em;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

#previous-month {
    text-align: left;
}

#this-month {
    text-align: center;
}

#next-month {
    text-align: right;
}

#calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

#calendar .weekday {
    text-align: center;
}

#calendar .planned {
    color: rgba(0, 128, 0, 0.5);
}

#calendar .day {
    border: 1px solid lightgray;
    background-color: white;
    padding: 0.3em;
    min-height: 3em;
    overflow: hidden;
}

#calendar .day ul {
    margin: 0;
    padding: 0;
    list-style-type: none;
}

#calendar .day li {
    line-height: 1.2em;
    white-space: nowrap;
    padding: 0.3em 0;
}

#calendar .day li:not(:last-child) {
    border-bottom: 1px solid #eee;
}

#calendar .day li.hidden::before {
    font-size: 1.5em;
    font-weight: bold;
    content: "GÖMD";
    position: absolute;
    color: rgba(128, 0, 0, 0.5) !important;
}

#calendar .day li.hidden>* {
    color: rgba(0, 0, 0, 0.2) !important;
}

#calendar .day a {
    display: block;
    width: 100%;
}

#calendar .day small {
    font-size: 0.7em;
    padding-left: 1em;
    color: rgba(0, 0, 0, 0.6);
}

#calendar .day-7:not(.day-not-in-month) {
    background-color: #ffe6e6;
}

#calendar .day-not-in-month {
    color: #bbb;
    background-color: #eee;
}

#calendar .date {
    float: right;
    text-align: right;
}

/* Meddelanden */
.speech-bubble-left {
    position: relative;
    background: #e3e3e3;
    border-radius: 0.5em;
    padding: 1em 1.25em;
    margin: 1.5em 15% 1.5em 0;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.6;
    color: #2c3e50;
}

.speech-bubble-left p {
    margin: 0.5em 0;
    line-height: 1.6;
}

.speech-bubble-left p:first-child {
    margin-top: 0;
}

.speech-bubble-left p:last-child {
    margin-bottom: 0;
}

.speech-bubble-left a {
    color: #0056b3;
    text-decoration: none;
}

.speech-bubble-left a:hover {
    text-decoration: underline;
}

.speech-bubble-left:after {
    content: '';
    position: absolute;
    left: 0;
    top: 1.2em;
    width: 0;
    height: 0;
    border: 10px solid transparent;
    border-right-color: #e3e3e3;
    border-left: 0;
    margin-top: 0;
    margin-left: -10px;
}

.speech-bubble-right {
    text-align: left;
    position: relative;
    background: #c7e9c0;
    border-radius: 0.5em;
    padding: 1em 1.25em;
    margin: 1.5em 0 1.5em 15%;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.6;
    color: #2c3e50;
}

.speech-bubble-right p {
    margin: 0.5em 0;
    line-height: 1.6;
}

.speech-bubble-right p:first-child {
    margin-top: 0;
}

.speech-bubble-right p:last-child {
    margin-bottom: 0;
}

.speech-bubble-right a {
    color: #0056b3;
    text-decoration: none;
}

.speech-bubble-right a:hover {
    text-decoration: underline;
}

.speech-bubble-right .fas {
    color: #2c3e50;
}

.speech-bubble-right:after {
    content: '';
    position: absolute;
    right: 0;
    top: 1.2em;
    width: 0;
    height: 0;
    border: 10px solid transparent;
    border-left-color: #c7e9c0;
    border-right: 0;
    margin-top: 0;
    margin-right: -10px;
}

.message-thread {
    padding-left: 20%;
    display: none;
}

.message-posted {
    text-align: right;
    font-size: 0.85em;
    color: #666;
    margin-top: 0.75em;
    padding-top: 0.75em;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    line-height: 1.5;
}

.speech-bubble-left .message-posted {
    text-align: left;
}

.conversation-scroll-area {
    max-height: 44vh;
    overflow-y: auto;
    padding-right: 0.5em;
    margin-bottom: 0.75em;
}

.conversation-root-container {
    display: block;
}

.conversation-root-card {
    width: 100%;
    margin: 0 0 1.5em 0;
    background: #f5f7fa;
    border: 1px solid #d8dee6;
    border-radius: 0.5em;
    padding: 1em 1.25em;
    color: #2c3e50;
    line-height: 1.6;
}

.conversation-root-card p {
    margin: 0.5em 0;
}

.conversation-root-card p:first-child {
    margin-top: 0;
}

.conversation-root-card p:last-child {
    margin-bottom: 0;
}

.conversation-replies-container {
    margin-bottom: 0;
}

.conversation-replies-title {
    margin-bottom: 1.5em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid #e3e3e3;
}

.conversation-root-container .message-posted,
.conversation-scroll-area .message-posted {
    font-size: 0.72em;
}

.reply-form-container {
    margin-top: 0;
    padding: 1.5em;
    background: #f8f9fa;
    border-radius: 0.5em;
}

.reply-composer {
    display: flex;
    background-color: white;
    border: 1px solid grey;
    border-radius: 0.5rem;
}

.reply-textarea {
    margin: 0;
    border: 0;
    background: transparent;
    resize: none;
    overflow-y: auto;
    line-height: 1.35;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    padding-right: 0.55rem;
    margin-bottom: 0.3rem; 
}

.reply-send-button {
    margin: 0.3rem;
    padding: 1rem;
    z-index: 2;
    height: auto;
    align-self: flex-end;
}

@media (max-width: 768px) {
    .conversation-scroll-area {
        max-height: 38vh;
    }

    .conversation-page-column {
        height: calc(100vh - 7rem);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .conversation-page-column .message-header {
        margin-bottom: 0.75em !important;
        padding-bottom: 0.6em !important;
        flex: 0 0 auto;
    }

    .conversation-root-card {
        padding: 0.75em 0.9em;
        margin-bottom: 0.75em;
    }

    .conversation-replies-title {
        margin-bottom: 0.6em;
        padding-bottom: 0.35em;
        font-size: 1rem;
        flex: 0 0 auto;
    }

    .conversation-scroll-area {
        max-height: none;
        min-height: 0;
        flex: 1 1 auto;
        margin-bottom: 0.5em;
        padding-right: 0.25em;
    }

    .reply-form-container {
        flex: 0 0 auto;
        margin-top: 0;
        padding: 0.75em;
        border-top: 1px solid #d8dee6;
    }

    .reply-form-container h4 {
        font-size: 1rem;
    }

    #reply-form textarea {
        min-height: 2.2rem;
    }

    .reply-form-container {
        padding: 0.65em;
    }

    .reply-send-button {
        padding: 0.2rem 0.65rem;
        font-size: 0.85em;  
    }
}

.pickup-table {
    border-top: 1px solid #ddd;
    font-size: 1.2em;
}

.pickup-table tr td {
    padding: 0.7em;
    border-bottom: 1px solid #ddd;
}

.pickup-stop-check,
.pickup-check,
.dropoff-stop-check,
.dropoff-check {
    width: 1.5em;
    height: 1.5em;
}

.pickup-check-col,
.route-icon-col {
    width: 3em;
}

.pickup-check-route-col td {
    background-color: #eee;
}

#selected_stop_id option.stopgroup-1 {
    color: #999;
    font-style: italic;
}

#selected_stop_id option.is-passtime,
#selected_stop_id option:not(.stoptype-1) {
    color: #999;
}

#selected_stop_id option.has-pickups {
    color: green;
    font-weight: bold;
}


#global-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    display: none;
}