/* ============================================
   Header Styles
   ============================================ */
.site-header {
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
}

.header-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

/* Logo */
.site-logo {
    flex-shrink: 0;
}

.site-logo img,
.custom-logo-link img {
    max-height: 50px;
    width: auto;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    transition: var(--transition);
}

/* Navigation */
.main-navigation {
    flex: 1;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    position: relative;
}

.nav-menu a {
    color: var(--text-color);
    font-weight: 500;
    font-size: 1rem;
    padding: 0.5rem 0;
    display: block;
    transition: var(--transition);
}

.nav-menu a:hover,
.nav-menu .current-menu-item a {
    color: var(--primary-color);
}

/* Header Buttons */
.header-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.header-buttons .btn {
    padding: 10px 24px;
    font-size: 0.9rem;
}

/* User Dropdown in Header */
.header-buttons .user-dropdown {
    position: relative;
}

.header-buttons .user-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    transition: all 0.3s ease;
}

.header-buttons .user-toggle:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.header-buttons .user-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-buttons .dropdown-icon {
    transition: transform 0.3s ease;
}

.header-buttons .user-dropdown.active .dropdown-icon {
    transform: rotate(180deg);
}

.header-buttons .user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    border: 2px solid #e5e7eb;
    overflow: hidden;
}

.header-buttons .user-dropdown.active .user-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header-buttons .menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #1f2937;
    text-decoration: none;
    transition: background 0.2s ease;
    font-size: 15px;
}

.header-buttons .menu-item:hover {
    background: #f3f4f6;
}

.header-buttons .menu-item.highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.header-buttons .menu-item.highlight:hover {
    opacity: 0.9;
}

.header-buttons .menu-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.header-buttons .menu-text {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.header-buttons .menu-badge {
    background: #667eea;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    line-height: 1.4;
}

.header-buttons .menu-item.highlight .menu-badge {
    background: rgba(255, 255, 255, 0.3);
}

.header-buttons .menu-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 4px 0;
}

/* Responsive */
@media (max-width: 1024px) {
    .nav-menu {
        gap: 1.5rem;
    }
    
    .header-buttons .btn {
        padding: 8px 20px;
        font-size: 0.85rem;
    }
    
    .header-buttons .user-name {
        max-width: 100px;
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        order: 3;
    }
    
    .header-wrapper {
        flex-wrap: wrap;
    }
    
    .main-navigation {
        display: none;
        width: 100%;
        order: 4;
    }
    
    .main-navigation.active {
        display: block;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 0;
        padding: 1rem 0;
    }
    
    .nav-menu a {
        padding: 1rem 0;
        border-bottom: 1px solid var(--border-color);
    }
    
    .header-buttons {
        order: 2;
    }
    
    .header-buttons .btn:first-child {
        display: none;
    }
    
    .header-buttons .user-toggle {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .header-buttons .user-name {
        max-width: 80px;
    }
}

@media (max-width: 576px) {
    .site-logo img {
        max-height: 40px;
    }
    
    .header-buttons .btn {
        padding: 6px 16px;
        font-size: 0.8rem;
    }
    
    .header-buttons .user-toggle {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .header-buttons .user-menu {
        min-width: 200px;
    }
}

/* ============================================
   Categories Mega Menu
   ============================================ */
.categories-mega-menu {
    position: relative;
}

.categories-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    transition: all 0.3s ease;
}

.categories-toggle:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.categories-toggle .dropdown-arrow {
    transition: transform 0.3s ease;
}

.categories-mega-menu.active .dropdown-arrow {
    transform: rotate(180deg);
}

.mega-menu-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    min-width: 750px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    border: 2px solid #e5e7eb;
}

.categories-mega-menu.active .mega-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-menu-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    max-height: 500px;
}

/* Categories List */
.categories-mega-menu .categories-list {
    display: block !important;
    padding: 16px;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
}

.site-header .category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 8px;
    text-decoration: none;
    color: #1f2937;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    gap: 8px;
}

.site-header .category-item:hover {
    background: #f3f4f6;
    color: #667eea;
}

.site-header .category-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.site-header .category-name {
    font-weight: 500;
    font-size: 14px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-header .category-count {
    font-size: 11px;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    color: #6b7280;
    min-width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.site-header .category-item.active .category-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Tools Preview */
.tools-preview {
    padding: 16px;
    overflow-y: auto;
}

.preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
}

.preview-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.preview-content {
    display: none;
}

.preview-content.active {
    display: block;
}

.preview-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.preview-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 4px 0;
}

.preview-header p {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
}

.preview-tools {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.preview-tool-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid #e5e7eb;
}

.preview-tool-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.preview-tool-logo {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.preview-tool-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.preview-tool-info {
    flex: 1;
}

.preview-tool-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 4px 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.preview-tool-excerpt {
    font-size: 12px;
    color: #6b7280;
    margin: 0 0 8px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.preview-tool-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
}

.preview-tool-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #f59e0b;
    font-weight: 600;
}

.preview-tool-pricing {
    color: #10b981;
    font-weight: 500;
}

.preview-view-all {
    display: block;
    text-align: center;
    padding: 12px;
    margin-top: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: opacity 0.2s ease;
}

.preview-view-all:hover {
    opacity: 0.9;
}

/* Responsive */
@media (max-width: 992px) {
    .categories-mega-menu {
        display: none;
    }
}
