/* Font import */
@font-face {
    font-family: 'e-Ukraine';
    src: url('/static/fonts/e-Ukraine-Regular.BJXaAJcm.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

/* Global styling */
html, body {
    font-family: 'e-Ukraine', sans-serif;
    background-color: #34322C;
    color: #EFDBB2;
    line-height: 1.6;
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
}

.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    background-color: #2A2823 !important;
    border-bottom: 1px solid rgba(239, 219, 178, 0.2);
    padding: 0.5rem 0;
}

.navbar-logo {
    height: 30px;
    width: auto;
}

.navbar-nav .nav-link {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Fix navbar alignment with multiple filters */
.navbar-nav {
    flex-wrap: wrap;
    align-items: center;
}

.nav-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem;
    margin-top: 0.25rem;
}

.active-unit-link, .active-group-link {
    white-space: normal;
    text-align: center;
    line-height: 1.2;
    display: inline-block;
}

/* Active filters section */
.active-filters {
    background-color: rgba(42, 40, 35, 0.7);
    border-radius: 0.5rem;
    padding: 0.25rem 0.5rem;
    margin-left: 0.5rem;
    max-width: 40%;
}

.filter-link {
    max-width: 200px;
    overflow: hidden;
}

.filter-text {
    display: inline-block;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.active-unit-link {
    background-color: #4D723E;
    color: #EFDBB2 !important;
}

.active-group-link {
    background-color: #3E4D72;
    color: #EFDBB2 !important;
}

.active-unit-link:hover, .active-group-link:hover {
    color: #ffffff !important;
    opacity: 0.9;
}

.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    background-color: #403D35;
    border: 1px solid rgba(239, 219, 178, 0.1);
}

.card-header {
    background-color: #2A2823;
    border-bottom: 1px solid rgba(239, 219, 178, 0.15);
    color: #EFDBB2;
}

.card-body {
    color: #EFDBB2;
}

/* Search input styling */
#searchInput::placeholder {
    color: rgba(255, 255, 255, 0.8);
}

#searchInput {
    background-color: rgba(64, 61, 53, 0.7);
    color: #EFDBB2;
    border-color: rgba(239, 219, 178, 0.3);
}

#searchInput:focus {
    box-shadow: 0 0 0 0.25rem rgba(239, 219, 178, 0.25);
    border-color: rgba(239, 219, 178, 0.5);
}

/* Breadcrumb styling */
.breadcrumb-item a {
    color: #EFDBB2;
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: #ffffff;
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: #ffffff;
}

/* Table styling */
.table {
    margin-bottom: 0;
    color: #EFDBB2;
    border-color: rgba(239, 219, 178, 0.2);
}

/* Floating scroll for tables */
.floating-scroll {
    position: sticky;
    bottom: 20px;
    left: 0;
    right: 0;
    height: 12px;
    margin: 0 auto;
    z-index: 100;
    max-width: 80%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.floating-scroll.visible {
    opacity: 1;
}

.floating-scroll-track {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: rgba(42, 40, 35, 0.9);
    border-radius: 6px;
    box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.4);
    cursor: pointer;
}

.floating-scroll-thumb {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: rgba(239, 219, 178, 0.5);
    border-radius: 6px;
    min-width: 30px;
    cursor: grab;
    transition: background-color 0.2s ease;
}

.floating-scroll-thumb:hover {
    background-color: rgba(239, 219, 178, 0.7);
}

.floating-scroll-thumb:active {
    cursor: grabbing;
    background-color: rgba(239, 219, 178, 0.8);
}

/* Make sure table wrappers have position relative for proper scrolling */
.table-responsive {
    position: relative;
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: rgba(64, 61, 53, 0.7);
}

.table-striped > tbody > tr:nth-of-type(even) {
    background-color: rgba(42, 40, 35, 0.7);
}

.table-hover tbody tr:hover {
    background-color: rgba(84, 80, 63, 0.6) !important;
    color: #EFDBB2;
}

.table thead th {
    background-color: #2A2823;
    border-bottom: 2px solid rgba(239, 219, 178, 0.3);
    color: #EFDBB2;
    padding: 12px 8px;
    position: relative;
}

.table th a {
    color: #EFDBB2;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table th a:hover {
    color: #D4BB85;
}

.table th a::after {
    content: "";
    margin-left: 8px;
}

.table th a.sort-asc::after {
    content: "↑";
}

.table th a.sort-desc::after {
    content: "↓";
}

.table td {
    border-color: rgba(239, 219, 178, 0.1);
    padding: 10px 8px;
    vertical-align: middle;
}

.container {
    flex: 1 0 auto;
    min-height: 70vh; /* Minimum height to push footer down */
}

/* Login page specific styling */
.login-container {
    min-height: 80vh; /* Make login container take most of the viewport height */
    display: flex;
    align-items: center;
}

.footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
    flex-shrink: 0;
    width: 100%;
    padding: 2px 0;
    font-size: 0.6rem;
    line-height: 0.8;
    height: 10px;
    text-align: center;
    opacity: 0.5;
}

/* Custom buttons */
.btn-primary {
    background-color: #54503F;
    border-color: #767261;
    color: #EFDBB2;
}

.btn-primary:hover, 
.btn-primary:focus, 
.btn-primary:active {
    background-color: #6A653A !important;
    border-color: #6A653A !important;
    border-color: #5B5632 !important;
}

.btn-secondary {
    background-color: #807B48;
    border-color: #807B48;
}

.btn-secondary:hover, 
.btn-secondary:focus, 
.btn-secondary:active {
    background-color: #918C52 !important;
    border-color: #918C52 !important;
}

.dropdown-menu {
    background-color: #5B5632;
}

.dropdown-item {
    color: #f8f9fa;
}

.dropdown-item:hover, 
.dropdown-item:focus {
    background-color: #6A653A;
    color: #fff;
}

.badge.bg-info {
    background-color: #807B48 !important;
}

.alert {
    background-color: #5B5632;
    color: #f8f9fa;
    border-color: rgba(255, 255, 255, 0.2);
}

.alert-info {
    background-color: #807B48;
}

.alert-success {
    background-color: #4D723E;
}

.nav-link {
    color: #f8f9fa;
}

.nav-link:hover {
    color: #ccc;
}

.nav-link.active {
    color: #fff;
    font-weight: bold;
}

/* Form controls */
.form-control,
.form-select {
    background-color: #403D35;
    border-color: #54503F;
    color: #EFDBB2;
}

.form-control:focus,
.form-select:focus {
    background-color: #403D35;
    color: #EFDBB2;
    border-color: #D4BB85;
    box-shadow: 0 0 0 0.25rem rgba(212, 187, 133, 0.25);
}

.form-select option {
    background-color: #403D35;
    color: #EFDBB2;
}

/* Active unit and group styling */
.active-unit-link {
    background-color: #54503F !important;
    color: #EFDBB2 !important;
    border: 1px solid #D4BB85;
}

.active-group-link {
    background-color: #807B48 !important;
    color: #EFDBB2 !important;
    border: 1px solid #D4BB85;
}

/* Group badge colors */
.badge-group {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
    color: #EFDBB2;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

.badge-group-1 {
    background-color: #4D723E; /* Green */
}

.badge-group-2 {
    background-color: #7A4D3E; /* Rust/Brown */
}

.badge-group-3 {
    background-color: #3E4D72; /* Blue */
}

.badge-group-4 {
    background-color: #723E72; /* Purple */
}

.badge-group-5 {
    background-color: #72653E; /* Gold */
}

.badge-group-6 {
    background-color: #3E7272; /* Teal */
}

.badge-group-7 {
    background-color: #723E4D; /* Burgundy */
}

.badge-group-8 {
    background-color: #3E5D72; /* Steel Blue */
}

/* Search box styling */
.search-container {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #403D35;
    border: 1px solid rgba(239, 219, 178, 0.2);
    border-radius: 0 0 0.5rem 0.5rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    margin-right: 71px; /* Adjust for the button width */
}

.search-suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-suggestion-item:last-child {
    border-bottom: none;
}

.search-suggestion-item:hover,
.search-suggestion-item.active {
    background-color: #54503F;
}

.search-suggestion-rank {
    font-size: 0.85rem;
    color: #ddd;
    margin-right: 0.5rem;
}

.search-suggestion-details {
    display: flex;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.search-suggestion-unit {
    font-size: 0.85rem;
    color: #D4BB85;
    margin-right: 0.75rem;
}

.search-suggestion-group {
    font-size: 0.85rem;
    color: #807B48;
    font-style: italic;
}

.search-suggestion-name {
    font-weight: 500;
}

/* Cards & Stats */
.stats-card {
    background-color: #3A371E;
    color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border-left: 4px solid #AFA06A;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: #D4BB85;
    margin-bottom: 1rem;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.card-title {
    font-weight: 500;
    letter-spacing: 0.5px;
}

.lead {
    font-weight: 300;
    letter-spacing: 0.3px;
    color: #F0F0EA;
}

.bg-primary {
    background-color: #0057b7 !important;
}

/* Secondary color from Ukrainian flag */
.btn-warning {
    background-color: #ffd700;
    border-color: #ffd700;
    color: #212529;
}

.btn-warning:hover {
    background-color: #e6c200;
    border-color: #e6c200;
    color: #212529;
}

/* Custom badge styles */
.badge.bg-warning {
    background-color: #ffd700 !important;
}

/* Dark Theme Modal */
.modal-content.theme-dark {
    background-color: #34322C;
    color: #EFDBB2;
    border: 1px solid rgba(239, 219, 178, 0.2);
}

.modal-content.theme-dark .modal-header,
.modal-content.theme-dark .modal-footer {
    background-color: #2A2823;
    border-color: rgba(239, 219, 178, 0.2);
}

.modal-content.theme-dark .text-muted {
    color: #c1b291 !important;
}

.modal-content.theme-dark .form-check-label,
.modal-content.theme-dark .form-label {
    color: #EFDBB2;
}

.modal-content.theme-dark .unit-checkbox-container {
    background-color: rgba(42, 40, 35, 0.5);
    border-color: rgba(239, 219, 178, 0.2) !important;
}

.modal-content.theme-dark .alert-info {
    background-color: rgba(42, 40, 35, 0.8);
    color: #EFDBB2;
    border-color: rgba(13, 202, 240, 0.5);
}

.modal-content.theme-dark hr {
    border-color: rgba(239, 219, 178, 0.2);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
