/* Fitly MVC Admin Custom Styles */

/* Apple-inspired Ultra-Polished Design */

/* ==================== CSS VARIABLES ==================== */
:root {
  /* Fitly Brand Colors */
    --fitly-primary: #03A9F5;
    --fitly-primary-dark: #0288D1;
    --fitly-primary-light: #4FC3F7;
    
    /* Light Theme - Apple-inspired */
    --bs-body-bg: #fafafa;
    --bs-body-color: #1d1d1f;
    --bs-card-bg: #ffffff;
    --bs-card-border-color: rgba(0, 0, 0, 0.06);
    --bs-card-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    --bs-card-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.08);
    --bs-table-bg: #ffffff;
    --bs-table-striped-bg: rgba(0, 0, 0, 0.02);
    --bs-table-hover-bg: rgba(0, 0, 0, 0.04);
    --bs-border-color: rgba(0, 0, 0, 0.08);
    --bs-nav-link-color: #1d1d1f;
    --bs-dropdown-bg: #ffffff;
    --bs-dropdown-link-color: #1d1d1f;
    --bs-dropdown-link-hover-bg: #f5f5f7;
    --bs-input-bg: #ffffff;
    --bs-input-border: rgba(0, 0, 0, 0.12);
    --bs-modal-bg: #ffffff;
    --bs-btn-close-filter: none;
    
    /* Typography - SF Pro inspired */
    --bs-font-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-border-radius: 10px;
    --bs-border-radius-sm: 6px;
    --bs-border-radius-lg: 14px;
}

/* Dark Theme - Apple-inspired */
[data-bs-theme="dark"] {
    --bs-body-bg: #000000;
    --bs-body-color: #f5f5f7;
    --bs-card-bg: #1d1d1f;
    --bs-card-border-color: rgba(255, 255, 255, 0.08);
    --bs-card-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.4);
    --bs-card-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.4);
    --bs-table-bg: #1d1d1f;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.06);
    --bs-border-color: rgba(255, 255, 255, 0.1);
    --bs-nav-link-color: #f5f5f7;
    --bs-dropdown-bg: #1d1d1f;
    --bs-dropdown-link-color: #f5f5f7;
    --bs-dropdown-link-hover-bg: #2c2c2e;
    --bs-input-bg: #1d1d1f;
    --bs-input-border: rgba(255, 255, 255, 0.15);
    --bs-modal-bg: #1d1d1f;
    --bs-btn-close-filter: invert(1) grayscale(100%) brightness(200%);
}

/* ==================== GLOBAL STYLES ==================== */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    font-family: var(--bs-font-sans-serif);
    font-size: 15px;
    line-height: 1.47059;
    font-weight: 400;
    letter-spacing: -0.022em;
    min-height: 100vh;
    display: flex;
    /* Transitions handled by JavaScript after load to prevent flash */
}

main.main-content {
    flex: 1;
    min-width: 0;
    padding: 32px;
}

main {
    flex: 1;
    min-width: 0;
    padding: 32px 0;
}

/* ==================== TYPOGRAPHY ==================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

h1 { font-size: 2.5rem; line-height: 1.1; }
h2 { font-size: 2rem; line-height: 1.125; }
h3 { font-size: 1.75rem; line-height: 1.14286; }
h4 { font-size: 1.5rem; line-height: 1.16667; }
h5 { font-size: 1.25rem; line-height: 1.2; }
h6 { font-size: 1rem; line-height: 1.25; }

/* ==================== NAVBAR ==================== */
.navbar {
    background: var(--bs-card-bg) !important;
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--bs-border-color);
    padding: 8px 0;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    position: sticky;
    top: 0;
    z-index: 1020;
}

[data-bs-theme="dark"] .navbar {
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--bs-body-color) !important;
    transition: opacity 0.2s ease;
}

.navbar-brand:hover {
    opacity: 0.7;
}

.navbar-toggler {
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(3, 169, 245, 0.25);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(29, 29, 31, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

[data-bs-theme="dark"] .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(245, 245, 247, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.nav-link {
    color: var(--bs-nav-link-color) !important;
    font-size: 14px;
  font-weight: 400;
    padding: 8px 14px !important;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background-color: var(--bs-dropdown-link-hover-bg);
    color: var(--fitly-primary) !important;
}

.nav-link.active {
    font-weight: 500;
    color: var(--fitly-primary) !important;
}

.dropdown-menu {
    background-color: var(--bs-dropdown-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 8px;
    margin-top: 8px;
    animation: dropdownFadeIn 0.2s ease;
}

[data-bs-theme="dark"] .dropdown-menu {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

@keyframes dropdownFadeIn {
  from {
        opacity: 0;
      transform: translateY(-8px);
  }
    to {
        opacity: 1;
      transform: translateY(0);
    }
}

.dropdown-item {
    color: var(--bs-dropdown-link-color);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.15s ease;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--bs-dropdown-link-hover-bg);
    color: var(--fitly-primary);
}

.dropdown-item:active {
    background-color: var(--fitly-primary);
    color: white;
}

.dropdown-header {
    color: var(--bs-body-color);
    opacity: 0.6;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 14px 4px;
}

.dropdown-item-text {
    color: var(--bs-body-color);
    padding: 4px 14px 8px;
    font-size: 13px;
}

.dropdown-divider {
    margin: 8px 0;
    border-color: var(--bs-border-color);
}

/* ==================== CARDS ==================== */
.card {
    background-color: var(--bs-card-bg);
    border: 1px solid var(--bs-card-border-color);
    border-radius: var(--bs-border-radius);
    box-shadow: var(--bs-card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--bs-card-shadow-hover);
    transform: translateY(-2px);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--bs-border-color);
    padding: 20px 24px;
    font-weight: 600;
    font-size: 17px;
}

.card-body {
    padding: 24px;
}

.card-footer {
    background-color: transparent;
    border-top: 1px solid var(--bs-border-color);
    padding: 16px 24px;
}

/* ==================== BUTTONS ==================== */
.btn {
    font-size: 14px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    transition: all 0.2s ease;
    letter-spacing: -0.01em;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
    border-radius: 10px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--fitly-primary) 0%, var(--fitly-primary-dark) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(3, 169, 245, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--fitly-primary-light) 0%, var(--fitly-primary) 100%);
    box-shadow: 0 4px 16px rgba(3, 169, 245, 0.35);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline-primary {
    color: var(--fitly-primary);
    border: 1.5px solid var(--fitly-primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--fitly-primary);
    border-color: var(--fitly-primary);
color: white;
    box-shadow: 0 2px 8px rgba(3, 169, 245, 0.25);
}

.btn-secondary {
    background-color: var(--bs-dropdown-link-hover-bg);
color: var(--bs-body-color);
}

.btn-secondary:hover {
    background-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

/* ==================== FORMS ==================== */
.form-control,
.form-select {
    background-color: var(--bs-input-bg);
    border: 1.5px solid var(--bs-input-border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 15px;
    color: var(--bs-body-color);
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bs-input-bg);
    border-color: var(--fitly-primary);
    box-shadow: 0 0 0 4px rgba(3, 169, 245, 0.1);
    color: var(--bs-body-color);
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--bs-body-color);
}

.form-check-input {
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--bs-input-border);
  border-radius: 5px;
}

.form-check-input:checked {
    background-color: var(--fitly-primary);
    border-color: var(--fitly-primary);
}

/* ==================== TABLES ==================== */
.table {
    --bs-table-bg: var(--bs-table-bg);
    --bs-table-striped-bg: var(--bs-table-striped-bg);
    --bs-table-hover-bg: var(--bs-table-hover-bg);
    color: var(--bs-body-color);
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    border-bottom: 2px solid var(--bs-border-color);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px;
    color: var(--bs-body-color);
    opacity: 0.8;
}

.table tbody td {
    padding: 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--bs-border-color);
}

.table-hover tbody tr {
    transition: background-color 0.15s ease;
}

.table-hover tbody tr:hover {
  background-color: var(--bs-table-hover-bg);
}

/* ==================== BADGES ==================== */
.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ==================== MODALS ==================== */
.modal {
    z-index: 1055 !important;
}

.modal-backdrop {
    z-index: 1050 !important;
    background-color: #000;
}

.modal-backdrop.show {
    opacity: 0.6;
}

.modal-content {
  background-color: var(--bs-modal-bg);
    border: 1px solid var(--bs-card-border-color);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
    color: var(--bs-body-color);
    position: relative;
    z-index: 1;
    /* Prevent transforms from parent affecting stacking context */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

[data-bs-theme="dark"] .modal-content {
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.15);
}

.modal-header {
    border-bottom: 1px solid var(--bs-border-color);
    padding: 24px;
}

.modal-title {
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--bs-body-color);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
border-top: 1px solid var(--bs-border-color);
    padding: 20px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Ensure modal dialogs are centered and visible */
.modal-dialog {
    margin: 1.75rem auto;
  position: relative;
    z-index: 1;
}

.modal.fade .modal-dialog {
    transform: translate(0, -50px);
    transition: transform 0.3s ease-out;
}

.modal.show .modal-dialog {
    transform: none;
}

/* Fix for nested elements in modals */
.modal .btn-close {
    filter: var(--bs-btn-close-filter);
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.modal .btn-close:hover {
    opacity: 1;
}

/* Ensure forms inside modals don't break layout */
.modal-footer form {
    margin: 0;
    display: inline;
}

/* Fix for alerts in modals */
.modal .alert {
    margin-bottom: 0;
    margin-top: 16px;
}

/* ==================== ALERTS ==================== */
.alert {
    border-radius: 10px;
    border: none;
    padding: 16px 20px;
    font-size: 14px;
}

[data-bs-theme="light"] .alert-info {
    background-color: #e3f2fd;
    color: #0d47a1;
}

[data-bs-theme="light"] .alert-success {
 background-color: #e8f5e9;
    color: #1b5e20;
}

[data-bs-theme="light"] .alert-warning {
    background-color: #fff3e0;
    color: #e65100;
}

[data-bs-theme="light"] .alert-danger {
    background-color: #ffebee;
 color: #b71c1c;
}

[data-bs-theme="dark"] .alert-info {
    background-color: rgba(3, 169, 245, 0.15);
    color: #4fc3f7;
    border: 1px solid rgba(3, 169, 245, 0.3);
}

[data-bs-theme="dark"] .alert-success {
    background-color: rgba(76, 175, 80, 0.15);
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

[data-bs-theme="dark"] .alert-warning {
    background-color: rgba(255, 152, 0, 0.15);
    color: #ffb74d;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

[data-bs-theme="dark"] .alert-danger {
    background-color: rgba(244, 67, 54, 0.15);
    color: #e57373;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

/* ==================== LIST GROUPS ==================== */
.list-group-item {
    background-color: var(--bs-card-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
    padding: 16px 20px;
    transition: all 0.2s ease;
}

.list-group-item:first-child {
    border-top-left-radius: var(--bs-border-radius);
    border-top-right-radius: var(--bs-border-radius);
}

.list-group-item:last-child {
    border-bottom-left-radius: var(--bs-border-radius);
    border-bottom-right-radius: var(--bs-border-radius);
}

.list-group-item-action:hover {
    background-color: var(--bs-dropdown-link-hover-bg);
    transform: translateX(4px);
}

/* ==================== PAGINATION ==================== */
.pagination {
    gap: 4px;
}

.page-link {
    color: var(--bs-body-color);
    background-color: var(--bs-card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.page-link:hover {
    background-color: var(--bs-dropdown-link-hover-bg);
    border-color: var(--fitly-primary);
    color: var(--fitly-primary);
}

.page-item.active .page-link {
    background-color: var(--fitly-primary);
    border-color: var(--fitly-primary);
    color: white;
}

.page-item.disabled .page-link {
    opacity: 0.4;
}

/* ==================== THEME TOGGLE ==================== */
.theme-toggle {
    cursor: pointer;
    font-size: 1.1rem;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--bs-nav-link-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background-color: var(--bs-dropdown-link-hover-bg);
    color: var(--fitly-primary);
}

/* ==================== CUSTOM COMPONENTS ==================== */
.stat-card {
    text-align: center;
    padding: 24px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-card i {
    font-size: 2.5rem;
    margin-bottom: 16px;
    opacity: 0.9;
}

.stat-card h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 8px 0;
    letter-spacing: -0.03em;
}

.stat-card p {
    font-size: 14px;
    font-weight: 500;
    margin: 0;
    opacity: 0.7;
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
     opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease;
}

/* ==================== UTILITIES ==================== */
.glass-effect {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: saturate(180%) blur(20px);
 -webkit-backdrop-filter: saturate(180%) blur(20px);
}

[data-bs-theme="dark"] .glass-effect {
    background: rgba(29, 29, 31, 0.8);
}

.text-gradient {
    background: linear-gradient(135deg, var(--fitly-primary) 0%, var(--fitly-primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    
    .card-body {
     padding: 20px;
    }
    
    main {
        padding: 20px 0;
    }
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 10px;
height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bs-body-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--bs-border-color);
 border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--fitly-primary);
}

/* ==================== LOADING STATES ==================== */
.btn.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== FOOTER ==================== */
.footer {
    background-color: var(--bs-card-bg);
    border-top: 1px solid var(--bs-border-color);
    margin-top: auto;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.footer-text {
  color: var(--bs-body-color);
    opacity: 0.7;
  font-size: 14px;
    transition: opacity 0.2s ease;
}

.footer-text:hover {
 opacity: 1;
}

[data-bs-theme="dark"] .footer {
    background-color: var(--bs-card-bg);
}

/* ==================== ALERT CLOSE BUTTON ==================== */
.btn-close {
    filter: var(--bs-btn-close-filter);
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.btn-close:hover {
    opacity: 1;
}

[data-bs-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ==================== FORM ELEMENTS - ENHANCED ==================== */
.form-control:disabled,
.form-select:disabled {
    background-color: var(--bs-dropdown-link-hover-bg);
    opacity: 0.6;
}

textarea.form-control {
    resize: vertical;
}

/* ==================== TEXT UTILITIES ==================== */
.text-muted {
    color: var(--bs-body-color) !important;
    opacity: 0.65;
}

.text-body {
    color: var(--bs-body-color) !important;
}

/* ==================== NAVBAR DROPDOWN BUTTON FIX ==================== */
.navbar .dropdown-toggle::after {
    border-top-color: var(--bs-nav-link-color);
}

/* ==================== RESPONSIVE NAVIGATION ==================== */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0 !important;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

/* ==================== CONFIRMATION ICONS ==================== */
.confirmation-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.confirmation-icon i {
    font-size: 1.1rem;
}

.confirmation-icon-yes {
    color: #4caf50;
}

.confirmation-icon-no {
    color: #f44336;
}

/* ==================== STATUS BADGES ==================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.status-badge-active {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.25);
}

.status-badge-inactive {
    background: var(--bs-dropdown-link-hover-bg);
    color: var(--bs-body-color);
    opacity: 0.8;
}

.status-badge-locked {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.25);
}

.status-badge-deleted {
    background: linear-gradient(135deg, #f44336 0%, #c62828 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.25);
}

.status-badge-premium {
    background: linear-gradient(135deg, #ffd700 0%, #ffb300 100%);
    color: #000;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.35);
}

/* ==================== USER DETAILS - ACTION ITEMS ==================== */
.action-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 14px;
    text-decoration: none;
    color: var(--bs-body-color);
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    transition: all 0.2s ease;
}

.action-item:hover {
    background: var(--bs-dropdown-link-hover-bg);
    color: var(--fitly-primary);
    transform: translateX(4px);
}

.action-item i {
    min-width: 20px;
    text-align: center;
}

.action-item-danger:hover {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
}

.action-item-warning:hover {
    background: rgba(255, 152, 0, 0.1);
    color: #ff9800;
}

.action-item-success:hover {
    background: rgba(76, 175, 80, 0.1);
    color: #4caf50;
}

/* ==================== EQUIPMENT & MUSCLES CARDS ==================== */
.equipment-card {
    background: var(--bs-card-bg);
    border: 1.5px solid var(--bs-border-color);
  border-radius: 8px;
    padding: 12px 16px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.equipment-card:hover {
 border-color: var(--fitly-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(3, 169, 245, 0.15);
}

.equipment-card i {
    font-size: 1.25rem;
 color: #4caf50;
}

.equipment-card .equipment-name {
  font-weight: 600;
 font-size: 14px;
    color: var(--bs-body-color);
}

.equipment-card .equipment-desc {
    font-size: 12px;
    color: var(--bs-body-color);
    opacity: 0.7;
    margin-top: 2px;
}

/* Dark theme equipment cards */
[data-bs-theme="dark"] .equipment-card {
    background: var(--bs-card-bg);
}

[data-bs-theme="dark"] .exercise-set-header {
    background: #2c2c2e;
}

[data-bs-theme="dark"] .info-section {
    background: #2c2c2e;
}

[data-bs-theme="dark"] .routine-setting-item {
 background: #2c2c2e;
}

[data-bs-theme="dark"] .table-enhanced thead th {
    background: #2c2c2e;
}

[data-bs-theme="dark"] .table-light {
    --bs-table-bg: #2c2c2e;
    --bs-table-color: var(--bs-body-color);
}

[data-bs-theme="dark"] .table-light th {
    color: var(--bs-body-color) !important;
}

/* Additional dark theme fixes */
[data-bs-theme="dark"] .card-header {
    background-color: transparent !important;
}

[data-bs-theme="dark"] .muscle-section-title {
 color: var(--bs-body-color);
}

[data-bs-theme="dark"] .equipment-desc {
    color: var(--bs-body-color);
}

/* Ensure no light backgrounds leak through */
[data-bs-theme="dark"] .bg-light {
    background-color: #2c2c2e !important;
}

[data-bs-theme="dark"] .text-muted {
    color: var(--bs-body-color) !important;
    opacity: 0.65;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    background-color: var(--bs-card-bg);
    border-right: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--bs-border-color);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--bs-body-color);
    font-weight: 600;
    font-size: 1.15rem;
    letter-spacing: -0.03em;
    transition: opacity 0.2s ease;
}

.sidebar-brand:hover {
    opacity: 0.7;
    color: var(--bs-body-color);
}

.sidebar-brand-icon {
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    min-width: 0;
    padding: 12px 12px 24px;
    overflow-y: auto;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bs-body-color);
    opacity: 0.45;
    padding: 20px 12px 6px;
    margin: 0;
}

.sidebar-menu-item {
    margin-bottom: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--bs-body-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: all 0.15s ease;
    cursor: pointer;
}

.sidebar-link:hover {
    background-color: var(--bs-dropdown-link-hover-bg);
    color: var(--fitly-primary);
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(3, 169, 245, 0.12), rgba(3, 169, 245, 0.06));
    color: var(--fitly-primary);
    font-weight: 500;
}

.sidebar-link i:first-child {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-chevron {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.sidebar-link[aria-expanded="true"] .sidebar-chevron {
    transform: rotate(180deg);
}

.sidebar-submenu {
    list-style: none;
    padding: 2px 0 4px 0;
    margin: 0;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    padding: 7px 12px 7px 44px;
    border-radius: 6px;
    color: var(--bs-body-color);
    opacity: 0.8;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.15s ease;
}

.sidebar-sublink:hover {
    background-color: var(--bs-dropdown-link-hover-bg);
    color: var(--fitly-primary);
    opacity: 1;
}

.sidebar-sublink.active {
    color: var(--fitly-primary);
    font-weight: 500;
    opacity: 1;
}

/* ==================== SIDEBAR BLADES ==================== */
.sidebar-blade {
    margin-bottom: 2px;
}

.sidebar-blade-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--bs-body-color);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-top: 4px;
}

.sidebar-blade-toggle:hover {
    background-color: var(--bs-dropdown-link-hover-bg);
    color: var(--fitly-primary);
}

.sidebar-blade-toggle.active {
    color: var(--fitly-primary);
}

.sidebar-blade-toggle i:first-child {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-blade-toggle.active i:first-child {
    opacity: 1;
}

.sidebar-blade-toggle[aria-expanded="true"] .sidebar-chevron {
    transform: rotate(180deg);
}

.sidebar-blade-menu {
    list-style: none;
    padding: 2px 0 6px 0;
    margin: 0;
}

.sidebar-blade-menu .sidebar-menu-item {
    margin-bottom: 1px;
}

.sidebar-blade-menu .sidebar-link {
    padding: 8px 12px 8px 16px;
    font-size: 13.5px;
}

.sidebar-blade-menu .sidebar-sublink {
    padding: 6px 12px 6px 36px;
    font-size: 13px;
}

/* Sub-group labels inside blades (e.g., CRM > Core, Sales, Marketing) */
.sidebar-subgroup-header {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--bs-body-color);
    opacity: 0.35;
    padding: 12px 12px 3px 36px;
    margin: 0;
    list-style: none;
}

.sidebar-subgroup-header:first-of-type {
    padding-top: 4px;
}

/* ==================== MAIN WRAPPER ==================== */
.main-wrapper {
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    min-width: 0;
}

.main-wrapper.sidebar-collapsed {
    margin-left: 0;
}

/* ==================== TOPBAR ==================== */
.topbar {
    padding: 8px 0;
}

.topbar-title {
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
    color: var(--bs-body-color);
}

.sidebar-toggle-btn {
    color: var(--bs-body-color);
    text-decoration: none;
    border: none;
    line-height: 1;
    transition: color 0.2s ease;
}

.sidebar-toggle-btn:hover {
    color: var(--fitly-primary);
}

/* ==================== SIDEBAR OVERLAY ==================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1035;
    backdrop-filter: blur(2px);
}

/* ==================== SIDEBAR SCROLLBAR ==================== */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--bs-border-color);
    border-radius: 2px;
}

/* ==================== DASHBOARD TILES ==================== */
.dashboard-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    min-height: 60px;
}

.dashboard-tile {
    background-color: var(--bs-card-bg);
    border: 1px solid var(--bs-card-border-color);
    border-radius: var(--bs-border-radius);
    box-shadow: var(--bs-card-shadow);
    padding: 20px;
    cursor: grab;
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    user-select: none;
    position: relative;
}

.dashboard-tile:hover {
    box-shadow: var(--bs-card-shadow-hover);
    transform: translateY(-2px);
}

.dashboard-tile.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: scale(1.02);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.dashboard-tile .tile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.dashboard-tile .tile-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.dashboard-tile .tile-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.dashboard-tile:hover .tile-actions {
    opacity: 1;
}

.dashboard-tile .tile-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bs-dropdown-link-hover-bg);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--bs-body-color);
    font-size: 0.85rem;
    transition: all 0.15s ease;
    padding: 0;
}

.dashboard-tile .tile-action-btn:hover {
    background: var(--fitly-primary);
    color: white;
}

.dashboard-tile .tile-action-btn.pinned {
    color: var(--fitly-primary);
}

.dashboard-tile .tile-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--bs-body-color);
}

.dashboard-tile .tile-desc {
    font-size: 12px;
    color: var(--bs-body-color);
    opacity: 0.6;
    margin-bottom: 12px;
    line-height: 1.4;
}

.dashboard-tile .tile-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--fitly-primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: gap 0.15s ease;
}

.dashboard-tile .tile-link:hover {
    gap: 8px;
}

.dashboard-tiles .drag-placeholder {
    border: 2px dashed var(--fitly-primary);
    border-radius: var(--bs-border-radius);
    background: rgba(3, 169, 245, 0.05);
    min-height: 120px;
}

@media (max-width: 768px) {
    .dashboard-tiles {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   CRM Mobile Responsive Refinements
   ============================================================ */

/* Stack CRM dashboard header buttons vertically on small screens */
@media (max-width: 576px) {
    .main-content .d-flex.justify-content-between.mb-4 {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.5rem;
    }

    .main-content .d-flex.justify-content-between.mb-4 > div {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .main-content .d-flex.justify-content-between.mb-4 > div .btn {
        flex: 1;
        min-width: 0;
        font-size: 0.8rem;
    }
}

/* CRM tables: horizontal scroll on mobile */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.85rem;
    }

    .table-responsive th,
    .table-responsive td {
        white-space: nowrap;
        padding: 0.4rem 0.5rem;
    }

    /* Keep every column and action available through horizontal scrolling. */
}

/* CRM cards: full width on mobile */
@media (max-width: 576px) {
    .card {
        min-width: 0;
    }

    .card-header {
        font-size: 0.9rem;
    }

    /* Suggestion cards stack fully */
    .row.g-3 > [class*="col-md-6"] {
        padding-left: 0;
        padding-right: 0;
    }
}

/* CRM Pipeline kanban: horizontal scroll on mobile */
@media (max-width: 768px) {
    .pipeline-stages {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        display: flex;
        gap: 0.5rem;
        padding-bottom: 1rem;
    }

    .pipeline-stages > .pipeline-stage {
        min-width: 280px;
        flex-shrink: 0;
        scroll-snap-align: start;
    }
}

/* CRM form fields: stack on mobile */
@media (max-width: 576px) {
    .row.g-3 > [class*="col-md-"] {
        margin-bottom: 0.25rem;
    }

    .form-label {
        font-size: 0.85rem;
    }

    .btn-sm {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }
}

/* Compact badge display on mobile */
@media (max-width: 576px) {
    .badge {
        font-size: 0.7rem;
        padding: 0.2em 0.4em;
    }
}

/* CRM search bar: full width on mobile */
@media (max-width: 576px) {
    .input-group .form-control {
        font-size: 0.9rem;
    }
}

/* Progress bars in lead scores: thinner on mobile */
@media (max-width: 576px) {
    .progress {
        height: 16px !important;
        font-size: 0.7rem;
    }
}

/* Touch-friendly tap targets */
@media (max-width: 768px) {
    .btn {
        min-height: 38px;
    }

    .list-group-item {
        padding: 0.75rem 1rem;
    }

    .sidebar-sublink {
        padding: 0.5rem 1rem;
    }
}

/* Pagination must remain reachable when a list has many pages. */
.pagination { flex-wrap: wrap; row-gap: .25rem; }
@media (max-width: 576px) {
    .main-content .d-flex.justify-content-between.mb-4 > .d-flex { flex-wrap: wrap; }
}
