:root {
    --bg-primary: #f8fafc;
    /* Slate 50 */
    --bg-secondary: #f1f5f9;
    /* Slate 100 */
    --accent-primary: #2563eb;
    /* Blue 600 - Darker primary */
    --accent-secondary: #1d4ed8;
    /* Blue 700 - Even darker for buttons/hover */
    --text-primary: #0f172a;
    /* Slate 900 - Darker/Sharper than Slate 950 for some screens */
    --text-secondary: #475569;
    /* Slate 600 - More readable secondary */
    --card-bg: #ffffff;
    --card-border: #cbd5e1;
    /* Slate 300 - More visible border */
    --glass-bg: rgba(255, 255, 255, 0.95);
    --hover-bg: #eff6ff;
    --font-main: 'Inter',
        system-ui,
        -apple-system,
        sans-serif;
    --transition: all 0.2s ease;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1),
        0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 8px 10px -6px rgba(0, 0, 0, 0.1);

    --carousel-radius: 350px;
}

@media (max-width: 768px) {
    :root {
        --carousel-radius: 200px;
        /* Smaller radius for mobile */
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Fix for blurry text on transparent backgrounds */
.main-content,
.page-content,
.tool-container,
.workspace {
    background-color: var(--bg-primary);
    /* Ensure opaque background */
    backdrop-filter: none;
    /* Remove potential blur effects causing text issues */
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #0f172a;
    /* Dark Neon Base */
    border-right: 1px solid #3b82f6;
    padding: 2rem;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transform: translateX(0);
    transition: var(--transition);
    box-shadow: 5px 0 20px rgba(59, 130, 246, 0.15);
    /* Neon Glow */
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: #60a5fa;
    /* Neon Blue Text */
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: -0.025em;
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.nav-category {
    margin-bottom: 2rem;
}

.nav-header {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #94a3b8;
    /* Slate 400 */
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
    font-weight: 700;
    padding-left: 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    color: #cbd5e1;
    /* Slate 300 */
    border-radius: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.nav-item:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    /* Neon Blue */
    font-weight: 600;
    border-left: 3px solid #60a5fa;
    /* Neon Indicator */
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

/* 3D Carousel Styles */
.featured-section {
    perspective: 1000px;
    margin: 4rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.featured-section-title {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    text-align: center;
}

.carousel-container {
    width: 250px;
    height: 200px;
    position: relative;
    /* Removed padding/overflow hidden to let 3D elements extend */
}

.carousel {
    width: 100%;
    height: 100%;
    position: absolute;
    transform: translateZ(-350px);
    /* Push back to make room for radius */
    transform-style: preserve-3d;
    transition: transform 1.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.carousel__cell {
    position: absolute;
    width: 140px;
    height: 140px;
    left: 55px;
    /* Center in container (250-140)/2 */
    top: 10px;
    background: var(--surface-card);
    /* Ensure solid background, NOT transparent */
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
    backface-visibility: hidden;
    /* Hide back side to prevent weird see-through */
    /* Calculated in JS: transform: rotateY(..deg) translateZ(..px); */
}

/* Front-facing cell effects */
.carousel__cell:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 25px var(--accent-primary);
}

.carousel__cell i {
    font-size: 40px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.carousel__cell span {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
    text-align: center;
    max-width: 90%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Controls */
.carousel-nav {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
    z-index: 10;
}

.carousel-btn {
    background: var(--surface-hover);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.carousel-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 3rem 4rem;
    width: calc(100% - 280px);
}

header {
    margin-bottom: 3.5rem;
    animation: fadeIn 0.6s ease-out;
}

header h1 {
    font-size: 2.25rem;
    margin-bottom: 0.75rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    line-height: 1.6;
}

/* Dashboard Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.tool-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.tool-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.tool-icon {
    width: 44px;
    height: 44px;
    background: #eff6ff;
    /* Blue 50 */
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    color: var(--accent-secondary);
    transition: var(--transition);
}

.tool-card:hover .tool-icon {
    background: var(--accent-secondary);
    color: white;
}

.tool-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #020617 !important;
    /* Force darker text */
}

.tool-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Tool Workspace */
.workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    background: #ffffff;
    /* Force white, not var */
    border-radius: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--card-border);
    padding: 2rem;
    align-items: start;
    min-height: 600px;
}

/* Single Container for Tools inside Workspace */
.input-section,
.output-section,
.glass-panel {
    /* glass-panel class is used in js implementations extensively */
    background: #f8fafc;
    /* Slate 50 */
    border: 1px solid var(--card-border);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    width: 100%;
}

textarea,
input[type="text"],
input[type="number"],
input[type="email"],
select {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 0.5rem;
    padding: 0.75rem;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.95rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

textarea:focus,
input:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn {
    background: var(--accent-secondary);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    color: #000000 !important;
    /* Fixed: User reported white-on-white issues */
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    box-shadow: var(--shadow-md);
    font-size: 0.95rem;
}

.btn:hover {
    background: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(0);
}

/* Output Area Specifics */
.output-content,
pre {
    background: #1e293b;
    /* Keep code/output dark for contrast? Or light? User asked for light theme. */
    /* Let's go with a light output background but distinct */
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    padding: 1rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    white-space: pre-wrap;
}

/* Specific fix for images in tools */
img {
    max-width: 100%;
    border-radius: 0.5rem;
}

.hidden {
    display: none !important;
}

/* Mobile */
@media (max-width: 768px) {
    .app-container {
        display: block;
    }

    .sidebar {
        left: -280px;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1.5rem;
    }

    /* --- FINAL COLOR FIXES --- */

    /* 1. Sidebar Text: Force White */
    .sidebar,
    .sidebar .nav-item,
    .sidebar .nav-header,
    .sidebar a,
    .sidebar i {
        color: #ffffff !important;
    }

    .sidebar .nav-item:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .sidebar .nav-item.active {
        color: #60a5fa !important;
        /* Keep Neon Blue for Active */
        background: rgba(59, 130, 246, 0.2);
    }

    /* 2. Tool Text: Force Black/Dark */
    .tool-container,
    .workspace,
    .workspace * {
        color: #000000 !important;
    }

    /* Exception: Buttons and Inputs might need specific colors, but black text is safe for inputs on light bg */
    .tool-container input,
    .tool-container textarea,
    .tool-container select,
    .workspace input,
    .workspace textarea,
    .workspace select {
        color: #000000 !important;
        background: #ffffff !important;
        border-color: #cbd5e1 !important;
    }

    .tool-container h1,
    .tool-container h2,
    .tool-container h3,
    .workspace h1,
    .workspace h2,
    .workspace h3 {
        color: #000000 !important;
        -webkit-text-fill-color: initial !important;
        /* Reset gradient text if it was breaking */
    }

    /* Fix placeholders if needed */
    ::placeholder {
        color: #64748b !important;
        opacity: 1;
    }

    /* Ensure output box is visible */
    .result-box,
    pre,
    .output-content {
        background: #f1f5f9 !important;
        color: #000000 !important;
        border: 1px solid #94a3b8 !important;
    }

    /* --- EMERGENCY FIXES --- */

    /* 1. Tool Input/Text Contrast Fixes */
    .tool-container {
        background: #ffffff !important;
        color: #1e293b !important;
        /* Slate 800 */
        padding: 20px;
        border-radius: 8px;
        border: 1px solid #e2e8f0;
    }

    .tool-container input,
    .tool-container textarea,
    .tool-container select {
        background: #f8fafc !important;
        color: #0f172a !important;
        /* Slate 900 */
        border: 1px solid #cbd5e1 !important;
    }

    .tool-result,
    .result-box {
        background: #f1f5f9 !important;
        color: #000000 !important;
        border: 1px solid #cbd5e1 !important;
    }

    /* 2. Responsive 3D Carousel */
    @media (max-width: 768px) {
        .featured-section {
            margin: 2rem 0;
            perspective: 600px;
            /* Reduced perspective */
        }

        .carousel-container {
            width: 160px;
            /* Smaller container */
            height: 140px;
        }

        .carousel {
            /* Adjust translateZ for smaller radius on mobile */
            transform: translateZ(-200px);
        }

        .carousel__cell {
            width: 100px;
            height: 100px;
            left: 30px;
            /* Center (160-100)/2 */
            top: 10px;
            /* Mobile font sizes */
        }

        .carousel__cell i {
            font-size: 24px;
            margin-bottom: 5px;
        }

        .carousel__cell span {
            font-size: 0.7rem;
        }

        /* Override inline styles via script if possible, or force scale */
    }

    /* 3. Global Text Safety */
    body,
    p,
    h1,
    h2,
    h3,
    span,
    div {
        /* Ensure no accidental white-on-white from dark mode bleed */
        color: var(--text-primary);
    }

    .sidebar p,
    .sidebar h1,
    .sidebar h2,
    .sidebar div,
    .sidebar span,
    .sidebar a {
        color: inherit;
        /* Allow sidebar to keep its dark theme colors */
    }

    .workspace {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    #mobile-menu-btn {
        display: flex;
        color: var(--text-primary);
        background: white;
        border: 1px solid var(--card-border);
    }
}

#mobile-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 99999;
    /* Super High Z-Index */
    width: 45px;
    height: 45px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    cursor: pointer;
}

#mobile-menu-btn:hover {
    background: var(--accent-secondary);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Dashboard Professional Styles --- */
.dashboard-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    padding: 4rem 2rem;
    border-radius: 1rem;
    margin-bottom: 3rem;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 800;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-content p {
    font-size: 1.25rem;
    color: #cbd5e1;
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.stat-item {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    padding: 1.5rem 3rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
}

.stat-num {
    font-size: 2rem;
    font-weight: 800;
    color: #38bdf8;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.hero-search-wrap {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
}

.hero-search-wrap input {
    width: 100%;
    padding: 1.25rem 2rem;
    padding-right: 4rem;
    border-radius: 9999px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    backdrop-filter: blur(5px);
    transition: all 0.3s;
}

.hero-search-wrap input:focus {
    outline: none;
    background: white;
    color: #0f172a;
    border-color: white;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.5);
}

.hero-search-wrap .search-icon {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

.hero-search-wrap input:focus+.search-icon {
    color: #0f172a;
}

.dashboard-section {
    margin-bottom: 4rem;
}

.dashboard-section h2 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dashboard-section h2::before {
    content: '';
    display: block;
    width: 6px;
    height: 2rem;
    background: var(--primary);
    border-radius: 4px;
}

.dashboard-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.cat-card {
    background: white;
    padding: 2rem;
    border-radius: 1.5rem;
    border: 1px solid var(--card-border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
}

.cat-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(59, 130, 246, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.cat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--primary);
}

.cat-card:hover::after {
    opacity: 1;
}

.cat-icon-lg {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    width: 4rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    color: var(--primary);
    font-size: 1.5rem;
    transition: transform 0.3s;
}

.cat-card:hover .cat-icon-lg {
    transform: scale(1.1) rotate(5deg);
}

.cat-info h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 700;
}

.cat-info p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.tool-card {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--card-border);
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    transition: all 0.3s;
    cursor: pointer;
    height: 100%;
}

.tool-card:hover {
    border-color: var(--primary);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

.tool-icon {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 0.75rem;
    color: #64748b;
    transition: all 0.3s;
}

.tool-card:hover .tool-icon {
    background: var(--primary);
    color: white;
}

.tool-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.tool-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- USER REQUESTED FIX: FORCE LIGHT MODE FOR ALL TOOLS (REVERTED DARK MODE) --- */
/* The user requested the functional area to be light. */

.tool-container,
.tool-container .glass-panel,
.tool-container .tool-content-rich,
.tool-container h1,
.tool-container h2,
.tool-container h3,
.tool-container h4,
.tool-container h5,
.tool-container h6,
.tool-container p,
.tool-container span,
.tool-container div,
.tool-container label,
.tool-container li {
    background-color: #ffffff !important;
    /* Force Light Background */
    color: #0f172a !important;
    /* Force Dark Text */
}

/* Ensure inputs remain readable and defined */
.tool-container input,
.tool-container textarea,
.tool-container select {
    background-color: #f8fafc !important;
    /* Slightly off-white for inputs */
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

.tool-container input::placeholder,
.tool-container textarea::placeholder {
    color: #64748b !important;
    /* Standard placeholder */
}

/* Maintain button visibility */
.tool-container button,
.tool-container .btn {
    background-color: #3b82f6 !important;
    /* Force Blue Background */
    color: #ffffff !important;
    /* White text on buttons */
    border: none !important;
    padding: 0.75rem 1.5rem !important;
    border-radius: 0.5rem !important;
    cursor: pointer !important;
    font-weight: 600 !important;
}

.tool-container button:hover,
.tool-container .btn:hover {
    background-color: #2563eb !important;
    /* Darker blue on hover */
}


/* Output areas - Keep distinct but light */
.tool-container .result-box,
.tool-container pre,
.tool-container .output-content {
    background-color: #f1f5f9 !important;
    color: #334155 !important;
    border-color: #e2e8f0 !important;
}