/* Dytik.com - Main Stylesheet v3.0
 * Modern UI Design with Enhanced Visual Appeal
 */

/* ===== CSS Variables ===== */
:root {
    /* Primary Colors - Modern Gradient Palette */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    
    /* Secondary Colors */
    --secondary: #06b6d4;
    --secondary-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    
    /* Accent Colors */
    --accent: #f472b6;
    --accent-gradient: linear-gradient(135deg, #f472b6 0%, #ec4899 100%);
    
    /* Success/Warning/Error */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    /* Text Colors */
    --text: #1e293b;
    --text-light: #64748b;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    
    /* Background Colors */
    --bg: #f8fafc;
    --bg-gradient: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 50%, #f0f9ff 100%);
    --bg-card: #ffffff;
    --bg-surface: #f1f5f9;
    
    /* Border Colors */
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    
    /* Shadows - Layered Elevation */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px 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);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Dark Theme */
[data-theme="dark"] {
    --text: #f1f5f9;
    --text-light: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #1e293b;
    
    --bg: #0f172a;
    --bg-gradient: linear-gradient(180deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    --bg-card: #1e293b;
    --bg-surface: #334155;
    
    --border: #334155;
    --border-light: #1e293b;
    
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.25);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    line-height: 1.6;
    color: var(--text);
    background: var(--bg-gradient);
    min-height: 100vh;
    transition: var(--transition);
    overflow-x: hidden;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); }

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

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

/* ===== Accessibility ===== */
.skip-link {
    position: absolute;
    top: -100px;
    left: var(--space-4);
    background: var(--primary-gradient);
    color: var(--text-inverse);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius);
    z-index: 10000;
    font-weight: 600;
    transition: var(--transition);
}

.skip-link:focus {
    top: var(--space-4);
    box-shadow: var(--shadow-lg);
}

/* ===== Container ===== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-5);
    width: 100%;
}

/* ===== Header Hero ===== */
header {
    background: var(--primary-gradient);
    color: var(--text-inverse);
    padding: var(--space-16) var(--space-5) var(--space-12);
    text-align: center;
    position: relative;
    overflow: hidden;
    margin-bottom: var(--space-12);
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* Animated background pattern */
header::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: 
        linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridMove 20s linear infinite;
    pointer-events: none;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(60px, 60px); }
}

header .container {
    position: relative;
    z-index: 1;
}

header h1 {
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 800;
    margin-bottom: var(--space-4);
    text-shadow: 0 2px 20px rgba(0,0,0,0.2);
    animation: fadeInUp 0.8s ease-out;
}

header .subtitle {
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    opacity: 0.95;
    margin-bottom: var(--space-8);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeInUp 0.8s ease-out 0.1s backwards;
}

header .stats {
    display: flex;
    justify-content: center;
    gap: var(--space-6);
    flex-wrap: wrap;
    margin-bottom: var(--space-8);
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

header .stat-item {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(20px);
    padding: var(--space-4) var(--space-8);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255,255,255,0.2);
    transition: var(--transition-spring);
}

header .stat-item:hover {
    transform: translateY(-4px) scale(1.02);
    background: rgba(255,255,255,0.2);
    box-shadow: var(--shadow-glow);
}

header .stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    display: block;
    background: linear-gradient(180deg, #ffffff 0%, #e0e7ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header .stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

header .header-nav {
    display: flex;
    justify-content: center;
    gap: var(--space-8);
    margin-top: var(--space-8);
    animation: fadeInUp 0.8s ease-out 0.3s backwards;
}

header .header-nav a {
    color: var(--text-inverse);
    font-weight: 500;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    transition: var(--transition);
    position: relative;
}

header .header-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--text-inverse);
    transition: var(--transition);
    transform: translateX(-50%);
}

header .header-nav a:hover::after {
    width: 80%;
}

/* ===== Search Bar ===== */
.search-container {
    max-width: 640px;
    margin: -40px auto 40px;
    padding: 0 20px;
    position: relative;
    z-index: 10;
    animation: fadeInDown 0.6s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-box {
    background: var(--bg-card);
    border-radius: 9999px;
    padding: 12px 20px;
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    display: flex;
    align-items: center;
    gap: 12px;
    border: 2px solid var(--border);
    transition: var(--transition-spring);
    position: relative;
    overflow: hidden;
    min-height: 56px;
}

.search-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: var(--transition);
}

.search-box:focus-within {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: var(--shadow-xl), 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.search-box:focus-within::before {
    transform: scaleX(1);
}

.search-icon {
    font-size: 20px;
    color: var(--primary);
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-input-wrapper {
    flex: 1;
    min-width: 0;
}

.search-box input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 8px 0;
    color: var(--text);
    background: transparent;
    font-family: var(--font-sans);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box kbd {
    background: var(--bg-surface);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-family: var(--font-sans);
    flex-shrink: 0;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .search-box kbd {
        display: none;
    }
    
    .search-container {
        margin: -24px auto 24px;
    }
}

/* ===== Category Navigation ===== */
.category-nav {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: var(--space-10);
    padding: var(--space-4);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.category-btn {
    padding: var(--space-3) var(--space-5);
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-card);
    color: var(--text-light);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition-spring);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    position: relative;
    overflow: hidden;
}

.category-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-gradient);
    opacity: 0;
    transition: var(--transition);
    z-index: -1;
}

.category-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.category-btn.active {
    background: var(--primary-gradient);
    color: var(--text-inverse);
    border-color: transparent;
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.category-btn .count {
    background: rgba(0,0,0,0.08);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

[data-theme="dark"] .category-btn .count {
    background: rgba(255,255,255,0.15);
}

.category-btn.active .count {
    background: rgba(255,255,255,0.2);
    color: var(--text-inverse);
}

/* ===== Tools Grid ===== */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--space-6);
    margin-top: var(--space-8);
}

/* ===== Tool Card ===== */
.tool-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow);
    transition: var(--transition-spring);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: var(--transition);
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    border-color: var(--primary);
}

.tool-card:hover::before {
    transform: scaleX(1);
}

.tool-card h3 {
    color: var(--text);
    margin-bottom: var(--space-3);
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.tool-card p {
    color: var(--text-light);
    margin-bottom: var(--space-5);
    font-size: 0.925rem;
    line-height: 1.6;
    flex-grow: 1;
}

.tool-card a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    background: var(--primary-gradient);
    color: var(--text-inverse);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition-spring);
    position: relative;
    overflow: hidden;
}

.tool-card a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: var(--transition);
}

.tool-card a:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.tool-card a:hover::before {
    left: 100%;
}

/* Category-specific card styles */
.tool-card.tag-ai {
    --card-gradient: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.tool-card.tag-social {
    --card-gradient: linear-gradient(135deg, #3b82f6, #2563eb);
}

.tool-card.tag-dev {
    --card-gradient: linear-gradient(135deg, #10b981, #059669);
}

.tool-card.tag-productivity {
    --card-gradient: linear-gradient(135deg, #f59e0b, #d97706);
}

.tool-card.tag-image {
    --card-gradient: linear-gradient(135deg, #ec4899, #be185d);
}

.tool-card.tag-other {
    --card-gradient: linear-gradient(135deg, #64748b, #475569);
}

/* ===== Popular Tools Section ===== */
.popular-tools {
    margin-top: var(--space-16);
    padding: var(--space-10);
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.popular-tools h2 {
    text-align: center;
    margin-bottom: var(--space-8);
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Theme Toggle ===== */
.theme-toggle {
    position: fixed;
    top: var(--space-5);
    right: var(--space-5);
    background: var(--bg-card);
    border: 2px solid var(--border);
    color: var(--text);
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-spring);
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.theme-toggle:hover {
    transform: rotate(180deg) scale(1.1);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

/* ===== Chat Button ===== */
.chat-button {
    position: fixed;
    bottom: var(--space-8);
    right: var(--space-8);
    background: var(--primary-gradient);
    color: var(--text-inverse);
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    transition: var(--transition-spring);
    z-index: 1000;
    text-decoration: none;
    border: 3px solid var(--bg-card);
}

.chat-button:hover {
    transform: scale(1.15) translateY(-5px);
    box-shadow: var(--shadow-xl), 0 0 60px rgba(99, 102, 241, 0.5);
}

.chat-button::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    border: 3px solid var(--primary);
    animation: pulse-ring 2s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* ===== Footer ===== */
footer {
    text-align: center;
    padding: var(--space-16) var(--space-5) var(--space-10);
    color: var(--text-light);
    background: var(--bg-card);
    margin-top: var(--space-16);
    border-top: 1px solid var(--border);
}

footer .footer-links {
    display: flex;
    justify-content: center;
    gap: var(--space-8);
    flex-wrap: wrap;
    margin-bottom: var(--space-6);
}

footer a {
    color: var(--text-light);
    font-weight: 500;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    transition: var(--transition);
}

footer a:hover {
    color: var(--primary);
    background: var(--bg-surface);
    text-decoration: none;
}

footer .copyright {
    margin-top: var(--space-4);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
}

footer .footer-tagline {
    margin-top: var(--space-3);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== Toast Notification ===== */
.toast {
    position: fixed;
    bottom: calc(var(--space-8) + 80px);
    right: var(--space-8);
    background: var(--bg-card);
    color: var(--text);
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition-spring);
    z-index: 10000;
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 300px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--error);
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.6s ease-in;
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    :root {
        --space-16: 48px;
        --space-12: 32px;
        --space-10: 24px;
        --space-8: 20px;
    }
    
    header {
        padding: var(--space-12) var(--space-4) var(--space-8);
    }
    
    header h1 {
        font-size: 2.5rem;
    }
    
    header .stats {
        gap: var(--space-4);
    }
    
    header .stat-item {
        padding: var(--space-3) var(--space-5);
    }
    
    header .header-nav {
        gap: var(--space-4);
        flex-wrap: wrap;
    }
    
    .search-container {
        margin: -var(--space-8) auto var(--space-8);
    }
    
    .search-box kbd {
        display: none;
    }
    
    .category-nav {
        padding: var(--space-3);
    }
    
    .category-btn {
        padding: var(--space-2) var(--space-4);
        font-size: 0.85rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
        gap: var(--space-5);
    }
    
    .chat-button {
        width: 56px;
        height: 56px;
        bottom: var(--space-5);
        right: var(--space-5);
        font-size: 1.5rem;
    }
    
    .theme-toggle {
        width: 44px;
        height: 44px;
        top: var(--space-4);
        right: var(--space-4);
    }
    
    .toast {
        left: var(--space-4);
        right: var(--space-4);
        min-width: auto;
    }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* ===== Print Styles ===== */
@media print {
    .theme-toggle,
    .chat-button,
    .search-container,
    .category-nav {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .tool-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ===== Selection Colors ===== */
::selection {
    background: var(--primary);
    color: var(--text-inverse);
}

::-moz-selection {
    background: var(--primary);
    color: var(--text-inverse);
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: var(--radius-full);
}

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

/* ===== Focus Visible ===== */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
