/*
  ==============================
  Tailwind UI Navbar Styles
  ==============================
  משולב מכל הקבצים הטובים הקיימים
*/

/* Base navbar styles with RTL support */
.navbar-tailwind {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: rgb(255 255 255 / 95%);
    -webkit-backdrop-filter: blur(20px);
            backdrop-filter: blur(20px);
    border-bottom: 1px solid rgb(0 0 0 / 8%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Scrolled state */
.navbar-tailwind.scrolled {
    background: rgb(255 255 255 / 98%);
    box-shadow: 0 2px 20px rgb(0 0 0 / 10%);
}

/* Container with responsive padding */
.navbar-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4rem;
}

@media (width >= 640px) {
    .navbar-container {
        padding: 0.75rem 1.5rem;
    }
}

@media (width >= 1024px) {
    .navbar-container {
        padding: 0.75rem 2rem;
    }
}

/* Logo section with hover effects */
.navbar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.navbar-logo:hover {
    transform: translateY(-1px);
}

.navbar-logo-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.125rem;
    box-shadow: 0 4px 15px rgb(59 130 246 / 30%);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.navbar-logo:hover .navbar-logo-icon {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgb(59 130 246 / 40%);
}

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

.navbar-logo-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1F2937;
    line-height: 1;
    letter-spacing: -0.025em;
}

.navbar-logo-subtitle {
    font-size: 0.75rem;
    color: #6B7280;
    margin-top: 0.125rem;
    font-weight: 500;
}

/* Hide logo text on very small screens */
@media (width <= 360px) {
    .navbar-logo-text {
        display: none;
    }
}

/* Desktop navigation */
.navbar-desktop {
    display: none;
    align-items: center;
    gap: 2rem;
}

@media (width >= 768px) {
    .navbar-desktop {
        display: flex;
    }
}

.navbar-nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.navbar-nav-link {
    color: #374151;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.navbar-nav-link:hover {
    color: #2563EB;
}

.navbar-nav-link.active {
    color: #2563EB;
    font-weight: 600;
}

/* Dropdown styles */
.navbar-dropdown {
    position: relative;
}

.navbar-dropdown-button {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: #374151;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    background: none;
    cursor: pointer;
}

.navbar-dropdown-button:hover {
    color: #2563EB;
}

.navbar-dropdown-button.active {
    color: #2563EB;
    font-weight: 600;
}

.navbar-dropdown-panel {
    position: absolute;
    right: 0;
    z-index: 10;
    margin-top: 0.5rem;
    width: 20rem;
    border-radius: 0.375rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 10%), 0 4px 6px -2px rgb(0 0 0 / 5%);
    background: white;
    border: 1px solid rgb(0 0 0 / 5%);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-dropdown-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.navbar-dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid #F3F4F6;
}

.navbar-dropdown-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
}

.navbar-dropdown-subtitle {
    font-size: 0.75rem;
    color: #6B7280;
}

.navbar-dropdown-content {
    padding: 0.5rem;
}

.navbar-dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    text-decoration: none;
    border-radius: 0.375rem;
    transition: all 0.15s ease;
}

.navbar-dropdown-item:hover {
    background: #EBF8FF;
    color: #2563EB;
}

.navbar-dropdown-icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.75rem;
    transition: all 0.15s ease;
}

.navbar-dropdown-icon.blue {
    background: #DBEAFE;
    color: #2563EB;
}

.navbar-dropdown-icon.green {
    background: #D1FAE5;
    color: #059669;
}

.navbar-dropdown-icon.purple {
    background: #EDE9FE;
    color: #7C3AED;
}

.navbar-dropdown-icon.orange {
    background: #FED7AA;
    color: #EA580C;
}

.navbar-dropdown-icon.red {
    background: #FEE2E2;
    color: #DC2626;
}

.navbar-dropdown-item:hover .navbar-dropdown-icon.blue {
    background: #BFDBFE;
}

.navbar-dropdown-item:hover .navbar-dropdown-icon.green {
    background: #A7F3D0;
}

.navbar-dropdown-item:hover .navbar-dropdown-icon.purple {
    background: #DDD6FE;
}

.navbar-dropdown-item:hover .navbar-dropdown-icon.orange {
    background: #FED7AA;
}

.navbar-dropdown-item:hover .navbar-dropdown-icon.red {
    background: #FECACA;
}

.navbar-dropdown-text {
    flex: 1;
}

.navbar-dropdown-text-title {
    font-weight: 500;
}

.navbar-dropdown-text-subtitle {
    font-size: 0.75rem;
    color: #6B7280;
}

/* Badge styles */
.navbar-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: 0.5rem;
}

.navbar-badge.red {
    background: #FEE2E2;
    color: #991B1B;
}

/* Language selector */
.navbar-language {
    position: relative;
}

.navbar-language-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #374151;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid #D1D5DB;
    background: white;
    cursor: pointer;
}

.navbar-language-button:hover {
    color: #2563EB;
    border-color: #93C5FD;
}

.navbar-language-flag {
    width: 1.25rem;
    height: 0.75rem;
    border-radius: 0.125rem;
    background-size: cover;
    box-shadow: 0 1px 3px rgb(0 0 0 / 20%);
}

.navbar-language-flag.he {
    background: linear-gradient(45deg, #2563EB, #1D4ED8);
}

.navbar-language-flag.en {
    background: linear-gradient(45deg, #EF4444, #B91C1C);
}

.navbar-language-dropdown {
    position: absolute;
    right: 0;
    z-index: 10;
    margin-top: 0.5rem;
    width: 12rem;
    border-radius: 0.375rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 10%), 0 4px 6px -2px rgb(0 0 0 / 5%);
    background: white;
    border: 1px solid rgb(0 0 0 / 5%);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.navbar-language-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.navbar-language-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    text-decoration: none;
    transition: all 0.15s ease;
}

.navbar-language-option:hover {
    background: #F3F4F6;
}

.navbar-language-option.active {
    background: #EBF8FF;
    color: #2563EB;
}

/* User menu */
.navbar-user {
    position: relative;
}

.navbar-user-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    background: none;
    cursor: pointer;
}

.navbar-user-button:hover {
    color: #2563EB;
}

.navbar-user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #3B82F6, #8B5CF6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.navbar-user-dropdown {
    position: absolute;
    right: 0;
    z-index: 10;
    margin-top: 0.5rem;
    width: 14rem;
    border-radius: 0.375rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 10%), 0 4px 6px -2px rgb(0 0 0 / 5%);
    background: white;
    border: 1px solid rgb(0 0 0 / 5%);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.navbar-user-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.navbar-user-info {
    padding: 1rem;
    border-bottom: 1px solid #F3F4F6;
}

.navbar-user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #111827;
}

.navbar-user-email {
    font-size: 0.75rem;
    color: #6B7280;
}

.navbar-user-role {
    font-size: 0.75rem;
    color: #2563EB;
    font-weight: 500;
    margin-top: 0.25rem;
}

.navbar-user-menu {
    padding: 0.25rem 0;
}

.navbar-user-menu-item {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    text-decoration: none;
    transition: all 0.15s ease;
}

.navbar-user-menu-item:hover {
    background: #F3F4F6;
}

.navbar-user-menu-item.danger {
    color: #DC2626;
}

.navbar-user-menu-item.danger:hover {
    background: #FEF2F2;
}

/* Auth buttons for guests */
.navbar-auth-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-auth-button {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.navbar-auth-button.login {
    color: #374151;
}

.navbar-auth-button.login:hover {
    color: #2563EB;
}

.navbar-auth-button.register {
    background: #2563EB;
    color: white;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 5%);
}

.navbar-auth-button.register:hover {
    background: #1D4ED8;
    box-shadow: 0 2px 4px 0 rgb(0 0 0 / 10%);
}

/* Mobile menu button */
.navbar-mobile-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 0.375rem;
    color: #374151;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

@media (width >= 768px) {
    .navbar-mobile-button {
        display: none;
    }
}

.navbar-mobile-button:hover {
    color: #2563EB;
    background: #F3F4F6;
}

.navbar-mobile-button:focus {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

/* Mobile menu */
.navbar-mobile-menu {
    display: block;
    background: white;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 10%), 0 2px 4px -1px rgb(0 0 0 / 6%);
    border-top: 1px solid #E5E7EB;
    animation: slideDown 0.3s ease-out;
}

@media (width >= 768px) {
    .navbar-mobile-menu {
        display: none;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.navbar-mobile-menu.hidden {
    display: none;
}

.navbar-mobile-nav {
    padding: 0.5rem 0.75rem;
    gap: 0.25rem;
    display: flex;
    flex-direction: column;
}

@media (width >= 640px) {
    .navbar-mobile-nav {
        padding: 0.5rem 1rem;
    }
}

.navbar-mobile-link {
    color: #374151;
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.navbar-mobile-link:hover {
    color: #2563EB;
    background: #EBF8FF;
}

.navbar-mobile-link.active {
    color: #2563EB;
    background: #EBF8FF;
    font-weight: 600;
}

/* Mobile services section */
.navbar-mobile-services {
    gap: 0.25rem;
    margin-right: 1rem;
    display: flex;
    flex-direction: column;
}

.navbar-mobile-services.hidden {
    display: none;
}

.navbar-mobile-services-button {
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    background: none;
    cursor: pointer;
}

.navbar-mobile-services-button:hover {
    color: #2563EB;
    background: #EBF8FF;
}

.navbar-mobile-services-icon {
    width: 1.25rem;
    height: 1.25rem;
    transition: transform 0.2s ease;
}

.navbar-mobile-services-link {
    color: #6B7280;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-mobile-services-link:hover {
    color: #2563EB;
    background: #EBF8FF;
}

.navbar-mobile-services-link i {
    width: 1rem;
    margin-left: 0.5rem;
}

/* Mobile auth section */
.navbar-mobile-auth {
    border-top: 1px solid #E5E7EB;
    padding: 1rem 0.75rem;
}

.navbar-mobile-user {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.navbar-mobile-user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #3B82F6, #8B5CF6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    margin-left: 0.75rem;
}

.navbar-mobile-user-info {
    flex: 1;
}

.navbar-mobile-user-name {
    font-size: 1rem;
    font-weight: 500;
    color: #1F2937;
}

.navbar-mobile-user-email {
    font-size: 0.875rem;
    color: #6B7280;
}

.navbar-mobile-auth-buttons {
    gap: 0.5rem;
    display: flex;
    flex-direction: column;
}

.navbar-mobile-auth-button {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: center;
    border: none;
    cursor: pointer;
    width: 100%;
}

.navbar-mobile-auth-button.login {
    color: #374151;
    background: transparent;
}

.navbar-mobile-auth-button.login:hover {
    color: #2563EB;
    background: #EBF8FF;
}

.navbar-mobile-auth-button.register {
    background: #2563EB;
    color: white;
}

.navbar-mobile-auth-button.register:hover {
    background: #1D4ED8;
}

.navbar-mobile-auth-button.danger {
    color: #DC2626;
    background: transparent;
}

.navbar-mobile-auth-button.danger:hover {
    color: #B91C1C;
    background: #FEF2F2;
}

/* RTL Support */
[dir="rtl"] .navbar-dropdown-panel {
    right: auto;
    left: 0;
}

[dir="rtl"] .navbar-language-dropdown {
    right: auto;
    left: 0;
}

[dir="rtl"] .navbar-user-dropdown {
    right: auto;
    left: 0;
}

[dir="rtl"] .navbar-mobile-services {
    margin-right: 0;
    margin-left: 1rem;
}

/* Accessibility improvements */
.navbar-nav-link:focus,
.navbar-dropdown-button:focus,
.navbar-language-button:focus,
.navbar-user-button:focus,
.navbar-mobile-button:focus {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .navbar-tailwind {
        border-bottom: 2px solid #000;
    }
    
    .navbar-logo-icon,
    .navbar-user-avatar,
    .navbar-mobile-user-avatar {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Performance optimizations */
.navbar-tailwind,
.navbar-dropdown-panel,
.navbar-language-dropdown,
.navbar-user-dropdown,
.navbar-mobile-menu {
    will-change: transform;
    backface-visibility: hidden;
}

/* Body spacing adjustment */
body.navbar-body {
    padding-top: 4rem;
}

@media (width <= 768px) {
    body.navbar-body {
        padding-top: 3.5rem;
    }
}