/* * SOF.AI - Material Design 3 Architecture (Premium High Performance)
 * Architect: Rubén Carrión
 */

:root {
    /* Palette */
    --primary: #1A73E8;
    --primary-hover: #1557B0;
    --secondary: #E8F0FE;

    /* Surfaces */
    --bg-main: #F4F6F9;
    --bg-secondary: #FFFFFF;
    --surface: #FFFFFF;
    --border: #E0E3E7;

    /* Typography */
    --text-main: #202124;
    --text-sub: #5F6368;

    /* Metrics */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 50px;

    /* Elevation */
    --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-hover: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);

    /* Typography */
    --font-stack: 'Google Sans', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-stack);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* --- Navigation --- */
.top-nav {
    background: rgba(255, 255, 255, 0.95);
    /* High opacity for performance */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.8rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.nav-content {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-main);
    font-size: 1.4rem;
    letter-spacing: -0.5px;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    font-weight: 700;
    color: var(--text-main);
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-sub);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-pill);
    transition: all 0.2s ease;
}

.nav-links a:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--primary);
}

.nav-links a.active {
    background-color: var(--secondary);
    color: var(--primary);
}

/* --- Headers --- */
.hero-header {
    text-align: center;
    padding: 5rem 1.5rem 4rem;
    background: radial-gradient(circle at 50% 0%, #ffffff 0%, #f0f4ff 100%);
    border-bottom: 1px solid var(--border);
}

.hero-content h1 {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.75rem;
    letter-spacing: -1.5px;
    background: linear-gradient(90deg, #1A73E8, #8AB4F8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-content p {
    color: var(--text-sub);
    font-size: 1.25rem;
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.page-header {
    background: linear-gradient(135deg, #FFFFFF 0%, #F3F6FC 100%);
    padding: 4rem 0 2rem;
    border-bottom: 1px solid var(--border);
}

.page-header h2 {
    font-weight: 700;
    font-size: 2.5rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

/* --- Search --- */
.hero-search {
    max-width: 650px;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-pill);
    background: #fff;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border);
}

.hero-search:hover,
.hero-search:focus-within {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.hero-search input {
    width: 100%;
    padding: 1rem 3.5rem 1rem 1.5rem;
    border: none;
    border-radius: var(--radius-pill);
    outline: none;
    font-size: 1.1rem;
    color: var(--text-main);
    background: transparent;
}

.hero-search button {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Filter Bar --- */
.filter-bar {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    background: #fff;
    padding: 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-1);
    border: 1px solid var(--border);
}

.filter-bar select,
.filter-bar input {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: #FAFAFA;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
}

.filter-bar input {
    flex-grow: 1;
    min-width: 250px;
}

/* --- Layout --- */
.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.layout-container {
    max-width: 1280px;
    margin: 0 auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    width: 100%;
}

.home-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 3rem;
    align-items: start;
}

/* --- Sidebar --- */
.sidebar-categories {
    position: sticky;
    top: 100px;
    background: #fff;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-1);
}

.sidebar-categories h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-sub);
    letter-spacing: 1.5px;
    margin-bottom: 1.25rem;
    font-weight: 700;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cat-btn {
    text-align: left;
    background: transparent;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

.cat-btn:hover {
    background-color: var(--secondary);
    color: var(--primary);
    transform: translateX(5px);
}

/* --- Tools Grid --- */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.tool-card {
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: var(--shadow-1);
    will-change: transform, box-shadow;
    /* Optimization hint */
}

.tool-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-6px);
    border-color: rgba(26, 115, 232, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.tool-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

.badge {
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.free {
    background-color: #E6F4EA;
    color: #1E8E3E;
}

.badge.paid {
    background-color: #FCE8E6;
    color: #D93025;
}

.badge.freemium {
    background-color: #FEF7E0;
    color: #B06000;
}

.tool-category-label {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tool-desc {
    color: var(--text-sub);
    font-size: 1rem;
    line-height: 1.6;
    flex-grow: 1;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.view-all {
    background: white;
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-pill);
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.view-all:hover {
    background: var(--secondary);
}

/* --- Optimized Modal (No Blur for Performance) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    /* Dark clean overlay */
    /* REMOVED backdrop-filter to fix lag on ultrawide/4k screens */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.2s ease;
    will-change: opacity;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: #fff;
    width: 90%;
    max-width: 700px;
    border-radius: var(--radius-lg);
    padding: 3rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
    /* Simplified animation */
    animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: #F1F3F4;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover {
    background: #E0E0E0;
    color: #000;
}

.modal-btn {
    display: block;
    width: 100%;
    text-align: center;
    background: var(--primary);
    color: white;
    padding: 1rem;
    border-radius: var(--radius-pill);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    margin-top: 2rem;
    box-shadow: 0 4px 6px rgba(26, 115, 232, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.modal-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(26, 115, 232, 0.4);
}

/* --- Chat Assistant --- */
.ai-assistant-wrapper {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1500;
}

.chat-fab {
    background: #FFFFFF;
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s;
}

.chat-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.chat-interface {
    position: absolute;
    bottom: 5.5rem;
    right: 0;
    width: 380px;
    background: #FFFFFF;
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    height: 550px;
    max-height: 80vh;
    border: 1px solid var(--border);
    overflow: hidden;
    transition: opacity 0.2s, transform 0.2s;
}

.chat-interface.hidden {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
}

.chat-header {
    background: var(--primary);
    color: white;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: #F8F9FA;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    padding: 1rem 1.25rem;
    border-radius: 18px;
    font-size: 0.95rem;
    max-width: 85%;
    line-height: 1.5;
}

.message.bot {
    background: #FFFFFF;
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message.user {
    background: var(--primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-input-area {
    padding: 1.25rem;
    background: #fff;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
}

.chat-input-area input {
    flex: 1;
    padding: 0.8rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: 24px;
    outline: none;
    background: #F8F9FA;
}

.chat-input-area input:focus {
    background: #fff;
    border-color: var(--primary);
}

.send-btn {
    background: var(--secondary);
    color: var(--primary);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
}

.main-footer {
    background: #FFFFFF;
    border-top: 1px solid var(--border);
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-sub);
    margin-top: 4rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .home-layout {
        grid-template-columns: 1fr;
    }

    .sidebar-categories {
        position: relative;
        top: 0;
        margin-bottom: 2rem;
    }

    .hero-content h1 {
        font-size: 2.2rem;
    }
}