/* Sidebar - Keep AdminKit defaults, just add smooth transitions */
.sidebar {
    transition: margin-left 0.35s ease-in-out;
}

.sidebar.collapsed {
    margin-left: -260px !important;
}

.main {
    transition: margin-left 0.35s ease-in-out;
}

.sidebar.collapsed + .main {
    margin-left: 0 !important;
}

/* Content Top Padding - Reduced for compact layout */
.content {
    padding-top: 1.5rem !important;
}

/* Focus outline removal */
*:focus,
*:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

button:focus,
a:focus,
.btn:focus,
.nav-link:focus,
.dropdown-toggle:focus,
input:focus,
select:focus,
textarea:focus,
.form-control:focus,
.form-select:focus {
    outline: none !important;
    box-shadow: none !important;
}

.form-control:focus,
.form-select:focus {
    border-color: #dee2e6 !important;
    box-shadow: none !important;
}

/* Dropdown positioning */
.navbar .nav-item.dropdown {
    position: relative;
}

.navbar .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    z-index: 1050;
    margin-top: 0.5rem;
}

.dropdown-menu.show {
    display: block;
}

.sidebar-toggle,
.dropdown-toggle {
    cursor: pointer !important;
}

/* Dark Mode - Main Layout */
[data-theme="dark"] .main {
    background-color: #1a1d24;
}

[data-theme="dark"] .content {
    background-color: #1a1d24;
}

[data-theme="dark"] .card {
    background-color: #222631;
    border-color: #2e3340;
}

[data-theme="dark"] .card-header {
    background-color: #2a2f3c;
    border-color: #2e3340;
    color: #d1d5db;
}

[data-theme="dark"] .table {
    color: #e5e7eb;
    --bs-table-border-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .table thead th {
    background-color: rgba(42, 47, 60, 0.5);
    border-color: rgba(255, 255, 255, 0.05);
    color: #f3f4f6;
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.5rem 0.75rem;
}

[data-theme="dark"] .table tbody tr {
    border-color: rgba(255, 255, 255, 0.05);
    transition: background-color 0.15s ease;
}

[data-theme="dark"] .table tbody td {
    color: #e5e7eb;
    border-color: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    vertical-align: middle;
}

[data-theme="dark"] .table-sm tbody td {
    padding: 0.4rem 0.6rem;
}

[data-theme="dark"] .table-hover tbody tr:hover {
    background-color: rgba(59, 125, 221, 0.12);
    cursor: pointer;
}

[data-theme="dark"] .table-hover tbody tr:hover td {
    color: #f9fafb;
}

[data-theme="dark"] .navbar-bg {
    background-color: #222631 !important;
    border-bottom: 1px solid #2e3340;
}

[data-theme="dark"] .footer {
    background-color: #222631;
    border-top: 1px solid #2e3340;
}

[data-theme="dark"] .text-dark,
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5 {
    color: #d1d5db !important;
}

[data-theme="dark"] .text-muted {
    color: #9ca3af !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #2a2f3c;
    border-color: #2e3340;
    color: #d1d5db;
}

[data-theme="dark"] .form-control::placeholder {
    color: #6b7280;
}

[data-theme="dark"] .btn-primary {
    background-color: #3b7ddd;
    border-color: #3b7ddd;
}

[data-theme="dark"] .btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
}

[data-theme="dark"] .btn-outline-secondary {
    color: #d1d5db;
    border-color: #6c757d;
}

[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #ffffff;
}

[data-theme="dark"] .alert-info {
    background-color: #1e3a5f;
    border-color: #2e5a8f;
    color: #d1d5db;
}

[data-theme="dark"] .alert-primary {
    background-color: rgba(59, 125, 221, 0.15);
    border-color: rgba(59, 125, 221, 0.3);
    color: #93bfef;
}

[data-theme="dark"] .alert-primary .badge.bg-white {
    background-color: rgba(59, 125, 221, 0.25) !important;
    color: #93bfef !important;
    border-color: rgba(59, 125, 221, 0.4) !important;
}

[data-theme="dark"] .alert-warning {
    background-color: rgba(255, 193, 7, 0.15);
    border-color: rgba(255, 193, 7, 0.3);
    color: #ffd966;
}

[data-theme="dark"] .alert-danger {
    background-color: #5f1e1e;
    border-color: #8f2e2e;
    color: #fca5a5;
}

[data-theme="dark"] .list-group-item {
    background-color: #2a2f3c;
    border-color: #2e3340;
    color: #d1d5db;
}

[data-theme="dark"] .dropdown-menu {
    background-color: #222631;
    border-color: #2e3340;
}

[data-theme="dark"] .dropdown-item {
    color: #d1d5db;
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: #2a2f3c;
}

/* Dark Mode - Login Page */
[data-theme="dark"] body {
    background-color: #1a1d24;
    color: #d1d5db;
}

[data-theme="dark"] .lead {
    color: #9ca3af !important;
}

[data-theme="dark"] .form-label {
    color: #d1d5db;
}

[data-theme="dark"] .card-body {
    background-color: #222631;
}

[data-theme="dark"] .spinner-border {
    color: #ffffff;
}

/* Sortable Table Headers */
.table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.table th.sortable:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .table th.sortable:hover {
    background-color: rgba(59, 125, 221, 0.12);
}

/* Table Action Buttons */
.table .btn-sm {
    transition: all 0.15s ease-in-out;
    border-radius: 0.25rem;
}

.table .btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.table .btn-sm:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.table .btn-primary:hover {
    background-color: #2c5daa;
    border-color: #2c5daa;
}

.table .btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

[data-theme="dark"] .table .btn-sm:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Pagination Styling */
.pagination {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    list-style: none;
    padding: 0;
    margin-top: 1rem;
    margin-bottom: 0;
    gap: 4px;
}

.pagination .page-item {
    display: inline-block;
}

.pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dee2e6;
    color: #3b7ddd;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
    cursor: pointer;
    background-color: white;
    min-width: 32px;
}

.pagination .page-link i[data-feather] {
    width: 14px;
    height: 14px;
    margin: 0 2px;
    vertical-align: middle;
}

.pagination .page-link:hover {
    background-color: #e7f1ff;
    color: #2c5daa;
    border-color: #3b7ddd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 125, 221, 0.15);
}

.pagination .page-item.active .page-link {
    background-color: #3b7ddd;
    border-color: #3b7ddd;
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(59, 125, 221, 0.3);
}

.pagination .page-item.disabled .page-link {
    color: #6c757d;
    background-color: transparent;
    border-color: #dee2e6;
    cursor: not-allowed;
    opacity: 0.5;
}

.pagination .page-item.disabled .page-link:hover {
    transform: none;
    box-shadow: none;
}

/* Dark Mode Pagination */
[data-theme="dark"] .pagination .page-link {
    background-color: #2a2f3c;
    border-color: #2e3340;
    color: #3b7ddd;
}

[data-theme="dark"] .pagination .page-link:hover {
    background-color: #3b7ddd;
    border-color: #3b7ddd;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 125, 221, 0.4);
}

[data-theme="dark"] .pagination .page-item.active .page-link {
    background-color: #3b7ddd;
    border-color: #3b7ddd;
    color: white;
    box-shadow: 0 2px 12px rgba(59, 125, 221, 0.5);
}

[data-theme="dark"] .pagination .page-item.disabled .page-link {
    background-color: #222631;
    border-color: #2e3340;
    color: #6c757d;
    opacity: 0.4;
}

[data-theme="dark"] .pagination .page-item.disabled .page-link:hover {
    background-color: #222631;
    color: #6c757d;
    transform: none;
    box-shadow: none;
}

/* Ingredient Suggestions Dropdown */
.ingredient-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    margin-top: 0.25rem;
    min-width: 250px;
    max-width: 400px;
}

/* Table cell overflow fix for dropdown */
.table td .position-relative {
    overflow: visible !important;
}

.ingredient-table {
    overflow: visible !important;
}

.ingredient-table table {
    overflow: visible !important;
}

.ingredient-suggestions .list-group {
    margin-bottom: 0;
    border-radius: 0.375rem;
}

.ingredient-suggestions .list-group-item {
    cursor: pointer;
    padding: 0.65rem 0.875rem;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    border-left-width: 0;
    border-right-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
}

.ingredient-suggestions .list-group-item:first-child {
    border-top-width: 1px;
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
}

.ingredient-suggestions .list-group-item:last-child {
    border-bottom-width: 1px;
    border-bottom-left-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

.ingredient-suggestions .list-group-item:hover {
    background-color: #e7f1ff;
    color: #2c5daa;
    transform: translateX(3px);
    font-weight: 500;
}

.ingredient-suggestions .list-group-item:active {
    background-color: var(--bs-primary);
    color: white;
}

.ingredient-suggestions .list-group-item i[data-feather] {
    color: #6c757d;
    flex-shrink: 0;
}

.ingredient-suggestions .list-group-item:hover i[data-feather] {
    color: var(--bs-primary);
}

/* Dark Mode - Ingredient Suggestions */
[data-theme="dark"] .ingredient-suggestions .list-group-item {
    background-color: #2a2f3c;
    border-color: #2e3340;
    color: #d1d5db;
}

[data-theme="dark"] .ingredient-suggestions .list-group-item:hover {
    background-color: rgba(59, 125, 221, 0.15);
    color: #93bfef;
}

[data-theme="dark"] .ingredient-suggestions .list-group-item:active {
    background-color: #3b7ddd;
    color: white;
}

[data-theme="dark"] .ingredient-suggestions .list-group-item i[data-feather] {
    color: #6b7280;
}

[data-theme="dark"] .ingredient-suggestions .list-group-item:hover i[data-feather] {
    color: #93bfef;
}

/* Prevent horizontal scroll on ingredient table */
.table-responsive.ingredient-table {
    overflow-x: visible !important;
    overflow-y: visible !important;
}

/* Custom scrollbar for suggestions dropdown */
.ingredient-suggestions::-webkit-scrollbar {
    width: 6px;
}

.ingredient-suggestions::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.ingredient-suggestions::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.ingredient-suggestions::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

[data-theme="dark"] .ingredient-suggestions::-webkit-scrollbar-track {
    background: #1a1d24;
}

[data-theme="dark"] .ingredient-suggestions::-webkit-scrollbar-thumb {
    background: #3e4451;
}

[data-theme="dark"] .ingredient-suggestions::-webkit-scrollbar-thumb:hover {
    background: #4e5563;
}
