@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    min-height: 100vh;
}

.code-font {
    font-family: 'JetBrains Mono', monospace;
}

.tool-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.tool-card:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.2);
}

.tag {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
    transition: all 0.2s ease;
}

.tag:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.5);
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 5px 20px rgba(59, 130, 246, 0.4);
}

.copy-btn {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.code-block:hover .copy-btn {
    opacity: 1;
}

.pulse-animation {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .7; }
}

.modal {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

input:focus, textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-btn {
    transition: all 0.2s ease;
}

.filter-btn.active {
    background: rgba(59, 130, 246, 0.3);
    border-color: #3b82f6;
}

/* Markdown Content Styles */
.markdown-content {
    color: #e2e8f0;
    line-height: 1.8;
    font-size: 1rem;
}

.markdown-content h1 {
    font-size: 2.25em;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 1rem;
    color: #60a5fa;
    line-height: 1.3;
    letter-spacing: -0.025em;
}

.markdown-content h2 {
    font-size: 1.75em;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: #60a5fa;
    border-bottom: 2px solid rgba(59, 130, 246, 0.3);
    padding-bottom: 0.5rem;
    line-height: 1.3;
}

.markdown-content h3 {
    font-size: 1.375em;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: #60a5fa;
    line-height: 1.4;
}

.markdown-content h4 {
    font-size: 1.125em;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: #93c5fd;
    line-height: 1.4;
}

.markdown-content h5, .markdown-content h6 {
    font-size: 1em;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    color: #93c5fd;
}

.markdown-content p {
    margin-bottom: 1.25rem;
    line-height: 1.8;
    color: #cbd5e1;
}

.markdown-content ul, .markdown-content ol {
    margin-left: 1.75rem;
    margin-bottom: 1.25rem;
    padding-left: 0.5rem;
}

.markdown-content ul {
    list-style-type: disc;
}

.markdown-content ol {
    list-style-type: decimal;
}

.markdown-content li {
    margin-bottom: 0.625rem;
    line-height: 1.8;
    color: #cbd5e1;
    padding-left: 0.375rem;
}

.markdown-content li > p {
    margin-bottom: 0.5rem;
}

.markdown-content li::marker {
    color: #60a5fa;
    font-weight: 600;
}

/* Inline code */
.markdown-content code {
    background: rgba(15, 23, 42, 0.9);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875em;
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.2);
    font-weight: 500;
}

/* Code blocks */
.markdown-content pre {
    background: linear-gradient(135deg, #0f172a 0%, #1a1f35 100%);
    padding: 1.5rem;
    border-radius: 0.75rem;
    overflow-x: auto;
    margin: 1.75rem 0;
    border: 1px solid rgba(59, 130, 246, 0.4);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5), 
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

.markdown-content pre::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent,
        rgba(59, 130, 246, 0.5),
        rgba(34, 197, 94, 0.5),
        transparent
    );
}

.markdown-content pre code {
    background: transparent;
    padding: 0;
    color: #e2e8f0;
    border: none;
    font-size: 0.95em;
    line-height: 1.8;
    display: block;
    font-family: inherit;
    font-weight: 400;
    letter-spacing: 0.01em;
}

/* Syntax highlighting classes */
.markdown-content pre code .comment {
    color: #64748b;
    font-style: italic;
    opacity: 0.8;
}

.markdown-content pre code .command {
    color: #e2e8f0;
    font-weight: 600;
}

.markdown-content pre code .flag {
    color: #60a5fa;
    font-weight: 500;
}

.markdown-content pre code .string {
    color: #fbbf24;
}

.markdown-content pre code .value {
    color: #a78bfa;
    font-weight: 500;
}

.markdown-content pre code .keyword {
    color: #34d399;
    font-weight: 600;
}

.markdown-content pre code .operator {
    color: #fb923c;
}

.markdown-content pre code .prompt {
    color: #4ade80;
    font-weight: 700;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

/* Copy button for code blocks */
.markdown-content pre {
    cursor: pointer;
}

.markdown-content pre:hover::after {
    content: '📋 Copy';
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(30, 41, 59, 0.95);
    color: #60a5fa;
    padding: 0.5rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(59, 130, 246, 0.4);
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.markdown-content pre.copied::after {
    content: '✓ Copied!';
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.4);
}

/* Scrollbar for code blocks */
.markdown-content pre::-webkit-scrollbar {
    height: 8px;
}

.markdown-content pre::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 4px;
}

.markdown-content pre::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.5);
    border-radius: 4px;
}

.markdown-content pre::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.7);
}

/* Links */
.markdown-content a {
    color: #60a5fa;
    text-decoration: none;
    border-bottom: 1px solid rgba(96, 165, 250, 0.3);
    transition: all 0.2s ease;
}

.markdown-content a:hover {
    color: #93c5fd;
    border-bottom-color: #93c5fd;
}

/* Bold and italic */
.markdown-content strong {
    font-weight: 700;
    color: #93c5fd;
}

.markdown-content em {
    font-style: italic;
    color: #e2e8f0;
}

/* Blockquotes */
.markdown-content blockquote {
    border-left: 4px solid #60a5fa;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 0 0.5rem 0.5rem 0;
    color: #cbd5e1;
    font-style: italic;
}

.markdown-content blockquote p:last-child {
    margin-bottom: 0;
}

/* Horizontal rule */
.markdown-content hr {
    border: none;
    border-top: 2px solid rgba(59, 130, 246, 0.2);
    margin: 2.5rem 0;
}

/* Tables */
.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    overflow: hidden;
    border-radius: 0.5rem;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.markdown-content th {
    background: rgba(59, 130, 246, 0.15);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #60a5fa;
    border-bottom: 2px solid rgba(59, 130, 246, 0.3);
}

.markdown-content td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(59, 130, 246, 0.1);
    color: #cbd5e1;
}

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

.markdown-content tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

/* Images */
.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1.5rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Keyboard keys */
.markdown-content kbd {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.25rem;
    padding: 0.125rem 0.375rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875em;
    color: #e2e8f0;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

/* Definition lists */
.markdown-content dl {
    margin: 1.5rem 0;
}

.markdown-content dt {
    font-weight: 700;
    color: #93c5fd;
    margin-top: 1rem;
}

.markdown-content dd {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    color: #cbd5e1;
}

/* ============================================ */
/* RESPONSIVE DESIGN - MOBILE FIRST APPROACH */
/* ============================================ */

/* Mobile Devices (320px - 480px) */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Header adjustments */
    header h1 {
        font-size: 2rem !important;
    }
    
    header .text-5xl {
        font-size: 2.5rem;
    }
    
    header p {
        font-size: 0.875rem;
    }
    
    header .text-sm {
        font-size: 0.75rem;
    }
    
    /* Search and buttons */
    #searchInput {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }
    
    .btn-primary {
        padding: 0.625rem 0.875rem !important;
        font-size: 0.875rem;
    }
    
    .btn-primary span {
        font-size: 1rem;
    }
    
    /* Tag filters - make them wrap better */
    #tagFilters {
        gap: 0.375rem;
    }
    
    .filter-btn {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }
    
    /* Tool cards */
    .tool-card {
        padding: 1rem;
    }
    
    .tool-card h3 {
        font-size: 1.125rem;
    }
    
    .tool-card p {
        font-size: 0.875rem;
    }
    
    .tool-card code {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    
    .tool-card .tag {
        font-size: 0.625rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* Modals */
    .modal > div {
        margin: 1rem;
        padding: 1.5rem;
        max-height: 85vh;
    }
    
    .modal h2 {
        font-size: 1.25rem;
    }
    
    .modal input,
    .modal textarea,
    .modal select {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }
    
    .modal button {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Markdown content in modal */
    .markdown-content {
        font-size: 0.9rem;
    }
    
    .markdown-content h1 {
        font-size: 1.5rem;
        margin-top: 0;
        margin-bottom: 0.75rem;
    }
    
    .markdown-content h2 {
        font-size: 1.25rem;
        margin-top: 1.5rem;
        margin-bottom: 0.75rem;
    }
    
    .markdown-content h3 {
        font-size: 1.125rem;
        margin-top: 1.25rem;
        margin-bottom: 0.5rem;
    }
    
    .markdown-content p,
    .markdown-content li {
        font-size: 0.9rem;
        line-height: 1.7;
        margin-bottom: 1rem;
    }
    
    .markdown-content pre {
        padding: 0.875rem;
        margin: 1rem 0;
    }
    
    .markdown-content pre code {
        font-size: 0.8rem;
    }
    
    .markdown-content code {
        font-size: 0.85em;
        padding: 0.2rem 0.35rem;
    }
    
    .markdown-content ul, .markdown-content ol {
        margin-left: 1.25rem;
    }
    
    .markdown-content blockquote {
        padding: 0.75rem 1rem;
        margin: 1rem 0;
    }
    
    .markdown-content table {
        font-size: 0.8rem;
    }
    
    .markdown-content th,
    .markdown-content td {
        padding: 0.5rem;
    }
}

/* Small Tablets (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    body {
        font-size: 15px;
    }
    
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    header h1 {
        font-size: 2.5rem !important;
    }
    
    header .text-5xl {
        font-size: 3rem;
    }
    
    /* Search and filter area */
    #searchInput {
        padding: 0.75rem 1rem;
    }
    
    .btn-primary {
        padding: 0.75rem 1.25rem !important;
    }
    
    /* Tool grid - 1 column on small tablets */
    #toolsContainer {
        grid-template-columns: 1fr;
    }
    
    .tool-card {
        padding: 1.25rem;
    }
    
    /* Modal adjustments */
    .modal > div {
        margin: 1.5rem;
        padding: 2rem;
        max-width: 90vw;
    }
}

/* Tablets (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    header h1 {
        font-size: 3rem !important;
    }
    
    /* Tool grid - 2 columns on tablets */
    #toolsContainer {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
    
    .tool-card {
        padding: 1.5rem;
    }
    
    /* Modal adjustments */
    .modal > div {
        max-width: 85vw;
    }
}

/* Large Tablets and Small Laptops (1025px - 1280px) */
@media (min-width: 1025px) and (max-width: 1280px) {
    .container {
        max-width: 1200px;
    }
    
    #toolsContainer {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* Desktop and Large Screens (1281px+) */
@media (min-width: 1281px) {
    #toolsContainer {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* Extra Large Screens (1920px+) - Optional 3 column layout */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }
    
    #toolsContainer {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Landscape Mobile Devices */
@media (max-height: 500px) and (orientation: landscape) {
    header {
        margin-bottom: 1.5rem;
    }
    
    header h1 {
        font-size: 2rem !important;
    }
    
    header .text-5xl {
        font-size: 2rem;
    }
    
    .modal > div {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn-primary,
    .filter-btn,
    button {
        min-height: 44px;
        min-width: 44px;
    }
    
    .tool-card {
        padding: 1.25rem;
    }
    
    /* Remove hover effects on touch devices */
    .tool-card:hover {
        transform: none;
    }
    
    .copy-btn {
        opacity: 1;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    header,
    #searchInput,
    .btn-primary,
    #tagFilters,
    .modal {
        display: none;
    }
    
    .tool-card {
        break-inside: avoid;
        border: 1px solid #ccc;
        margin-bottom: 1rem;
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .tool-card:hover {
        transform: none;
    }
    
    .btn-primary:hover {
        transform: none;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .tool-card {
        border: 2px solid rgba(148, 163, 184, 0.5);
    }
    
    .btn-primary {
        border: 2px solid #3b82f6;
    }
}

/* Force Dark Mode Always - Override System Preferences */
@media (prefers-color-scheme: dark), (prefers-color-scheme: light), (prefers-color-scheme: no-preference) {
    body {
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
        color: #e2e8f0 !important;
    }
    
    .tool-card {
        background: rgba(30, 41, 59, 0.6) !important;
        border-color: rgba(148, 163, 184, 0.1) !important;
        color: #e2e8f0 !important;
    }
    
    .markdown-content {
        color: #e2e8f0 !important;
    }
    
    input, textarea, select {
        background: #0f172a !important;
        color: #e2e8f0 !important;
    }
}
