/* B.Tech Style Header CSS */

/* Header Styles */
.btech-header {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
    z-index: 1000;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.btech-header * {
    box-sizing: border-box;
}

/* Remove any borders that might cause white lines */
.btech-header,
.btech-header *,
.categories-nav-bar,
.categories-nav-bar * {
    border-bottom: none !important;
    outline: none !important;
}

/* Loading States */
.btech-header .loading {
    pointer-events: none;
    opacity: 0.7;
}

.btech-header .loading i {
    animation: spin 1s linear infinite;
}

/* Top Bar Styles */
.btech-header .top-bar {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-size: 13px;
}

.btech-header .top-bar a {
    color: #6c757d;
    text-decoration: none;
    transition: color 0.2s ease;
}

.btech-header .top-bar a:hover {
    color: #dc3545;
}

/* Main Header Styles */
.btech-header .main-header {
    background: white;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
}

.btech-header .main-header .max-w-7xl {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    padding: 0 20px;
}

/* Logo Styles */
.btech-header .logo img {
    height: 40px;
    width: auto;
}

/* Categories Button - Integrated in Search */
.btech-header .categories-btn {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    border: none;
    padding: 14px 16px;
    border-radius: 25px 0 0 25px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
    position: relative;
    z-index: 10;
    cursor: pointer;
}

.btech-header .categories-btn:hover,
.btech-header .categories-btn.user-activated {
    background: linear-gradient(135deg, #c82333, #a71e2a);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.btech-header .categories-btn i {
    font-size: 14px;
}

/* Categories Mega Menu - Properly Integrated */
.btech-header .categories-mega-menu {
    background: white;
    border: none;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1), 0 5px 15px rgba(0,0,0,0.07);
    overflow: hidden;
    min-height: 450px;
    max-height: 550px;
    border-top: 3px solid #dc3545;
    display: none;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    z-index: 1000;
}

/* Show menu when explicitly opened by user */
.btech-header .categories-mega-menu.force-show {
    display: block;
    visibility: visible;
    opacity: 1;
}

.btech-header .categories-list {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-right: 1px solid #dee2e6;
    position: relative;
}

.btech-header .categories-list::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, #dc3545, #c82333);
}

.btech-header .category-item {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    background: transparent;
}

.btech-header .category-item::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(135deg, #dc3545, #c82333);
    transition: width 0.3s ease;
}

.btech-header .category-item:hover,
.btech-header .category-item.active {
    background: white;
    color: #dc3545;
    transform: translateX(-5px);
    box-shadow: 5px 0 15px rgba(220, 53, 69, 0.1);
}

.btech-header .category-item:hover::before,
.btech-header .category-item.active::before {
    width: 4px;
}

.btech-header .category-item a {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
}

.btech-header .category-item i {
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.btech-header .category-item:hover i,
.btech-header .category-item.active i {
    opacity: 1;
}

.btech-header .category-count {
    background: #dc3545;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 8px;
    left: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btech-header .category-item:hover .category-count,
.btech-header .category-item.active .category-count {
    opacity: 1;
}

.btech-header .subcategories {
    padding: 25px;
    background: white;
    position: relative;
    overflow-y: auto;
    max-height: 450px;
}

.btech-header .subcategories::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #dc3545, #c82333, #dc3545);
}

.btech-header .subcategories h4 {
    color: #2c3e50;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #dc3545;
    position: relative;
}

.btech-header .subcategories h4::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 50px;
    height: 2px;
    background: #c82333;
}

.btech-header .subcategory-link {
    color: #495057;
    text-decoration: none;
    font-size: 14px;
    padding: 10px 0;
    display: block;
    transition: all 0.3s ease;
    position: relative;
    border-radius: 6px;
    margin-bottom: 2px;
}

.btech-header .subcategory-link::before {
    content: '•';
    color: #dc3545;
    font-weight: bold;
    margin-left: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btech-header .subcategory-link:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.05);
    padding-right: 15px;
    font-weight: 600;
}

.btech-header .subcategory-link:hover::before {
    opacity: 1;
}

.btech-header .view-all-link {
    color: white;
    background: linear-gradient(135deg, #dc3545, #c82333);
    font-weight: 600;
    text-decoration: none;
    font-size: 14px;
    margin-top: 20px;
    display: inline-block;
    padding: 10px 20px;
    border-radius: 25px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.btech-header .view-all-link:hover {
    background: linear-gradient(135deg, #c82333, #a71e2a);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
    color: white;
    text-decoration: none;
}

/* Search Bar - Integrated with Categories */
.btech-header .search-bar {
    max-width: 650px;
    margin: 0 auto;
    position: relative;
}

.btech-header .search-bar form {
    display: flex;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-radius: 25px;
    overflow: hidden;
    background: white;
}

.btech-header .search-input {
    border: 2px solid #f1f3f4;
    border-right: none;
    border-left: none;
    padding: 16px 20px;
    font-size: 15px;
    transition: all 0.3s ease;
    text-align: right;
    background: white;
    flex: 1;
    font-weight: 400;
}

.btech-header .search-input:focus {
    outline: none;
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
    background: white;
}

.btech-header .search-input::placeholder {
    color: #9ca3af;
    font-size: 14px;
    font-weight: 400;
}

.btech-header .search-btn {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    border: none;
    padding: 16px 28px;
    border-radius: 0 25px 25px 0;
    transition: all 0.3s ease;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btech-header .search-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 ease;
}

.btech-header .search-btn:hover {
    background: linear-gradient(135deg, #c82333, #a71e2a);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.3);
}

.btech-header .search-btn:hover::before {
    left: 100%;
}

.btech-header .search-btn:active {
    transform: translateY(0);
}

/* Right Actions */
.btech-header .right-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btech-header .action-link {
    color: #6c757d;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
    background: transparent;
    border: none;
    cursor: pointer;
}

.btech-header .action-link:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.05);
    transform: translateY(-1px);
}

.btech-header .action-link i {
    font-size: 18px;
    transition: transform 0.2s ease;
}

.btech-header .action-link:hover i {
    transform: scale(1.1);
}

.btech-header .action-link span {
    font-weight: 500;
    white-space: nowrap;
}

/* Account Dropdown */
.btech-header .account-dropdown {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
}

.btech-header .dropdown-item {
    padding: 10px 16px;
    color: #343a40;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    transition: background 0.2s ease;
}

.btech-header .dropdown-item:hover {
    background: #f8f9fa;
    color: #dc3545;
}

.btech-header .dropdown-divider {
    height: 1px;
    background: #e9ecef;
    margin: 8px 0;
}

/* Post Ad Button */
.btech-header .post-ad-btn {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
    position: relative;
    overflow: hidden;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btech-header .post-ad-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 ease;
}

.btech-header .post-ad-btn:hover {
    background: linear-gradient(135deg, #c82333, #a71e2a);
    transform: translateY(-2px);
    color: white;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.btech-header .post-ad-btn:hover::before {
    left: 100%;
}

.btech-header .post-ad-btn:active {
    transform: translateY(0);
}

.btech-header .post-ad-btn i {
    font-size: 14px;
}

/* Mobile Menu */
.btech-header .mobile-menu {
    background: white;
    border-top: 1px solid #e9ecef;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btech-header .mobile-menu a {
    color: #343a40;
    text-decoration: none;
    padding: 12px 0;
    display: block;
    font-size: 14px;
    transition: color 0.2s ease;
}

.btech-header .mobile-menu a:hover {
    color: #dc3545;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .btech-header .search-bar {
        max-width: 400px;
    }
    
    .btech-header .right-actions {
        gap: 6px;
    }
    
    .btech-header .action-link {
        padding: 8px 10px;
    }
    
    .btech-header .post-ad-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .btech-header .main-header .max-w-7xl {
        padding: 0 16px;
    }
    
    .btech-header .categories-btn {
        padding: 12px 12px;
        font-size: 13px;
        border-radius: 20px 0 0 20px;
    }
    
    .btech-header .search-bar {
        max-width: 100%;
        margin: 0 12px;
    }
    
    .btech-header .search-input {
        padding: 12px 14px;
        font-size: 13px;
    }
    
    .btech-header .search-btn {
        padding: 12px 18px;
        border-radius: 0 20px 20px 0;
    }
    
    .btech-header .right-actions {
        gap: 4px;
    }
    
    .btech-header .action-link {
        padding: 6px 8px;
    }
    
    .btech-header .action-link span {
        display: none !important;
    }
    
    .btech-header .post-ad-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .btech-header .post-ad-btn span {
        display: none;
    }
    
    .btech-header .categories-mega-menu {
        width: 100vw;
        left: 0 !important;
        right: 0 !important;
        border-radius: 0;
        margin-top: 0;
        max-height: 70vh;
    }
    
    .btech-header .top-bar {
        display: none;
    }
}

@media (max-width: 480px) {
    .btech-header .main-header .flex {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .btech-header .search-bar {
        order: 3;
        width: 100%;
        margin: 0;
    }
    
    .btech-header .categories-mega-menu .flex {
        flex-direction: column;
    }
    
    .btech-header .categories-list,
    .btech-header .subcategories {
        width: 100%;
    }
    
    .btech-header .categories-list {
        border-right: none;
        border-bottom: 1px solid #e9ecef;
        max-height: 200px;
        overflow-y: auto;
    }
    
    .btech-header .categories-btn {
        padding: 10px 10px;
        font-size: 12px;
    }
    
    .btech-header .search-input {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .btech-header .search-btn {
        padding: 10px 14px;
        font-size: 14px;
    }
}

/* Animation Classes */
.btech-header .fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Smooth Transitions */
.btech-header * {
    transition: all 0.2s ease;
}

/* Alpine.js Cloak */
[x-cloak] {
    display: none !important;
}

/* Initial State for Dropdowns - Let Alpine.js handle visibility */
[x-cloak] {
    display: none !important;
}

/* Loading Animation for Categories */
.btech-header .categories-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6c757d;
}

.btech-header .categories-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #dc3545;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Hover Effects */
.btech-header .logo img {
    transition: transform 0.3s ease;
}

.btech-header .logo:hover img {
    transform: scale(1.05);
}

/* Focus States */
.btech-header button:focus,
.btech-header a:focus {
    outline: 2px solid #dc3545;
    outline-offset: 2px;
}

/* Active States */
.btech-header .categories-btn:active {
    transform: scale(0.98);
}

.btech-header .action-link:active {
    transform: scale(0.95);
}

/* Search Suggestions */
.btech-header .search-suggestions {
    background: white;
    border: 1px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
}

.btech-header .suggestion-item {
    padding: 10px 16px;
    border-bottom: 1px solid #f8f9fa;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btech-header .suggestion-item:hover {
    background: #f8f9fa;
}

.btech-header .suggestion-item:last-child {
    border-bottom: none;
}

/* RTL Support */
[dir="rtl"] .btech-header .category-item.active {
    border-right: none;
    border-left: 3px solid #dc3545;
}

[dir="rtl"] .btech-header .subcategory-link:hover {
    padding-right: 0;
    padding-left: 8px;
}

[dir="rtl"] .btech-header .view-all-link:hover {
    transform: translateX(-4px);
}

[dir="rtl"] .btech-header .search-input {
    text-align: left;
}

/* Notification and Message Badges */
.btech-header .notification-badge,
.btech-header .message-badge {
    min-width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: bold;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: -8px;
    right: -8px;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    border: 2px solid white;
}

.btech-header .notification-badge {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.btech-header .message-badge {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.btech-header .notification-badge:hover,
.btech-header .message-badge:hover {
    transform: scale(1.1);
}

/* Action Links Enhancement */
.btech-header .action-link {
    position: relative;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btech-header .action-link:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.btech-header .action-link i {
    margin-left: 6px;
    transition: transform 0.2s ease;
}

.btech-header .action-link:hover i {
    transform: scale(1.1);
}

/* Dropdown Animations */
.btech-header .account-dropdown,
.btech-header .absolute.left-0.mt-2 {
    animation: slideDown 0.2s ease-out;
    transform-origin: top;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mobile Badge Styles */
.btech-header .mobile-notification-badge,
.btech-header .mobile-message-badge {
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Pulse Animation for New Notifications */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

@keyframes pulseBlue {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

.btech-header .notification-badge.animate-pulse {
    animation: pulse 2s infinite;
}

.btech-header .message-badge.animate-pulse {
    animation: pulseBlue 2s infinite;
}