/* Web2py Bootstrap 5 Compatible Styles */

label, th {
    font-weight: bold;
    white-space: nowrap;
}

/* Flash messages - updated for Bootstrap 5 */
div.w2p_flash {
    background-image: none;
    border-radius: var(--bs-border-radius, 0.375rem);
    color: var(--bs-body-color, #212529);
    font-weight: 400;
    min-width: 28px;
    max-width: 300px;
    opacity: 1;
    vertical-align: baseline;
    right: auto;
    border-width: 1px;
    margin: 0 0 20px;
    padding: 15px 35px 15px 15px;
}

.nav-item a {
    white-space: nowrap;
}

div.w2p_flash.alert:hover {
    opacity: 1;
}

.main-container {
    margin-top: 20px;
}

/* Error styling - Bootstrap 5 compatible */
div.error {
    width: auto;
    background: transparent;
    border: none;
    background-image: none;
    color: var(--bs-danger, #dc3545);
    display: inline-block;
    padding: 5px;
}

div.w2p_flash.alert {
    display: none;
    position: fixed;
    top: 70px;
    right: 75px;
    cursor: pointer;
    z-index: 1000;
    background-color: var(--bs-warning-bg-subtle, #fff3cd);
    border-color: var(--bs-warning-border-subtle, #ffecb5);
}

.w2p-toolbar-hidden {
    margin: 10px;
}

/* List widget styling */
ul.w2p_list {
    margin-left: 0;
    padding-left: 0;
}

.w2p_list li {
    margin-bottom: 6px;
}

.w2p_list li input {
    display: inline-block;
    width: 85%;
    margin-right: 4px;
}

.w2p_list li a {
    margin-bottom: 2px;
}

/* Autocomplete dropdown - Bootstrap 5 compatible */
div[id^=_autocomplete_] {
    margin-top: -10px;
    z-index: 1;
}

select.autocomplete {
    display: block;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--bs-body-color, #212529);
    vertical-align: middle;
    background-color: var(--bs-body-bg, #fff);
    background-image: none;
    border: var(--bs-border-width, 1px) solid var(--bs-border-color, #dee2e6);
    border-radius: var(--bs-border-radius, 0.375rem);
    box-shadow: var(--bs-box-shadow-inset, inset 0 1px 2px rgba(0, 0, 0, 0.075));
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    padding: 0.375rem 0.75rem;
}

/* Web2py logo styling */
#web2py-logo {
    color: #c6cecc;
}

#web2py-logo b {
    display: inline-block;
    margin-top: -1px;
}

#web2py-logo b>span {
    font-size: 22px;
    color: #FFF;
}

#web2py-logo:hover {
    color: #FFF;
}

/* Footer styling */
.footer > .row {
    padding-left: 15px;
    padding-right: 15px;
    margin-top: 20px;
}

.background {
    background: url(../images/background.jpg) no-repeat center center;
}

body {
    margin-bottom: 60px;
}

header {
    box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
}

html {
    position: relative;
    min-height: 100%;
}

.footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 60px;
    background: var(--bs-light, #f8f9fa);
}

header h1 {
    color: #FFF!important;
    text-shadow: 0 0 7px #000;
}

header .jumbotron {
    background-color: transparent;
}

.w2p_flash {
    opacity: 0.9!important;
    right: 100px;
}

/* Utility classes */
.right {
    float: right;
    text-align: right;
}

.left {
    float: left;
    text-align: left;
}

.center {
    width: 100%;
    text-align: center;
    vertical-align: middle;
}

/* Web2py form styling - Bootstrap 5 compatible with professional spacing */
td.w2p_fw {
    padding-bottom: 8px;
}

td.w2p_fl {
    text-align: left;
}

td.w2p_fl,
td.w2p_fw {
    padding-right: 12px;
}

td.w2p_fl,
td.w2p_fc {
    padding-top: 10px;
}

div.w2p_export_menu {
    margin: 5px 0;
}

div.w2p_export_menu a,
div.w2p_wiki_tags a,
div.w2p_cloud a {
    margin-left: 5px;
    padding: 2px 5px;
}

#submit_record__row td {
    padding-top: 1rem;
}

div.error_wrapper {
    display: block;
}

.copyright {
    float: left;
}

#poweredBy {
    float: right;
}

/* Web2py grid styling - Bootstrap 5 compatible */
.web2py_grid tbody td {
    vertical-align: middle;
    padding: 2px 5px;
}

.web2py_grid thead th,
.web2py_grid tfoot td {
    background-color: var(--bs-secondary-bg, #e9ecef);
    padding: 10px 5px;
}

.web2py_grid tr.odd {
    background-color: var(--bs-light-bg-subtle, #fcfcfd);
}

.web2py_grid tr:hover {
    background-color: var(--bs-secondary-bg-subtle, #f8f9fa);
}

/* Console styling */
.web2py_console form {
    width: 100%;
    display: inline;
    vertical-align: middle;
    margin: 0 0 0 5px;
}

.web2py_console form select {
    margin: 0;
}

.web2py_search_actions {
    float: left;
    text-align: left;
    width: 100%;
}

.web2py_grid .row_buttons {
    min-height: 25px;
    vertical-align: middle;
}

.web2py_grid .row_buttons a {
    margin: 3px;
}

.web2py_grid .row_buttons a,
.web2py_paginator ul li a,
.web2py_search_actions a,
.web2py_console input[type=submit],
.web2py_console input[type=button],
.web2py_console button {
    line-height: 1.5;
    margin-right: 2px;
    display: inline-block;
    padding: 0.375rem 0.75rem;
}

.web2py_counter {
    margin-top: 5px;
    margin-right: 2px;
    width: 35%;
    float: right;
    text-align: right;
}

.web2py_table {
    clear: both;
    display: block;
}

.web2py_paginator {
    text-align: right;
    background-color: var(--bs-light, #f8f9fa);
    padding: 5px;
}

.web2py_paginator ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.web2py_paginator .current {
    font-weight: 700;
}

.web2py_breadcrumbs ul {
    list-style: none;
    margin-bottom: 1rem;
}

li.w2p_grid_breadcrumb_elem {
    display: inline-block;
}

.web2py_console input,
.web2py_console select,
.web2py_console a {
    margin: 2px;
    padding: 0.375rem 0.75rem;
}

#wiki_page_body {
    width: 600px;
    height: auto;
    min-height: 400px;
}

.web2py_console .form-control {
    width: 20%;
    display: inline;
}

.web2py_console #w2p_keywords {
    width: 50%;
}

.web2py_search_actions a,
.web2py_console input[type=submit],
.web2py_console input[type=button],
.web2py_console button {
    padding: 0.375rem 0.75rem;
}

td.w2p_fl,
td.w2p_fw,
td.w2p_fc,
#web2py_user_form td,
.web2py_grid .web2py_form td {
    vertical-align: top;
    padding-bottom: 0.5rem;
}

#auth_user_remember__row label,
.web2py_paginator ul li {
    display: inline;
}

.web2py_grid,
.web2py_grid table {
    width: 100%;
}

/* Form submit block - Bootstrap 5 compatible */
#submit_record__row .btn {
    margin-bottom: 0.25rem;
}

@media (min-width: 577px) {
    #submit_record__row .btn {
        margin-left: 0.25rem;
    }
}

@media (max-width: 576px) {
    #submit_record__row .btn {
        width: 100%;
        margin-left: 0;
    }
}

/* Font Awesome icon compatibility */
.icon.plus,.icon.arrowleft,.icon.download,.icon.trash,.icon.pen,.icon.arrowright,.icon.magnifier {
    display: inline-block;
    font: normal normal normal 14px/1 'Font Awesome 6 Free';
    font-size: inherit;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-weight: 900;
}

.icon.plus:before { content: "\f067";}
.icon.arrowleft:before { content: "\f060";}
.icon.download:before { content: "\f019";}
.icon.trash:before { content: "\f2ed";}
.icon.pen:before { content: "\f304";}
.icon.arrowright:before { content: "\f061";}
.icon.magnifier:before { content: "\f002";}

.web2py_table_selectable_actions {
   padding-top: 10px;
   float: right;
}

.web2py_table_selectable_actions input {
   padding: 0.25rem 0.5rem;
   margin-right: 10px;
}

/* Bootstrap 5 specific enhancements */
.form-floating > .form-control,
.form-floating > .form-select {
    height: calc(3.5rem + 2px);
    line-height: 1.25;
}

/* Ensure compatibility with both light and dark themes */
.web2py_grid thead th,
.web2py_grid tfoot td {
    background-color: var(--bs-tertiary-bg, #f8f9fa);
    border-color: var(--bs-border-color, #dee2e6);
}

/* Enhanced flash message positioning for Bootstrap 5 */
div.w2p_flash.alert {
    border-radius: var(--bs-border-radius, 0.375rem);
    box-shadow: var(--bs-box-shadow, 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075));
}

/* Force btn-close X icon to display with high specificity */
/* Note: The !important flags are necessary because the Bootswatch theme's CSS custom property
   approach (var(--bs-btn-close-bg)) doesn't resolve properly in all situations */
.alert .btn-close,
.modal .btn-close,
button.btn-close {
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat !important;
    opacity: 0.5 !important;
}


.alert .btn-close:hover,
.modal .btn-close:hover,
button.btn-close:hover {
    opacity: 0.75 !important;
}