@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Dark Mode (Default) */
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --border-color: #334155;
    --success: #10b981;
    --error: #ef4444;
    --header-bg: rgba(15, 23, 42, 0.8);

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --gradient-card: linear-gradient(145deg, #1e293b, #0f172a);
}

body.light-mode {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-glow: rgba(37, 99, 235, 0.3);
    --border-color: #e2e8f0;
    --success: #059669;
    --error: #dc2626;
    --header-bg: rgba(255, 255, 255, 0.8);
    --gradient-card: linear-gradient(145deg, #ffffff, #f1f5f9);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

/* Header */
header {
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 700;
    font-size: 1.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    align-items: center;
    /* Helper for theme toggle vertical alignment */
}

nav a {
    color: var(--text-secondary);
    font-weight: 500;
}

nav a:hover {
    color: var(--text-primary);
}

/* Main Content */
main {
    flex: 1;
    padding: 2rem;
    flex: 1;
    padding: 2rem;
    max-width: 95%;
    /* Increased from 1200px to use more screen space */
    width: 100%;
    margin: 0 auto;
}

@media (min-width: 1920px) {
    main {
        max-width: 2500px;
        /* Increased cap for 4K screens */
    }
}

/* Hero styles replaced by .hero-new */

/* Search */
.search-bar {
    margin: 2rem auto;
    width: 100%;
    max-width: 500px;
    position: relative;
    padding: 0 1rem;
}

.search-bar input {
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

/* Tools Grid (Original) */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.tool-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    border-color: var(--accent-color);
}

.tool-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.tool-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.tool-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    flex: 1;
}

/* Tool Page */
.tool-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.tool-workspace {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    min-height: 400px;
    box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.5);
}

.compliance-info {
    margin-top: 3rem;
    padding: 1.5rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.compliance-info strong {
    color: var(--success);
}

.tool-input-group {
    margin-bottom: 1.5rem;
}

.tool-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.tool-input,
.tool-textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--card-bg);
    /* Use card-bg instead of hardcoded hex */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 1rem;
}

.tool-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.tool-btn:hover {
    opacity: 0.9;
}

footer {
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    margin-top: auto;
}

.hidden {
    display: none;
}

/* Layout & Sidebar */
.app-container {
    display: flex;
    min-height: calc(100vh - 70px);
    /* Minus header */
    width: 100%;
    margin: 0 auto;
}



/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

@media (max-width: 1023px) {
    .mobile-menu-btn {
        display: block;
    }

    /* Mobile Nav Drawer */
    header nav {
        display: none;
        position: fixed;
        top: 70px;
        /* Below header */
        left: 0;
        width: 100%;
        height: calc(100vh - 70px);
        background: var(--bg-color);
        padding: 2rem;
        overflow-y: auto;
        border-top: 1px solid var(--border-color);
    }

    header nav.open {
        display: flex;
        flex-direction: column;
    }

    header nav ul {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 2rem;
    }

    /* Mobile Mega Menu Adaptation */
    .mega-menu {
        position: static;
        width: 100%;
        max-width: 100%;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 1rem 0 0 0;
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }

    .mega-menu-trigger span {
        display: none;
        /* Hide 'Tools Categories' text, just show the menu content */
    }

    .mega-menu-trigger::after {
        display: none;
    }

    .mega-menu-container {
        grid-template-columns: 1fr;
        /* Stack categories */
        gap: 1.5rem;
    }

    .mm-column h4 {
        margin-top: 1rem;
    }

    /* Mobile Header Alignment */
    header {
        justify-content: flex-start;
        /* Log next to burger */
        gap: 1.5rem;
    }

    .sidebar {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        z-index: 1000;
        transition: left 0.3s ease-in-out;
        display: block;
        /* Always block, just off-screen */
        background: var(--bg-color);
        /* Ensure opaque background */
    }

    .sidebar.open {
        left: 0;
    }
}

@media (min-width: 1024px) {

    /* Reset header for desktop */
    header {
        justify-content: space-between;
    }

    .sidebar {
        display: block;
        position: sticky;
        top: 90px;
        /* Below header */
        height: calc(100vh - 90px);
        left: 0;
        border-right: 1px solid var(--border-color);
        /* Added separation */
        background: var(--bg-color);
        /* Ensure opaque */
        overflow-y: auto;
        /* Allows scroll */
        padding-right: 1rem;
        width: 280px;
        /* Fixed width */
        flex-shrink: 0;
    }
}

/* Scrollbar styling for sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 20px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-secondary);
}

.sidebar h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 1.5rem 0 0.5rem;
    letter-spacing: 1px;
}

.sidebar h3:first-child {
    margin-top: 0;
}

.sidebar a {
    display: block;
    padding: 0.5rem 0.8rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 2px;
    transition: all 0.2s;
}

.sidebar a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-color);
}

.sidebar a.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-color);
    border-left: 3px solid var(--accent-color);
}

.main-content {
    flex: 1;
    padding: 2rem;
    overflow-x: hidden;
}

/* Recommendations */
.related-tools {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.related-card {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s;
}

.related-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
}

/* Mega Menu */
.mega-menu-trigger {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mega-menu-trigger:hover .mega-menu {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-menu {
    position: absolute;
    top: 100%;
    right: 0;
    /* Anchor to right edge of container */
    left: auto;
    /* Override any left positioning */
    transform: translateY(10px);
    /* Only animate Y */
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    width: 900px;
    max-width: 90vw;
    /* Ensure it fits on smaller screens */
    width: min(900px, 95vw);
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.5);
    z-index: 1000;

    /* Animation state */
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

/* Specific fix to center it relative to the header, not the trigger */
header {
    position: relative;
}

.mega-menu-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

.mm-column h4 {
    color: var(--accent-color);
    text-transform: uppercase;
    font-size: 0.8rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    letter-spacing: 1px;
}

.mm-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
    margin-bottom: 0.2rem;
}

.mm-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-color);
}

.mm-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Arrow indicator for dropdown */
.mega-menu-trigger::after {
    content: "▼";
    font-size: 0.6rem;
    margin-left: 2px;
    color: var(--text-secondary);
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.theme-toggle:hover {
    color: var(--accent-color);
}

/* Enhanced Home Page */
/* Enhanced Home Page (3D & Animated) */
.hero-new {
    position: relative;
    text-align: center;
    padding: 8rem 1rem 6rem;
    background: radial-gradient(circle at center, var(--accent-glow) 0%, transparent 70%);
    /* Restored Glow */
    overflow: hidden;
    perspective: 1000px;
    /* Enable 3D perspective */
}

/* Background Animated Icons */
.hero-bg-icons {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.floating-icon {
    position: absolute;
    opacity: 0.15;
    /* Subtle visibility */
    animation: float 6s ease-in-out infinite;
    color: var(--accent-color);
}

.floating-icon svg {
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 0 10px var(--accent-color));
}

/* Specific Icon Positions & Delays */
.icon-1 {
    top: 15%;
    left: 10%;
    animation-delay: 0s;
    transform: rotate(-15deg);
}

.icon-2 {
    top: 20%;
    right: 15%;
    animation-delay: 1.5s;
    transform: rotate(10deg);
}

.icon-3 {
    bottom: 25%;
    left: 20%;
    animation-delay: 3s;
    transform: rotate(-5deg);
}

.icon-4 {
    bottom: 30%;
    right: 10%;
    animation-delay: 4.5s;
    transform: rotate(15deg);
}

.icon-5 {
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 2s;
    opacity: 0.05;
}

@keyframes float {
    0% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(5deg);
    }

    100% {
        transform: translateY(0px) rotate(0deg);
    }
}

/* Hero Content with Glassmorphism/Emboss */
.hero-content {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    /* Optional glass backing if needed, but text shadow might be enough */
}

.hero-new h1 {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    letter-spacing: -0.02em;

    /* 3D Embossed Text Shadow Effect */
    filter: drop-shadow(0px 4px 0px rgba(0, 0, 0, 0.2));
    animation: fadeInUp 0.8s ease-out forwards;
}

.hero-new p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 2rem;
    animation: fadeInUp 0.8s ease-out 0.2s forwards;
    opacity: 0;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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



.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.category-grid {
    display: grid;
    /* Use auto-fit to stretch cards to fill width, maximizing space usage */
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.category-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    transition: all 0.3s ease;
    background-image: var(--gradient-card);
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
    border-color: var(--accent-color);
}

.category-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.category-icon {
    width: 48px;
    height: 48px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
}

.category-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.tool-list {
    list-style: none;
    display: grid;
    /* Responsive grid inside the card: 
       - Mobile: 1 column 
       - Wide Card: 2 or 3 columns automatically
    */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.tool-list li {
    margin-bottom: 0;
}

.tool-item-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    width: 100%;
}

.tool-item-link:hover {
    background: rgba(255, 255, 255, 0.05);
}

.tool-item-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    /* Flexbox truncate fix */
    flex: 1;
}

.tool-item-icon {
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.2s;
    flex-shrink: 0;
}

.tool-item-link:hover .tool-item-icon {
    color: var(--accent-color);
}

.tool-item-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: normal;
    /* Allow wrapping */
    line-height: 1.3;
    transition: color 0.2s;
}

.tool-item-link:hover .tool-item-text {
    color: var(--accent-hover);
}

.tool-item-meta {
    display: flex;
    gap: 0.4rem;
    opacity: 0.7;
    transform: scale(0.9);
    flex-shrink: 0;
}

/* Footer Links */

/* Footer Links */
.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.footer-links a {
    color: var(--text-secondary);
}

.footer-links a:hover {
    color: var(--accent-color);
}

/* Ensure footer has proper contrast in light mode */
body.light-mode footer .text-secondary {
    color: #475569 !important;
}

body.light-mode footer a {
    color: #475569;
}

body.light-mode footer a:hover {
    color: var(--accent-color);
}

/* Fix content page text visibility in light mode */
body.light-mode .prose,
body.light-mode .text-slate-300,
body.light-mode .prose p,
body.light-mode .prose li,
body.light-mode .tool-content p,
body.light-mode .tool-content li {
    color: #334155 !important;
}

body.light-mode .text-slate-100,
body.light-mode .prose h2,
body.light-mode .tool-content h2 {
    color: #0f172a !important;
}

body.light-mode .prose strong,
body.light-mode .tool-content strong {
    color: #1e293b !important;
}

/* Critical Warning Box - Works in both light and dark modes */
.critical-warning-box {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-left: 4px solid var(--error);
    padding: 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.critical-warning-box strong {
    color: var(--error);
    font-weight: 600;
}

/* Light mode specific adjustments for warning box */
body.light-mode .critical-warning-box {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #7f1d1d;
}

body.light-mode .critical-warning-box strong {
    color: #991b1b;
}

body.light-mode .critical-warning-box h2 {
    color: #991b1b !important;
}

/* Diff Tool Styles */
.diff-line {
    font-family: monospace;
    padding: 2px 5px;
    white-space: pre-wrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.diff-line.removed {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.diff-line.added {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.diff-line.modified .del {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    text-decoration: line-through;
    opacity: 0.7;
}

.diff-line.modified .ins {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}

.diff-line .line-num {
    display: inline-block;
    width: 30px;
    color: #666;
    user-select: none;
    text-align: right;
    margin-right: 10px;
}

/* AI Prompt Tool Styles */
.prompt-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.prompt-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.prompt-input-group p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.prompt-input-group textarea {
    min-height: 150px;
    resize: vertical;
    width: 100%;
}

.prompt-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.prompt-actions .tool-btn {
    flex: 1;
    min-width: 140px;
    justify-content: center;
    display: flex;
    align-items: center;
}

.ai-results {
    margin-top: 2rem;
    display: none;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
}

/* Sidebar Link Unification */
.tool-sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    color: var(--text-primary);
    text-decoration: none;
    margin-bottom: 2px;
}

.tool-sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.tool-sidebar-link.active {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
}

.tool-sidebar-link .link-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1;
}

.tool-sidebar-link .link-icon {
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.tool-sidebar-link:hover .link-icon,
.tool-sidebar-link.active .link-icon {
    color: var(--accent-color);
}

.tool-sidebar-link .link-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
    font-weight: 500;
}