/* AI Tools Categories Colors */
.category-card .bg-green {
    background-color: var(--category-bg-green);
}
.category-card .text-green {
    color: var(--category-text-green);
}

.category-card .bg-purple {
    background-color: var(--category-bg-purple);
}
.category-card .text-purple {
    color: var(--category-text-purple);
}

.category-card .bg-blue {
    background-color: var(--category-bg-blue);
}
.category-card .text-blue {
    color: var(--category-text-blue);
}

.category-card .bg-yellow {
    background-color: var(--category-bg-yellow);
}
.category-card .text-yellow {
    color: var(--category-text-yellow);
}

.category-card .bg-cyan {
    background-color: var(--category-bg-cyan);
}
.category-card .text-cyan {
    color: var(--category-text-cyan);
}

/* Home page dark-mode text readability */
.text-primary {
    color: var(--text-primary) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Fix dark mode text readability - Category cards and descriptions */
.category-card h3,
.category-card p,
.category-card .text-secondary,
.featured-card h3,
.featured-card p,
.faq-question h3,
.faq-answer p,
.text-secondary,
.text-muted,
.hero-subtitle {
    color: var(--text-secondary) !important;
}

/* Light mode overrides */
.light-mode .category-card h3,
.light-mode .category-card p,
.light-mode .category-card .text-secondary {
    color: var(--text-primary) !important;
}

.light-mode .text-secondary {
    color: var(--text-secondary) !important;
}

.light-mode .hero-subtitle {
    color: #d97706 !important;
}

/* Ensure all text in cards is readable in dark mode */
.glass-card,
.category-card,
.faq-question,
.faq-answer {
    color: var(--text-primary);
}

.glass-card p,
.category-card p,
.faq-answer p {
    color: var(--text-secondary);
}

/* ============================================================
   HERO TITLE - "Everything AI, Simplified"
   ============================================================ */

/* Base hero title */
.hero-title {
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    transform: translateZ(40px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Dark mode hero title: readable yellow-to-amber clip text */
.hero-title .bg-clip-text {
    background: linear-gradient(135deg, #facc15, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-shadow: 0px 5px 8px rgba(0, 0, 0, 0.64);
    display: inline-block;
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.45);
}

/* Light mode hero title: same gradient treatment as the NeuralNexus logo */
.light-mode .hero-title .bg-clip-text {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary)) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.55);
}

/* Light mode hover effect - subtle glow */
.light-mode .hero-text-3d:hover .hero-title .bg-clip-text {
    text-shadow: 0 0 30px rgba(6, 182, 212, 0.3);
}

/* Dark mode hover effect */
.hero-text-3d:hover .hero-title .bg-clip-text {
    text-shadow: 0 0 30px rgba(250, 204, 21, 0.3);
}

/* ============================================================
   HERO SUBTITLE
   ============================================================ */

.hero-subtitle {
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-weight: bolder;
    font-style: oblique;
    color: var(--text-secondary) !important;
    text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Light mode hero subtitle */
.light-mode .hero-subtitle {
    color: #d97706 !important;
    text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
}

/* ============================================================
   HERO SUBTITLE HOVER EFFECTS
   ============================================================ */

.hero-subtitle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgb(8, 7, 0), transparent);
    border-radius: 8px;
    transform: translateZ(-20px);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.hero-text-3d:hover .hero-subtitle {
    transform: translateZ(50px) rotateX(10deg) rotateY(5deg);
    text-shadow: 0 10px 20px rgb(250, 204, 21);
}

.hero-text-3d:hover .hero-subtitle::before {
    opacity: 1;
    transform: translateZ(-30px);
}

/* Light mode hover subtitle */
.light-mode .hero-text-3d:hover .hero-subtitle {
    text-shadow: 0 10px 20px rgba(6, 182, 212, 0.4);
}

.light-mode .hero-text-3d:hover .hero-subtitle::before {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(139, 92, 246, 0.2));
}

/* ============================================================
   HERO TEXT 3D CONTAINER
   ============================================================ */

.hero-text-3d {
    transform-style: preserve-3d;
    perspective: 2000px;
}

.hero-text-3d:hover .hero-title {
    transform: translateZ(60px) rotateX(5deg);
}

/* ============================================================
   OPTIONAL: Hover effect adjustment for light mode
   ============================================================ */

.light-mode .category-card:hover {
    box-shadow: 0 30px 50px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   BASE STYLES
   ============================================================ */

body {
    background: var(--surface-1);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
    transition: background 0.5s ease, color 0.5s ease;
    position: relative;
}

/* Glass Card Effect */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px var(--glass-shadow);
    transition: all 0.5s ease;
}

/* Glow Effect */
.glow-effect {
    position: relative;
    z-index: 1;
}
.glow-effect::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: radial-gradient(circle at center, rgba(0, 240, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}
.glow-effect:hover::after {
    opacity: 1;
}

/* 3D Text */
.three-d-text {
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: all 0.3s ease;
}
.three-d-text span {
    display: inline-block;
    transform: translateZ(30px);
    transition: transform 0.3s ease;
}
.three-d-text:hover span {
    transform: translateZ(50px) rotateY(15deg);
}

/* Canvas */
#hero-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Navigation Items */
.nav-item {
    position: relative;
    overflow: hidden;
    color: var(--text-primary);
}
.nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}
.nav-item:hover::after {
    transform: translateX(0);
}

/* Floating Animation */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}
.floating {
    animation: float 6s ease-in-out infinite;
}

/* Category Cards */
.category-card {
    transform-style: preserve-3d;
    transition: transform 0.5s ease, box-shadow 0.5s ease;
}
.category-card:hover {
    transform: translateY(-10px) rotateX(5deg);
    box-shadow: 0 30px 50px rgba(0, 240, 255, 0.2);
}
.category-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    padding: 1px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.category-card:hover::before {
    opacity: 1;
}

/* Hero Content */
.hero-content {
    position: relative;
    z-index: 10;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}
.hero-text {
    transition: all 0.3s ease;
}
.hero-text:hover {
    text-shadow: 0 0 30px rgba(0, 240, 255, 0.5);
}

/* Line Clamp */
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Navigation Container */
.nav-container {
    display: flex;
    align-items: center;
    gap: 2rem;
}
.nav-menu {
    display: flex;
    gap: 1.6rem;
    align-items: center;
    margin-right: -200px;
}
.nav-menu a {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    color: #e5e7eb;
    text-transform: uppercase;
    transform: translateZ(0) scale(1);
    transition: transform 0.25s ease, color 0.25s ease;
}
.nav-menu a:hover {
    transform: scale(1.12);
    color: #facc15;
}
.nav-menu a.active {
    color: #facc15;
    transform: scale(1.12);
}
.light-mode .nav-menu a {
    color: #111827;
}

/* Sections with Solid Background */
.section-with-solid-bg {
    position: relative;
    z-index: 2;
    background: var(--solid-bg);
}
.section-with-solid-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--solid-bg);
    z-index: -1;
}

/* FAQ Styles */
.faq-question {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}
.faq-question:hover, .faq-question.active {
    border-color: var(--color-primary);
    transform: translateY(-2px);
}
.faq-question h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}
.faq-answer {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 0 0 12px 12px;
    padding: 1.5rem;
    margin-top: -1rem;
    margin-bottom: 1rem;
    display: none;
}
.faq-answer.show {
    display: block;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.faq-icon {
    transition: transform 0.3s ease;
}
.faq-question.active .faq-icon {
    transform: rotate(180deg);
}

/* Logo */
.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.logo-icon {
    font-size: 1.5rem;
    background: linear-gradient(135deg, #06b6d4, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    z-index: 1000;
}
.mobile-menu.show {
    display: block;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Search Section */
.search-section-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    position: relative;
}

/* Search Container */
.search-container {
    position: relative;
    z-index: 10;
    overflow: hidden;
    height: 3.5em;
    width: 3.5em;
    border-radius: 2em;
    background: var(--search-bg);
    border: 1px solid var(--search-border);
    box-shadow: 0 0 5px var(--search-shadow);
    transition: all 0.35s ease;
}

/* Expand effect */
.search-container:hover,
.search-container:focus,
.search-container:focus-within {
    width: 20em;
    border-radius: 5px 2em 2em 5px;
    box-shadow: 0 0 12px var(--search-shadow);
}

/* Input */
.search-container input {
    appearance: none;
    float: left;
    width: 0;
    height: 2em;
    margin: 0.75em;
    margin-right: -4em;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: var(--search-input-bg);
    color: var(--search-input-text);
    font-size: 1em;
    font-weight: 600;
    box-shadow: inset 0 1px 5px rgba(0,0,0,0.2);
    transition: all 0.25s ease;
}

.search-container input::placeholder {
    color: var(--text-muted);
}

.search-container:hover input,
.search-container:focus-within input {
    width: 16em;
    padding: 0.5em 0.75em;
}

.search-container input:focus {
    outline: none;
}

/* Button */
.search-container .button {
    display: flex;
    align-items: center;
    justify-content: center;
    float: right;
    width: 1.75em;
    height: 1.75em;
    margin: 0.125em;
    border-radius: 50%;
    background: var(--search-btn-bg);
    color: var(--search-btn-text);
    font-size: 1.75em;
    cursor: pointer;
    box-shadow: 0 -1px 1px rgba(255,255,255,0.25),
                0 1px 1px rgba(0,0,0,0.25);
    transition: transform 0.2s ease;
}

.search-container .button:active {
    transform: scale(0.95);
}

.search-container .button i {
    font-size: 85%;
}

/* Search Side Text */
.search-side-text {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text-primary);
    white-space: nowrap;
    text-shadow: 0 2px 6px rgba(0, 240, 255, 0.4);
    display: inline-block;
    margin-left: 1.5rem;
    animation: pulse 2s ease-in-out infinite;
    transition: transform 0.3s ease;
}

.search-side-text:hover {
    animation-play-state: paused;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

@media (max-width: 768px) {
    .nav-menu {
        margin-right: 0;
        gap: 1rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
        line-height: 1.4;
        padding: 0 1rem;
    }
    
    .hero-content {
        margin-top: 2rem !important;
    }
    
    .category-card {
        margin-bottom: 1.5rem;
    }
    
    .search-section-container {
        margin: 2rem auto;
        padding: 0 1rem;
        justify-content: center;
    }
    
    .search-container {
        height: 3.5em;
        width: 3.5em;
        margin: 0 auto;
    }
    
    .search-container:hover,
    .search-container:focus,
    .search-container:focus-within {
        width: 18em;
    }
    
    .search-container:hover input,
    .search-container:focus-within input {
        width: 14em;
    }
    
    .search-side-text {
        display: none;
    }
    
    .floating {
        display: none;
    }
    
    section {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }
    
    .section-with-solid-bg {
        padding: 2rem 1rem;
    }
    
    .faq-question h3 {
        font-size: 1rem;
    }
    
    .nav-menu a {
        font-size: 0.9rem;
    }
    
    /* Mobile Menu Fix */
    .mobile-menu {
        display: none;
    }
    
    .mobile-menu.show {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--surface-1);
        border-top: 1px solid var(--default-border);
        padding: 1rem;
        z-index: 1000;
        box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    }
    
    .light-mode .mobile-menu.show {
        background: white;
        box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .search-container {
        height: 3em;
        width: 3em;
    }
    
    .search-container:hover,
    .search-container:focus,
    .search-container:focus-within {
        width: 16em;
    }
    
    .search-container:hover input,
    .search-container:focus-within input {
        width: 12em;
    }
    
    .category-card {
        padding: 1.5rem;
    }
    
    .glass-card {
        padding: 1rem;
    }
    
    .platform-icon {
        width: 20%;
    }
    
    .platform-icon .w-16 {
        width: 3rem;
        height: 3rem;
    }
}

/* Template View Specific Fixes */
@media (max-width: 1024px) {
    /* Ensure mobile menu button is always visible */
    .mobile-menu-btn {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        z-index: 1001 !important;
    }
    
    /* Hide desktop navigation in template view */
    .desktop-only {
        display: none !important;
    }
    
    /* Ensure mobile menu is properly styled */
    .mobile-menu {
        position: fixed !important;
        top: 100% !important;
        left: 0 !important;
        width: 100% !important;
        background: var(--surface-1) !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.3) !important;
        z-index: 9999 !important;
        max-height: 0 !important;
        overflow: hidden !important;
        transition: all 0.3s ease !important;
    }
    
    .mobile-menu.show {
        max-height: calc(100vh - 80px) !important;
        overflow-y: auto !important;
        border-top: 1px solid var(--default-border) !important;
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
    
    /* Hide profile dropdown in template view */
    #profileDropdown {
        display: none !important;
    }
    
    /* Adjust hero section for template view */
    .hero-content {
        padding-top: 3rem !important;
        margin-top: 2rem !important;
    }
    
    /* Adjust search section */
    .search-section-container {
        margin-top: 2rem !important;
        margin-bottom: 2rem !important;
    }
    
    /* Adjust grid layouts */
    .lg\:grid-cols-2,
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    }
}

/* Tablet specific adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Show 2 columns on tablet */
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    
    /* Adjust navigation spacing */
    .nav-menu {
        gap: 0.8rem !important;
    }
    
    .nav-menu a {
        font-size: 0.85rem !important;
    }
    
    /* Adjust hero text */
    .hero-title {
        font-size: 3rem !important;
        line-height: 1.1 !important;
    }
    
    .hero-subtitle {
        font-size: 1.1rem !important;
        max-width: 90% !important;
    }
    
    /* Adjust card padding */
    .category-card,
    .glass-card {
        padding: 1.5rem !important;
    }
}

/* Mobile specific adjustments */
@media (max-width: 768px) {
    .grid-cols-1 {
        grid-template-columns: 1fr !important;
    }
    
    .hero-title {
        font-size: 2.5rem !important;
    }
    
    .hero-subtitle {
        font-size: 1rem !important;
        padding: 0 1rem !important;
    }
    
    .search-container {
        width: 90% !important;
        margin: 0 auto !important;
    }
    
    .search-container:hover,
    .search-container:focus-within {
        width: 90% !important;
    }
}

/* Fix for mobile menu toggle icon */
.mobile-menu-btn i {
    transition: transform 0.3s ease;
}

.mobile-menu-btn.active i {
    transform: rotate(90deg);
}

/* Ensure auth section is visible in mobile menu */
.mobile-menu .auth-section {
    display: block !important;
}

/* Fix for template view z-index issues */
.template-view-fix * {
    position: relative;
}

/* Improve touch targets on mobile */
@media (max-width: 768px) {
    .nav-item,
    button,
    a {
        min-height: 44px !important;
        min-width: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .mobile-menu a {
        padding: 0.75rem 1rem !important;
    }
}

/* Profile Dropdown Light Mode */
.light-mode .light-mode-dropdown {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.light-mode .light-mode-header {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
    border-bottom: 1px solid #e2e8f0;
}

.light-mode .light-mode-title {
    color: #1e293b !important;
    font-weight: 600;
}

.light-mode .light-mode-subtitle {
    color: #64748b !important;
}

.light-mode .light-mode-icon {
    color: #475569 !important;
}

.light-mode .light-mode-icon-bg {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.15) 0%, rgba(203, 213, 225, 0.15) 100%) !important;
}

.light-mode .light-mode-item:hover {
    background: rgba(241, 245, 249, 0.8) !important;
}

.light-mode .light-mode-item:hover .light-mode-icon-bg {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.25) 0%, rgba(203, 213, 225, 0.25) 100%) !important;
}

.light-mode .light-mode-divider {
    border-color: #e2e8f0 !important;
}

.light-mode .light-mode-logout {
    color: #dc2626 !important;
}

/* Mobile Menu Light Mode */
.light-mode .mobile-menu {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-top: 1px solid #e2e8f0;
}

.light-mode .mobile-menu a {
    color: #1e293b;
}

.light-mode .mobile-menu a:hover {
    background: rgba(241, 245, 249, 0.8);
}

/* Improve contrast for light mode */
.light-mode .text-primary {
    color: #1e293b !important;
}

.light-mode .text-muted {
    color: #64748b !important;
}

/* Ensure icons are visible in light mode */
.light-mode .fa-cog,
.light-mode .fa-question-circle,
.light-mode .fa-headset,
.light-mode .fa-sign-out-alt {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

/* Mobile Menu Button Visibility */
.mobile-menu-btn {
    display: none;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    #profileDropdown {
        display: none;
    }
}