 /*
    Eurisko AI - Stylesheet
    Version: 2.3 (Fully Responsive)
    Author: Mohsin (via Gemini)
*/

/* ==========================================================================
   TABLE OF CONTENTS
   ==========================================================================
    1.  DESIGN SYSTEM & GLOBAL VARIABLES
    2.  BASE, RESET & UTILITIES
    3.  TYPOGRAPHY
    4.  LAYOUT & CORE STRUCTURE
    5.  COMPONENTS
    6.  FOOTER
    7.  ACCESSIBILITY & VENDOR
    8.  ANIMATIONS & KEYFRAMES
    9.  RESPONSIVE DESIGN
   ========================================================================== */


/* ==========================================================================
   1. DESIGN SYSTEM & GLOBAL VARIABLES
   ========================================================================== */

:root {
    /* Fonts */
    --font-heading: 'Cormorant Garamond', serif;
    --font-body: 'Inter', sans-serif;

    /* Light Theme Colors */
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --text-muted-color: #6c757d;
    --surface-color: #ffffff;
    --border-color: #dee2e6;
    --primary-color: #4f46e5;
    --primary-hover-color: #4338ca;
    --accent-color: #e11d48;
    --shadow-color: rgba(67, 56, 202, 0.08);
    --aurora-1: #a5b4fc;
    --aurora-2: #f9a8d4;

    /* Layout & Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-xxl: 4rem;

    /* Radii (Borders) */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 24px;

    /* Shadows & Transitions */
    --shadow-soft: 0 4px 15px var(--shadow-color);
    --shadow-medium: 0 8px 30px var(--shadow-color);
    --transition-quick: 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    --transition-main: 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    --transition-slow: 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

[data-theme="dark"] {
    /* Dark Theme Colors */
    --bg-color: #0f172a;
    --text-color: #f1f5f9;
    --text-muted-color: #94a3b8;
    --surface-color: #1e293b;
    --border-color: #334155;
    --primary-color: #818cf8;
    --primary-hover-color: #a78bfa;
    --accent-color: #f472b6;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --aurora-1: #4f46e5;
    --aurora-2: #c026d3;
}


/* ==========================================================================
   2. BASE, RESET & UTILITIES
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color var(--transition-slow), color var(--transition-slow);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* === RESPONSIVE FIX: Prevent horizontal scroll on the entire page === */
    overflow-x: hidden;
}

.background-aurora {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.background-aurora::before,
.background-aurora::after {
    content: '';
    position: absolute;
    width: 80vw;
    height: 80vw;
    max-width: 800px;
    max-height: 800px;
    border-radius: 50%;
    filter: blur(150px);
    mix-blend-mode: multiply;
    opacity: 0.2;
}
[data-theme="dark"] .background-aurora::before,
[data-theme="dark"] .background-aurora::after {
    mix-blend-mode: screen;
    opacity: 0.25;
}

.background-aurora::before {
    background: var(--aurora-1);
    top: -20%;
    left: -20%;
    animation: moveAurora1 20s infinite alternate ease-in-out;
}

.background-aurora::after {
    background: var(--aurora-2);
    bottom: -20%;
    right: -20%;
    animation: moveAurora2 25s infinite alternate ease-in-out;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/* ==========================================================================
   3. TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-color);
    word-break: break-word; /* RESPONSIVE FIX: Prevent long words from overflowing */
}

/* === RESPONSIVE FIX: Adjusted clamp() for smaller screens === */
.hero-title {
    font-size: clamp(2.5rem, 10vw, 6rem);
    letter-spacing: -2px;
}

.section-title,
.modal-title {
    font-size: clamp(1.5rem, 5vw, 2rem);
}

.card-title {
    font-size: 1.3rem;
    font-weight: 600;
}

p {
    margin-bottom: var(--space-md);
    max-width: 65ch;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-quick);
}

a:hover {
    text-decoration: underline;
    color: var(--primary-hover-color);
}


/* ==========================================================================
   4. LAYOUT & CORE STRUCTURE
   ========================================================================== */

#app-container {
    max-width: 1400px;
    margin: 0 auto;
    /* === RESPONSIVE FIX: Reduced padding on mobile === */
    padding: 0 var(--space-md);
}

.hero-section {
    padding: var(--space-xxl) 0 var(--space-xxl);
    text-align: center;
}

.author-credit {
    font-family: var(--font-body);
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: var(--text-muted-color);
    font-weight: 500;
    letter-spacing: normal;
    vertical-align: middle;
    margin-left: var(--space-sm);
}

.hero-subtitle {
    max-width: 50ch;
    margin: var(--space-lg) auto 0;
    color: var(--text-muted-color);
}

.stats-line {
    margin-top: var(--space-lg);
    color: var(--text-muted-color);
}

.controls-section {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg) 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.primary-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    align-items: center;
    flex-grow: 1;
    min-width: 0;
}

.secondary-actions {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.popular-categories {
    padding: var(--space-md) 0 var(--space-xxl);
    overflow: hidden;
}

#content-area {
    perspective: 1000px;
}

/* ==========================================================================
   5. COMPONENTS
   ========================================================================== */

/* --- Search Bar (Floating Label) --- */
.hero-search-container {
    margin: 2.5rem auto 0;
    max-width: 600px;
}

.floating-label-group {
    position: relative;
}

#search-input {
    width: 100%;
    padding: 1.5rem 1.5rem 0.5rem 1.5rem;
    font-size: 1.1rem;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-main);
}

.floating-label-group label {
    position: absolute;
    top: 1rem;
    left: 1.5rem;
    font-size: 1.1rem;
    color: var(--text-muted-color);
    pointer-events: none;
    transition: all var(--transition-main);
}

#search-input:focus,
#search-input:not(:placeholder-shown) {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-color) 20%, transparent);
}

#search-input:focus + label,
#search-input:not(:placeholder-shown) + label {
    top: 0.5rem;
    font-size: 0.75rem;
    color: var(--primary-color);
}


/* --- Filters (Dropdown & Tags) --- */
.filter-dropdown {
    position: relative;
    width: 200px;
}

.filter-dropdown summary {
    padding: 0.6rem 1rem;
    cursor: pointer;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--surface-color);
    list-style: none;
    transition: all var(--transition-main);
}
.filter-dropdown summary::after {
    content: '▼';
    font-size: 0.7em;
    float: right;
    margin-top: 4px;
    transition: transform var(--transition-main);
}
.filter-dropdown[open] summary {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-color: var(--primary-color);
}
.filter-dropdown[open] summary::after {
    transform: rotate(180deg);
}

.filter-options {
    position: absolute;
    top: 100%;
    left: 0;
    /* === RESPONSIVE FIX: Make dropdown width flexible === */
    width: 90vw;
    max-width: 350px;
    z-index: 10;
    background: var(--surface-color);
    border: 1px solid var(--primary-color);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    padding: 0.75rem;
    box-shadow: var(--shadow-medium);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.tag-filter-group {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tag-filter-group::-webkit-scrollbar {
    display: none;
}
.tag-chips-container {
    display: flex;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
}

.tag-chip {
    flex-shrink: 0;
    padding: 0.4rem 0.9rem;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted-color);
    cursor: pointer;
    transition: all var(--transition-main);
}
.tag-chip:hover {
    background-color: color-mix(in srgb, var(--text-color) 5%, transparent);
    color: var(--text-color);
    border-color: var(--text-muted-color);
}
.tag-chip:active {
    transform: scale(0.95);
}
.tag-chip.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.tag-chip.favorites-chip.active {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

/* --- Action Buttons (Sort, View, Theme) --- */
select, .view-button, .theme-toggle-button {
    height: 42px;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-main);
    cursor: pointer;
}
select:hover, .view-button:hover, .theme-toggle-button:hover {
    border-color: var(--primary-color);
}

.sort-container select {
    padding: 0 2rem 0 1rem;
    appearance: none;
}
.view-toggle {
    display: flex;
}
.view-button {
    width: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
}
.view-button:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.view-button:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; border-left: none; }
.view-button.active {
    background-color: var(--primary-color);
}

.icon-grid { width: 16px; height: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.icon-grid div { background-color: var(--text-muted-color); border-radius: 1px; transition: background-color var(--transition-main); }
.view-button.active .icon-grid div { background-color: white; }
.icon-list { width: 16px; height: 16px; display: flex; flex-direction: column; gap: 4px; }
.icon-list div { background-color: var(--text-muted-color); border-radius: 1px; height: 3px; transition: background-color var(--transition-main); }
.view-button.active .icon-list div { background-color: white; }

/* --- Popular Category Pills --- */
.category-pills-container {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.category-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.75rem 1rem;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-main);
    text-align: center;
}
.category-pill:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft);
}
.category-pill:active {
    transform: translateY(-1px) scale(0.98);
}


/* --- Tool Cards --- */
.tools-grid-container {
    display: grid;
    gap: 1.75rem;
}
.tools-grid-container.grid-view {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.tools-grid-container.list-view {
    display: flex;
    flex-direction: column;
}

.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s var(--transition-slow), transform 0.6s var(--transition-slow);
}
.scroll-animate.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.tool-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(800px circle at var(--mouse-x, 0) var(--mouse-y, 0), color-mix(in srgb, var(--primary-color) 15%, transparent), transparent 40%);
    border-radius: inherit;
    opacity: 0;
    transition: opacity var(--transition-slow);
    z-index: 1;
}
.tool-card:hover::before {
    opacity: 1;
}
.tool-card > * {
    position: relative;
    z-index: 2;
}

.tool-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-8px) rotateX(5deg) scale(1.02);
    box-shadow: var(--shadow-medium);
}

.card-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}
.card-logo-name {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-grow: 1;
}
.card-logo {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 15%, transparent);
    flex-shrink: 0;
}
.card-title {
    font-size: 1.3rem;
    line-height: 1.2;
}
.card-favorite-button {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--text-muted-color);
    transition: all var(--transition-main);
}
.card-favorite-button:hover {
    color: var(--accent-color);
    transform: scale(1.2);
}
.card-favorite-button.is-favorite {
    color: var(--accent-color);
}
.card-description {
    flex-grow: 1;
    margin-bottom: var(--space-lg);
    color: var(--text-muted-color);
}
.card-footer {
    margin-top: auto;
    font-size: 0.9rem;
    color: var(--text-muted-color);
}

/* --- Load More Button --- */
.load-more-wrapper {
    text-align: center;
    padding: var(--space-xl) 0;
}
#load-more-btn {
    width: auto;
    padding-left: var(--space-xl);
    padding-right: var(--space-xl);
}

/* ==========================================================================
   5. Redirect Modal
   ========================================================================== */
.modal-container {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-main), visibility 0s 0.3s;
}
.modal-container.is-open {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}
.modal-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}
.modal-content {
    position: relative;
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    width: 100%;
    max-width: 450px;
    text-align: center;
    box-shadow: var(--shadow-medium);
    transform: scale(0.95);
    transition: transform var(--transition-main);
}
.modal-container.is-open .modal-content {
    transform: scale(1);
}

.modal-text {
    margin-bottom: var(--space-lg);
}
.modal-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

/* --- General Button Styles --- */
.cta-button {
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-main);
    text-align: center;
    text-decoration: none;
    border: 2px solid transparent;
}
.cta-button:active {
    transform: translateY(1px) scale(0.98);
}

.cta-primary {
    background-color: var(--primary-color);
    color: white;
}
.cta-primary:hover {
    background-color: var(--primary-hover-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}
.cta-secondary {
    background: var(--surface-color);
    color: var(--text-color);
    border-color: var(--border-color);
}
.cta-secondary:hover {
    border-color: var(--text-color);
}

/* ==========================================================================
   6. Skeleton Loaders
   ========================================================================== */
.skeleton { opacity: 0.7; animation: shimmer 1.5s infinite linear; background: linear-gradient(90deg, color-mix(in srgb, var(--border-color) 20%, transparent) 25%, color-mix(in srgb, var(--border-color) 50%, transparent) 50%, color-mix(in srgb, var(--border-color) 20%, transparent) 75%); background-size: 200% 100%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { background-color: var(--surface-color); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1.5rem; }
.skeleton-header { display: flex; align-items: center; gap: var(--space-md); }
.skeleton-logo { width: 52px; height: 52px; border-radius: var(--radius-md); }
.skeleton-title { height: 20px; width: 60%; border-radius: var(--radius-sm); }
.skeleton-desc { height: 16px; width: 100%; margin-top: var(--space-lg); border-radius: var(--radius-sm); }
.skeleton-desc-2 { height: 16px; width: 80%; margin-top: 0.5rem; border-radius: var(--radius-sm); }

/* ==========================================================================
   7. Empty State & Footer
   ========================================================================== */
.empty-state-container { text-align: center; padding: var(--space-xxl) var(--space-xl); }
.empty-state-container h2 { margin-bottom: 0.5rem; }
.empty-state-container p { margin-bottom: var(--space-lg); }

.site-footer { background-color: var(--surface-color); border-top: 1px solid var(--border-color); color: var(--text-muted-color); padding: var(--space-xxl) var(--space-md) 0; margin-top: var(--space-xxl); }
.footer-container { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 2.5rem; }
.footer-column .footer-title { font-size: 2rem; color: var(--text-color); margin-bottom: var(--space-md); }
.footer-column .footer-heading { font-size: 1.1rem; font-weight: 600; color: var(--text-color); margin-bottom: var(--space-md); }
.footer-column p { margin-bottom: var(--space-md); line-height: 1.7; }
.footer-links { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.footer-links a { color: var(--text-muted-color); }
.footer-links a:hover { color: var(--primary-color); }
.footer-cta { width: auto; padding-left: 1.5rem; padding-right: 1.5rem; background-color: transparent; border: 2px solid var(--primary-color); color: var(--primary-color); }
.footer-cta:hover { background-color: var(--primary-color); color: white; }
.footer-bottom { text-align: center; border-top: 1px solid var(--border-color); padding: var(--space-xl) 0; margin-top: 3rem; font-size: 0.9rem; }

/* ==========================================================================
   8. ACCESSIBILITY & VENDOR
   ========================================================================== */
:is(a, button, input, select, details, [tabindex="0"]):focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; box-shadow: none; }
.tool-card:focus-visible { border-color: var(--primary-color); box-shadow: 0 0 0 2px var(--primary-color); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--surface-color); }
::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 10px; border: 2px solid var(--surface-color); }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-muted-color); }
body { scrollbar-color: var(--border-color) var(--surface-color); scrollbar-width: thin; }

/* ==========================================================================
   9. RESPONSIVE DESIGN
   ========================================================================== */
@media (min-width: 768px) {
    #app-container {
        padding: 0 var(--space-xl);
    }
}

@media (max-width: 768px) {
    .controls-section { flex-direction: column; align-items: stretch; }
    .primary-filters { flex-direction: column; align-items: stretch; }
    .filter-dropdown { width: 100%; }
}

@media (max-width: 480px) {
    .modal-content {
        padding: var(--space-lg);
    }
    .modal-title {
        font-size: 1.5rem;
    }
    .modal-actions {
        flex-direction: column-reverse;
    }
    .category-pills-container {
        grid-template-columns: 1fr 1fr;
    }
}