/* CSS Variables for Theming */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #ec4899;
    --accent-color: #10b981;

    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --bg-card: #ffffff;

    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    --sidebar-width: 280px;
    --header-height: 70px;

    --transition-speed: 0.3s;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;

    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* App Container */
.app-container {
    display: grid;
    grid-template-areas:
        "header header"
        "sidebar main";
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    height: 100vh;
    overflow: hidden;
}

/* Header */
.header {
    grid-area: header;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    height: 100%;
    max-width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.logo i {
    font-size: 2rem;
}

.logo h1 {
    margin: 0;
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-container i {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
}

#searchInput {
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.95rem;
    width: 350px;
    transition: all var(--transition-speed);
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.theme-toggle {
    padding: 0.75rem;
    border: none;
    border-radius: 0.5rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.theme-toggle:hover {
    background-color: var(--bg-tertiary);
    transform: scale(1.05);
}

/* Sidebar Navigation */
.sidebar {
    grid-area: sidebar;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 1.5rem;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.nav-list {
    list-style: none;
}

.nav-list li {
    margin-bottom: 0.25rem;
}

.nav-list a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all var(--transition-speed);
    font-size: 0.95rem;
}

.nav-list a:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-list a.active {
    background-color: var(--primary-color);
    color: white;
}

.nav-list a i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    grid-area: main;
    overflow-y: auto;
    padding: 2rem;
    background-color: var(--bg-secondary);
}

.content-section {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-section h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.content-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Intro Card */
.intro-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.lead {
    font-size: 1.25rem;
    line-height: 1.8;
    margin: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--bg-card);
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-speed);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.stat-card h3 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    justify-content: center;
}

.stat-card p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Quick Start */
.quick-start {
    background-color: var(--bg-card);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
}

.quick-start h3 {
    margin-bottom: 1.5rem;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.guide-card {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.guide-card h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.guide-card ol {
    margin-left: 1.25rem;
}

.guide-card li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-speed);
    font-size: 0.9rem;
}

.filter-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Category Section */
.category-section {
    margin-bottom: 3rem;
}

/* Resource Grid */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.resource-card {
    background-color: var(--bg-card);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-speed);
    border: 1px solid var(--border-color);
}

.resource-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.resource-card h4 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.resource-card .badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.badge.desktop {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge.web {
    background-color: #dcfce7;
    color: #166534;
}

.badge.mobile {
    background-color: #fce7f3;
    color: #9f1239;
}

.badge.free {
    background-color: #d1fae5;
    color: #065f46;
}

.badge.paid {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge.freemium {
    background-color: #fef3c7;
    color: #92400e;
}

[data-theme="dark"] .badge.desktop {
    background-color: #1e3a8a;
    color: #93c5fd;
}

[data-theme="dark"] .badge.web {
    background-color: #14532d;
    color: #86efac;
}

[data-theme="dark"] .badge.mobile {
    background-color: #831843;
    color: #fbcfe8;
}

[data-theme="dark"] .badge.free {
    background-color: #064e3b;
    color: #6ee7b7;
}

[data-theme="dark"] .badge.paid {
    background-color: #7f1d1d;
    color: #fca5a5;
}

[data-theme="dark"] .badge.freemium {
    background-color: #78350f;
    color: #fde68a;
}

.resource-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

.resource-card ul {
    list-style: none;
    margin-bottom: 1rem;
}

.resource-card ul li {
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.resource-card ul li:before {
    content: "•";
    position: absolute;
    left: 0.5rem;
    color: var(--primary-color);
}

.resource-card a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.resource-card a:hover {
    text-decoration: underline;
}

/* Workflow Cards */
.workflow-card {
    background-color: var(--bg-card);
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-color);
}

.workflow-card h3 {
    margin-bottom: 1rem;
}

.workflow-card h4 {
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.workflow-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.7;
}

.workflow-card ul, .workflow-card ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.workflow-card li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Code Block */
.code-block {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 1rem 0;
    overflow-x: auto;
    font-family: 'Monaco', 'Courier New', monospace;
}

.code-block pre {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.code-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.copy-btn {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.35rem;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.copy-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Glossary */
.glossary-search {
    margin-bottom: 2rem;
}

.glossary-search input {
    width: 100%;
    max-width: 500px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
}

.glossary-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.glossary-grid {
    display: grid;
    gap: 1rem;
}

.glossary-item {
    background-color: var(--bg-card);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    border-left: 3px solid var(--primary-color);
}

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

.glossary-definition {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Cheat Sheet */
.cheatsheet-card {
    background-color: var(--bg-card);
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.cheatsheet-card h3 {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
}

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

.cheatsheet-item {
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.cheatsheet-item strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.5rem;
}

.cheatsheet-item code {
    background-color: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.85rem;
    color: var(--secondary-color);
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background-color: var(--bg-card);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

thead {
    background-color: var(--primary-color);
    color: white;
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background-color: var(--bg-secondary);
}

/* Alert Boxes */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
    border-left: 4px solid;
}

.alert-info {
    background-color: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

.alert-success {
    background-color: #dcfce7;
    border-color: #22c55e;
    color: #166534;
}

.alert-warning {
    background-color: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.alert-tip {
    background-color: #fae8ff;
    border-color: #d946ef;
    color: #86198f;
}

[data-theme="dark"] .alert-info {
    background-color: #1e3a8a;
    color: #93c5fd;
}

[data-theme="dark"] .alert-success {
    background-color: #14532d;
    color: #86efac;
}

[data-theme="dark"] .alert-warning {
    background-color: #78350f;
    color: #fde68a;
}

[data-theme="dark"] .alert-tip {
    background-color: #581c87;
    color: #f0abfc;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .app-container {
        grid-template-areas:
            "header"
            "main";
        grid-template-columns: 1fr;
        grid-template-rows: var(--header-height) 1fr;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
        z-index: 99;
        transition: left var(--transition-speed);
        box-shadow: var(--shadow-xl);
    }

    .sidebar.open {
        left: 0;
    }

    #searchInput {
        width: 200px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .resource-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .header-content {
        padding: 0 1rem;
    }

    .logo h1 {
        font-size: 1.25rem;
    }

    #searchInput {
        width: 150px;
        font-size: 0.85rem;
    }

    .main-content {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .guide-grid {
        grid-template-columns: 1fr;
    }

    .cheatsheet-grid {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Print Styles */
@media print {
    .header,
    .sidebar,
    .theme-toggle,
    .filter-bar {
        display: none;
    }

    .app-container {
        display: block;
    }

    .content-section {
        display: block !important;
        page-break-after: always;
    }
}

/* AI Tools Specific Styles */
.ai-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.ai-tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    transition: all var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.tool-header h4 {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

.pricing-badge {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.tool-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

.tool-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.feature-tag {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.feature-tag:hover {
    background: var(--primary-light);
    color: white;
}

.tool-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    margin-top: auto;
    transition: all 0.2s ease;
}

.tool-link:hover {
    color: var(--primary-dark);
    gap: 12px;
}

.tool-link i {
    font-size: 0.85rem;
}

.section-intro {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.6;
    margin: 16px 0 24px 0;
    max-width: 800px;
}

/* Responsive AI Tools Grid */
@media (max-width: 768px) {
    .ai-tools-grid {
        grid-template-columns: 1fr;
    }

    .tool-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .pricing-badge {
        align-self: flex-start;
    }
}
