/**
 * Tenant Dashboard Styles
 * Horizontal Navigation & Modern Layout
 */

:root {
    --tenant-primary: #667eea;
    --tenant-primary-dark: #5568d3;
    --tenant-secondary: #764ba2;
    --tenant-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --tenant-success: #28a745;
    --tenant-warning: #ffc107;
    --tenant-danger: #dc3545;
    --tenant-info: #17a2b8;
    --tenant-light: #f8f9fa;
    --tenant-dark: #343a40;
    --navbar-height: 56px;
    --sidebar-mobile-width: 280px;
}

/* ========================================
   Global Layout
   ======================================== */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f4f6f9;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

.tenant-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ========================================
   Horizontal Top Navigation
   ======================================== */

.tenant-navbar {
    background: white;
    height: var(--navbar-height);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    width: 100%;
    max-width: 100vw;
    overflow: visible; /* Changed to visible to show dropdowns */
}

@media (min-width: 768px) {
    .tenant-navbar {
        padding: 0 1.5rem;
    }
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Brand/Logo Section - Compact */
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--tenant-dark);
    font-weight: 700;
    font-size: 1.15rem;
    flex-shrink: 0;
    max-width: 280px; /* Allow more space for company name */
}

.navbar-logo {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tenant-gradient);
    border-radius: 0.45rem;
    color: white;
    font-size: 1.15rem;
    flex-shrink: 0;
    overflow: hidden;
}

.navbar-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--tenant-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 230px; /* Prevent extremely long names from breaking layout */
}

.navbar-brand i {
    font-size: 1.5rem;
}

.navbar-brand-text {
    display: flex;
    flex-direction: column;
}

.brand-company {
    font-size: 1rem;
    line-height: 1.2;
}

.brand-plan {
    font-size: 0.7rem;
    font-weight: 500;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.brand-plan.trial {
    color: var(--tenant-warning);
}

.brand-plan.active {
    color: var(--tenant-success);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--tenant-dark);
    cursor: pointer;
    padding: 0.5rem;
}

/* Show mobile menu toggle and hide desktop nav on smaller screens */
@media (max-width: 1100px) {
    .mobile-menu-toggle {
        display: block;
    }

    .navbar-menu {
        display: none;
    }

    .navbar-brand {
        max-width: 200px;
    }

    .navbar-title {
        max-width: 150px;
    }
}

/* Navigation Menu - Compact Version */
.navbar-menu {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
    gap: 0rem;
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    overflow-y: visible; /* Changed from hidden to visible to show dropdowns */
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.3) transparent;
    -ms-overflow-style: auto;
    flex-wrap: nowrap;
}

.navbar-menu::-webkit-scrollbar {
    height: 4px;
}

.navbar-menu::-webkit-scrollbar-track {
    background: transparent;
}

.navbar-menu::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 2px;
}

.navbar-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

@media (min-width: 992px) {
    .navbar-menu {
        gap: 0.1rem;
    }
}

@media (min-width: 1100px) and (max-width: 1399px) {
    /* More compact for screens with many nav items like distribution */
    .navbar-menu {
        gap: 0;
    }

    .tenant-nav-link,
    .nav-dropdown-toggle {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }

    .tenant-nav-link i,
    .nav-dropdown-toggle i {
        font-size: 0.85rem;
    }
}

@media (min-width: 1200px) {
    .navbar-menu {
        gap: 0.15rem;
    }
}

.nav-item {
    position: relative;
}

.tenant-nav-link {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.6rem;
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.tenant-nav-link:hover {
    color: var(--tenant-primary);
    background-color: rgba(102, 126, 234, 0.08);
}

.tenant-nav-link.active {
    color: var(--tenant-primary);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.12) 100%);
    font-weight: 600;
}

.tenant-nav-link i {
    font-size: 0.9rem;
}

@media (min-width: 992px) {
    .tenant-nav-link {
        padding: 0.5rem 0.65rem;
        font-size: 0.8rem;
    }
}

@media (min-width: 1200px) {
    .tenant-nav-link {
        padding: 0.55rem 0.75rem;
        font-size: 0.85rem;
        gap: 0.4rem;
    }

    .tenant-nav-link i {
        font-size: 0.95rem;
    }
}

@media (min-width: 1400px) {
    .tenant-nav-link {
        padding: 0.6rem 0.85rem;
        font-size: 0.875rem;
    }
}

/* Navigation items now use simple flat structure - no dropdown needed */

/* Right Side Actions */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Search Bar */
.navbar-search {
    position: relative;
    display: none; /* Hide on smaller screens, show on larger */
}

@media (min-width: 1200px) {
    .navbar-search {
        display: block;
    }
}

.navbar-search input {
    border: 1px solid #e0e0e0;
    border-radius: 2rem;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    width: 200px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.navbar-search input:focus {
    width: 280px;
    border-color: var(--tenant-primary);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.1);
    outline: none;
}

.navbar-search i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 0.9rem;
}

/* Notification Icon */
.navbar-icon-btn {
    position: relative;
    background: none;
    border: none;
    color: #6c757d;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.navbar-icon-btn:hover {
    background-color: #f8f9fa;
    color: var(--tenant-primary);
}

.notification-badge {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background-color: var(--tenant-danger);
    color: white;
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
    border-radius: 1rem;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* User Menu */
.user-menu {
    position: relative;
    display: inline-block;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    background: none;
    border: none;
    color: inherit;
}

.user-menu-btn:hover {
    background-color: #f8f9fa;
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    z-index: 10000;
}

/* Click-based activation instead of hover */
.user-menu.active .user-menu-dropdown {
    display: block;
}

.user-menu-header {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.user-menu-name {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
}

.user-menu-contact {
    font-size: 0.875rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.25rem;
}

.user-menu-email {
    font-size: 0.75rem;
    color: #6c757d;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #495057;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.15s ease;
}

.user-menu-item:hover {
    background-color: #f8f9ff;
    color: var(--tenant-primary);
}

.user-menu-item i {
    width: 18px;
    text-align: center;
}

.user-menu-divider {
    height: 1px;
    background-color: #e9ecef;
    margin: 0.5rem 0;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--tenant-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--tenant-dark);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hide user email on very small screens */
@media (max-width: 768px) {
    .user-name {
        display: none;
    }
}

.user-role {
    font-size: 0.75rem;
    color: #6c757d;
}

/* ========================================
   Mobile Sidebar (for small screens)
   ======================================== */

.tenant-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: var(--sidebar-mobile-width);
    height: 100vh;
    background: white;
    z-index: 1100;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    overflow-y: auto;
}

.tenant-sidebar.active {
    left: 0;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--tenant-dark);
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--tenant-dark);
    cursor: pointer;
    padding: 0.25rem;
}

.sidebar-menu {
    padding: 1rem;
}

.sidebar-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    color: #6c757d;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
}

.sidebar-menu-item:hover {
    background-color: #f8f9ff;
    color: var(--tenant-primary);
}

.sidebar-menu-item.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: var(--tenant-primary);
    font-weight: 600;
}

.sidebar-menu-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    display: none;
}

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

/* ========================================
   Main Content Area
   ======================================== */

/* Prevent horizontal overflow */
html, body {
    overflow-x: hidden;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.tenant-content {
    flex: 1;
    background-color: #f4f6f9;
    min-height: calc(100vh - var(--navbar-height));
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

/* STANDARDIZED CONTENT WRAPPER - All pages must use this */
.content-wrapper {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 1.25rem;
    }
}

/* Page Header - STANDARDIZED */
.page-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    min-width: 0;
    overflow: hidden;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--tenant-dark);
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-subtitle {
    color: #6c757d;
    font-size: 0.95rem;
}

.page-header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ========================================
   Statistics Cards
   ======================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: 0.625rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-left: 3px solid #e9ecef;
    transition: all 0.25s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(102, 126, 234, 0.03) 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card.stat-primary {
    border-left-color: #667eea;
}

.stat-card.stat-success {
    border-left-color: #10b981;
}

.stat-card.stat-info {
    border-left-color: #3b82f6;
}

.stat-card.stat-warning {
    border-left-color: #f59e0b;
}

.stat-card.stat-secondary {
    border-left-color: #6366f1;
}

.stat-card.stat-danger {
    border-left-color: #ef4444;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    flex-shrink: 0;
    position: relative;
}

.stat-card.stat-primary .stat-icon {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: #667eea;
}

.stat-card.stat-success .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.stat-card.stat-info .stat-icon {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.stat-card.stat-warning .stat-icon {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.stat-card.stat-secondary .stat-icon {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.stat-card.stat-danger .stat-icon {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-label {
    color: #6b7280;
    font-size: 0.813rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.125rem;
    line-height: 1;
}

.stat-subtitle {
    color: #9ca3af;
    font-size: 0.75rem;
    font-weight: 500;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
}

.stat-change.positive {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.stat-change.negative {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.stat-change.neutral {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

/* ========================================
   Quick Actions Grid
   ======================================== */

.quick-actions {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    margin-bottom: 2rem;
}

.quick-actions-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--tenant-dark);
    margin-bottom: 1.25rem;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.quick-action {
    background: white;
    border: 2px dashed #e0e0e0;
    border-radius: 0.75rem;
    padding: 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: #6c757d;
}

.quick-action:hover {
    border-color: var(--tenant-primary);
    background-color: #f8f9ff;
    color: var(--tenant-primary);
    transform: translateY(-3px);
}

.quick-action i {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    display: block;
}

.quick-action-label {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Quick Action Items (for dashboard) */
.quick-action-item {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 0.75rem;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    color: #495057;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.quick-action-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.quick-action-item i {
    font-size: 2rem;
    display: block;
}

/* Quick Action Color Variants */
.quick-action-item.quick-action-primary {
    border-color: rgba(102, 126, 234, 0.3);
}

.quick-action-item.quick-action-primary:hover {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    color: #667eea;
}

.quick-action-item.quick-action-success {
    border-color: rgba(16, 185, 129, 0.3);
}

.quick-action-item.quick-action-success:hover {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
    color: #10b981;
}

.quick-action-item.quick-action-info {
    border-color: rgba(59, 130, 246, 0.3);
}

.quick-action-item.quick-action-info:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
    color: #3b82f6;
}

.quick-action-item.quick-action-warning {
    border-color: rgba(245, 158, 11, 0.3);
}

.quick-action-item.quick-action-warning:hover {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
    color: #f59e0b;
}

.quick-action-item.quick-action-secondary {
    border-color: rgba(99, 102, 241, 0.3);
}

.quick-action-item.quick-action-secondary:hover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.05);
    color: #6366f1;
}

.quick-action-item.quick-action-danger {
    border-color: rgba(239, 68, 68, 0.3);
}

.quick-action-item.quick-action-danger:hover {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
    color: #ef4444;
}

/* ========================================
   Content Cards - STANDARDIZED
   ======================================== */

.content-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    margin-bottom: 2rem;
}

.card-header-custom {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--tenant-dark);
    margin: 0;
}

.card-body-custom {
    padding: 1.5rem;
}

/* STANDARDIZED VIEW CONTAINER - For view/detail pages */
.view-container {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    margin-bottom: 2rem;
}

.view-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.view-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.view-header-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.view-header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.view-content {
    padding: 2rem;
}

@media (max-width: 768px) {
    .view-header {
        padding: 1.25rem;
    }

    .view-content {
        padding: 1.25rem;
    }

    .view-header-title {
        font-size: 1.25rem;
    }
}

/* STANDARDIZED FORM CONTAINER - For form/create/edit pages */
.form-container {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    padding: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .form-container {
        padding: 1.25rem;
    }
}

/* ========================================
   Buttons
   ======================================== */

.btn-tenant {
    background: var(--tenant-gradient);
    border: none;
    color: white;
    padding: 0.625rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-tenant:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
    color: white;
}

.btn-tenant-outline {
    background: transparent;
    border: 2px solid var(--tenant-primary);
    color: var(--tenant-primary);
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-tenant-outline:hover {
    background: var(--tenant-primary);
    color: white;
}

/* ========================================
   Activity Feed
   ======================================== */

.activity-feed {
    max-height: 500px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #e9ecef;
}

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

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon.primary {
    background-color: #e3f2fd;
    color: var(--tenant-primary);
}

.activity-icon.success {
    background-color: #e8f5e9;
    color: var(--tenant-success);
}

.activity-icon.warning {
    background-color: #fff3e0;
    color: var(--tenant-warning);
}

.activity-icon.danger {
    background-color: #ffebee;
    color: var(--tenant-danger);
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    color: var(--tenant-dark);
    margin-bottom: 0.25rem;
}

.activity-description {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.activity-time {
    font-size: 0.75rem;
    color: #adb5bd;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 991px) {
    .navbar-menu {
        display: none;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .user-info {
        display: none;
    }

    .navbar-search {
        display: none;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .navbar-title {
        font-size: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.125rem;
    }

    .page-title {
        font-size: 1.5rem;
    }
}

@media (min-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* ========================================
   Utilities
   ======================================== */

.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-top-color: var(--tenant-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Custom Scrollbar */
.activity-feed::-webkit-scrollbar {
    width: 6px;
}

.activity-feed::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.activity-feed::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 3px;
}

.activity-feed::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

/* ========================================
   Navigation Dropdown Menus
   ======================================== */

/* Dropdown Container */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

/* Dropdown Toggle Button - Compact Version */
.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.6rem;
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
}

.nav-dropdown-toggle:hover {
    color: var(--tenant-primary);
    background-color: rgba(102, 126, 234, 0.08);
}

.nav-dropdown.active .nav-dropdown-toggle {
    color: var(--tenant-primary);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.12) 100%);
    font-weight: 600;
}

/* Highlight parent when on a submenu page without opening dropdown */
.nav-dropdown.has-active-child .nav-dropdown-toggle,
.nav-dropdown-toggle.has-active-child {
    color: var(--tenant-primary);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.12) 100%);
    font-weight: 600;
}

.nav-dropdown-toggle i {
    font-size: 0.9rem;
}

/* Dropdown Arrow Animation */
.dropdown-arrow {
    transition: transform 0.2s ease;
    font-size: 0.7rem;
    margin-left: 0.1rem;
}

.nav-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.nav-dropdown-menu {
    display: none;
    position: fixed; /* Changed from absolute to fixed for better visibility */
    margin-top: 0.5rem;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 10000;
    padding: 0.5rem 0;
}

.nav-dropdown.active .nav-dropdown-menu {
    display: block;
}

/* Dropdown Items */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    color: #495057;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.dropdown-item:hover {
    background-color: #f8f9ff;
    color: var(--tenant-primary);
}

.dropdown-item.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: var(--tenant-primary);
    font-weight: 600;
}

.dropdown-item i {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
}

/* Responsive Dropdown Adjustments */
@media (min-width: 992px) {
    .nav-dropdown-toggle {
        padding: 0.5rem 0.65rem;
        font-size: 0.8rem;
    }
}

@media (min-width: 1200px) {
    .nav-dropdown-toggle {
        padding: 0.55rem 0.75rem;
        font-size: 0.85rem;
        gap: 0.4rem;
    }

    .nav-dropdown-toggle i {
        font-size: 0.95rem;
    }

    .dropdown-arrow {
        font-size: 0.75rem;
    }
}

@media (min-width: 1400px) {
    .nav-dropdown-toggle {
        padding: 0.6rem 0.85rem;
        font-size: 0.875rem;
    }

    .nav-dropdown-menu {
        min-width: 220px;
    }

    .dropdown-item {
        padding: 0.8rem 1.15rem;
        font-size: 0.875rem;
    }
}

/* ========================================
   Toast Notifications
   ======================================== */

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 280px;
    max-width: 400px;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    font-weight: 500;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateX(calc(100% + 40px));
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.active {
    transform: translateX(0);
    opacity: 1;
}

.toast-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.toast-success::before {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 1.25rem;
}

.toast-error {
    background: linear-gradient(135deg, #dc3545 0%, #e74c3c 100%);
    color: white;
}

.toast-error::before {
    content: '\f00d';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 1.25rem;
}

.toast-warning {
    background: linear-gradient(135deg, #ffc107 0%, #f39c12 100%);
    color: #212529;
}

.toast-warning::before {
    content: '\f071';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 1.25rem;
}

.toast-info {
    background: linear-gradient(135deg, #17a2b8 0%, #3498db 100%);
    color: white;
}

.toast-info::before {
    content: '\f05a';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 1.25rem;
}

@media (max-width: 768px) {
    .toast {
        left: 1rem;
        right: 1rem;
        min-width: auto;
        max-width: none;
        top: auto;
        bottom: 20px;
        transform: translateY(calc(100% + 40px));
    }

    .toast.active {
        transform: translateY(0);
    }
}

/* Toast animations for dynamic toasts */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}