/* Modern Layout Styles - Glassmorphism Design */

/* Fixed navbar spacing - removed margin-top to prevent issues with auth pages */
.main-content {
    margin-top: 0;
    min-height: 100vh;
}

/* Auth pages content - no margin for full screen */
.auth-main-content {
    margin-top: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

/* Pages with minimal spacing */
.page-with-navbar {
    padding-top: 10px;
}

@media (max-width: 991.98px) {
    .page-with-navbar {
        padding-top: 10px;
    }
}

@media (max-width: 576px) {
    .page-with-navbar {
        padding-top: 10px;
    }
}

/* All pages now have minimal 10px padding-top */

.modern-main {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    min-height: 100vh;
}

/* Modern Glassmorphism Navbar */
.modern-navbar {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
    position: relative;
}

[data-theme="dark"] .modern-navbar {
    background: rgba(26, 26, 26, 0.8) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Modern Brand */
.modern-brand {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-primary) !important;
    text-decoration: none;
    transition: all 0.3s ease;
}

.modern-brand:hover {
    color: var(--primary-color) !important;
    transform: translateY(-2px);
}

.brand-icon {
    width: 100%;
    max-width: 160px;
    height: 40px;
    background: transparent;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: all 0.3s ease;
    overflow: hidden;
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    max-width: 100px;
}

.modern-brand:hover .brand-icon {
    transform: rotate(5deg) scale(1.05);
}

.brand-text {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* Modern Toggle Button */
.modern-toggler {
    border: none;
    background: transparent;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.modern-toggler:hover {
    background: rgba(255, 255, 255, 0.1);
}

.toggler-icon {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--text-primary);
    margin: 5px 0;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.modern-toggler[aria-expanded="true"] .toggler-icon:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.modern-toggler[aria-expanded="true"] .toggler-icon:nth-child(2) {
    opacity: 0;
}

.modern-toggler[aria-expanded="true"] .toggler-icon:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Modern Navigation Links */
.modern-nav-link {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem !important;
    margin: 0 0.25rem;
    border-radius: 12px;
    font-weight: 500;
    color: var(--text-secondary) !important;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.modern-nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.modern-nav-link:hover::before {
    left: 100%;
}

.modern-nav-link:hover {
    color: var(--primary-color) !important;
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.modern-nav-link.active {
    color: var(--primary-color) !important;
    background: rgba(102, 126, 234, 0.15);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

.modern-nav-link i {
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.modern-nav-link:hover i {
    transform: scale(1.1);
}

/* Modern Dropdown */
.modern-dropdown {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    overflow: hidden;
    min-width: 220px;
    max-width: 300px;
    z-index: 1050;
}

[data-theme="dark"] .modern-dropdown {
    background: rgba(26, 26, 26, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modern-dropdown-item {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem !important;
    color: var(--text-primary) !important;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    background: transparent;
    width: 100%;
}

.modern-dropdown-item:hover {
    background: rgba(102, 126, 234, 0.1) !important;
    color: var(--primary-color) !important;
    transform: translateX(8px);
}

.modern-dropdown-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

/* Dropdown header improvements */
.modern-dropdown .dropdown-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.75rem 1rem;
  margin: -0.5rem -0.5rem 0.5rem -0.5rem;
  border-radius: 16px 16px 0 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modern-dropdown .dropdown-header i {
  font-size: 1rem;
  opacity: 0.9;
}

/* Dropdown divider improvements */
.modern-dropdown .dropdown-divider {
  margin: 0.5rem 0;
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .modern-dropdown .dropdown-divider {
  border-color: rgba(255, 255, 255, 0.1);
}

/* Role-specific styling */
.modern-dropdown-item[href*="admin"] {
  color: #dc3545;
}

.modern-dropdown-item[href*="professional"] {
  color: #0d6efd;
}

.modern-dropdown-item[href*="client"] {
  color: #198754;
}

.modern-dropdown-item[href*="profile"] {
  color: #6f42c1;
}

.modern-dropdown-item[href*="test-database"] {
  color: #fd7e14;
  font-style: italic;
}

/* Navbar Actions */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap;
    min-width: fit-content;
}

/* Mobile Navbar Actions */
.mobile-navbar-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.5rem 0;
}

.mobile-navbar-actions .user-actions {
    display: flex;
    justify-content: center;
    width: 100%;
}

.navbar-nav-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.theme-toggle-wrapper {
    position: relative;
    z-index: 1000;
    display: inline-block;
}

.user-actions {
    display: flex;
    align-items: center;
}

/* Modern Theme Toggle Button */
.theme-toggle-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.theme-toggle-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.theme-toggle-btn:hover::before {
    left: 100%;
}

.theme-toggle-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.theme-toggle-btn:active {
    transform: translateY(0) scale(0.95);
}

.theme-icon {
    font-size: 1.25rem;
    transition: all 0.3s ease;
    z-index: 1;
}

.theme-toggle-btn:hover .theme-icon {
    transform: rotate(180deg) scale(1.1);
}

.theme-toggle-switch:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 4px;
    border-radius: 20px;
}

/* Responsive adjustments for theme toggle */
@media (max-width: 576px) {
    .theme-toggle-btn {
        width: 40px;
        height: 40px;
    }
    
    .theme-icon {
        font-size: 1rem;
    }
}

.toggle-track::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.theme-toggle-switch:hover .toggle-track::before {
    transform: translateX(100%);
}

.toggle-thumb {
    width: 26px;
    height: 26px;
    background: #ffffff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.toggle-thumb i {
    font-size: 12px;
    transition: all 0.3s ease;
}

.toggle-thumb.light {
    transform: translateX(0);
    color: #f39c12;
}

.toggle-thumb.dark {
    transform: translateX(30px);
    color: #2c3e50;
}

.theme-toggle-switch:hover .toggle-track {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.theme-toggle-switch:hover .toggle-thumb {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

[data-theme="dark"] .toggle-track {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

[data-theme="dark"] .toggle-thumb {
    background: #ecf0f1;
}

[data-theme="dark"] .toggle-thumb.light {
    color: #f39c12;
}

[data-theme="dark"] .toggle-thumb.dark {
    color: #3498db;
}

/* Floating Action Button */
.floating-actions {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
}

.fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.fab-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.fab:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
}

/* Error UI */
.blazor-error-ui {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    padding: 1rem;
    border-radius: 12px;
    margin: 1rem;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
}

.error-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Responsive Design */
@media (max-width: 991.98px) {
    .main-content {
        margin-top: 0;
        min-height: 100vh;
    }
    
    .modern-navbar {
        padding: 0.5rem 1rem;
    }
    
    .modern-brand {
        font-size: 1.25rem;
    }
    
    .modern-brand .brand-text {
        font-size: 1.1rem;
    }
    
    .modern-navbar .container-fluid {
        padding-left: 0;
        padding-right: 0;
    }
    
    .modern-brand {
        width: 100%;
        justify-content: center;
        padding: 0 15px;
    }
    
    .brand-icon {
        width: 100%;
        max-width: 180px;
        height: 40px;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .brand-icon img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        max-width: 120px;
    }
    
    .mobile-navbar-actions {
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .floating-actions {
        bottom: 1rem;
        right: 1rem;
    }
    
    .fab {
        width: 48px;
        height: 48px;
        font-size: 1rem;
    }
    
    /* Fix mobile menu positioning */
    .mobile-navbar-actions {
        position: relative;
        z-index: 1052;
    }
    
    .user-menu-container {
        position: relative;
        z-index: 1053;
    }
}

@media (max-width: 576px) {
    .main-content {
        margin-top: 0;
        min-height: 100vh;
    }
    
    .modern-navbar .container-fluid {
        padding-left: 0;
        padding-right: 0;
    }
    
    .modern-brand {
        font-size: 1rem;
        gap: 0.5rem;
        width: 100%;
        justify-content: center;
        padding: 0 15px;
    }
    
    .modern-brand .brand-text {
        font-size: 1.5rem;
        white-space: nowrap;
    }
    
    .brand-icon {
        width: 100%;
        max-width: 200px;
        height: 40px;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .brand-icon img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        max-width: 150px;
    }
    
    .mobile-navbar-actions {
        gap: 0.5rem;
        flex-wrap: wrap;
        position: relative;
        z-index: 1054;
    }
    
    .user-actions .d-flex {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .user-actions .btn {
        font-size: 0.8rem;
        padding: 0.375rem 0.75rem;
    }
    
    /* Ensure mobile dropdowns are visible */
    .dropdown-menu {
        position: absolute !important;
        z-index: 1060 !important;
        transform: none !important;
        will-change: auto !important;
    }
    
    /* Fix mobile menu container */
    .user-menu-container {
        position: static;
        z-index: 1055;
    }
    
    .mobile-user-dropdown {
        position: static;
    }
    
    .mobile-user-menu {
        position: fixed !important;
        top: 60px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-width: none !important;
        min-width: auto !important;
        z-index: 1060 !important;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary-color) 100%);
}

/* Desktop Fixed Install Button */
.desktop-install-fixed {
    display: none !important; /* Hidden by default, shown only on desktop */
}

.desktop-install-btn {
    background: linear-gradient(135deg, #00b4ff, #00549c);
    border: none;
    border-radius: 25px;
    padding: 12px 20px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    justify-content: center;
}

.desktop-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
    background: linear-gradient(135deg, #00549c, #003d7a);
}

.desktop-install-btn:active {
    transform: translateY(0);
}

.desktop-install-text {
    font-size: 13px;
}

/* Mobile Fixed Install Button */
.mobile-install-fixed {
    display: none !important; /* Hidden by default, shown only on mobile */
}

.mobile-install-btn {
    background: linear-gradient(135deg, #00b4ff, #00549c);
    border: none;
    border-radius: 25px;
    padding: 12px 20px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    justify-content: center;
}

.mobile-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
    background: linear-gradient(135deg, #00549c, #003d7a);
}

.mobile-install-btn:active {
    transform: translateY(0);
}

.mobile-install-text {
    font-size: 13px;
}

/* Hide desktop button on desktop devices */
@media (min-width: 769px) {
    .desktop-install-fixed {
        display: none !important;
    }
}

/* Show mobile button only on mobile devices */
@media (max-width: 768px) {
    .mobile-install-fixed {
        display: block !important;
    }
    
    .desktop-install-fixed {
        display: none !important;
    }
}

/* Extra small devices (phones, 480px and down) */
@media (max-width: 480px) {
    .modern-navbar .container-fluid {
        padding-left: 0;
        padding-right: 0;
    }
    
    .modern-brand {
        width: 100%;
        justify-content: center;
        padding: 0 10px;
    }
    
    .modern-brand .brand-text {
        font-size: 1.5rem;
        white-space: nowrap;
    }
    
    .brand-icon {
        width: 100%;
        max-width: 120px;
        height: 35px;
    }
    
    .brand-icon img {
        max-width: 100px;
    }
}