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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
    background-image:
        radial-gradient(ellipse 70% 50% at 15% 0%, rgba(99, 102, 241, 0.10), transparent 60%),
        radial-gradient(ellipse 60% 45% at 90% 10%, rgba(236, 72, 153, 0.08), transparent 60%),
        radial-gradient(ellipse 50% 40% at 50% 100%, rgba(6, 182, 212, 0.06), transparent 60%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header and Navigation */
header {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.navbar {
    padding: 1rem 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--primary-color);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* Hero */
.hero {
    text-align: center;
    padding: 3rem 1rem 2.5rem;
}

.hero-title {
    font-size: 2.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 45%, #ec4899 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0 0 0.875rem;
}

.hero-sub {
    font-size: 1.0625rem;
    color: var(--text-secondary);
    margin: 0;
    letter-spacing: 0.04em;
}

/* Footer */
footer {
    background-color: var(--surface);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    margin-top: auto;
}

footer p {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: background-color 0.2s;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--secondary-color);
}

.btn-secondary:hover {
    background-color: #475569;
}

/* Form Elements */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* Tool Grid */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.tool-card {
    position: relative;
    background-color: var(--surface);
    border-radius: 1rem;
    box-shadow: 0 4px 14px -4px rgba(15, 23, 42, 0.08);
    border: 1px solid var(--border-color);
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s, border-color 0.25s;
    overflow: hidden;
    isolation: isolate;
}

.tool-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--card-gradient, linear-gradient(135deg, #6366f1, #8b5cf6));
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: -1;
}

.tool-card::after {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--card-gradient, linear-gradient(135deg, #6366f1, #8b5cf6));
    opacity: 0.12;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.25s;
    z-index: 0;
}

.tool-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 30px -12px rgba(15, 23, 42, 0.18);
    border-color: transparent;
}

.tool-card:hover::after {
    transform: scale(1.4);
    opacity: 0.18;
}

.tool-card:nth-child(6n+1) { --card-gradient: linear-gradient(135deg, #6366f1, #8b5cf6); --card-accent: #6366f1; --card-accent-text: #6366f1; }
.tool-card:nth-child(6n+2) { --card-gradient: linear-gradient(135deg, #06b6d4, #3b82f6); --card-accent: #06b6d4; --card-accent-text: #0891b2; }
.tool-card:nth-child(6n+3) { --card-gradient: linear-gradient(135deg, #f59e0b, #ef4444); --card-accent: #f59e0b; --card-accent-text: #d97706; }
.tool-card:nth-child(6n+4) { --card-gradient: linear-gradient(135deg, #10b981, #06b6d4); --card-accent: #10b981; --card-accent-text: #059669; }
.tool-card:nth-child(6n+5) { --card-gradient: linear-gradient(135deg, #ec4899, #f43f5e); --card-accent: #ec4899; --card-accent-text: #db2777; }
.tool-card:nth-child(6n)   { --card-gradient: linear-gradient(135deg, #8b5cf6, #ec4899); --card-accent: #8b5cf6; --card-accent-text: #8b5cf6; }

.tool-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    position: relative;
    z-index: 1;
}

.tool-card-content {
    padding: 1.75rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    min-height: 140px;
}

.tool-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--card-gradient, linear-gradient(135deg, #6366f1, #8b5cf6));
    box-shadow: 0 6px 14px -4px var(--card-accent, rgba(99, 102, 241, 0.5));
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tool-card-icon svg {
    width: 24px;
    height: 24px;
    display: block;
}

.tool-card:hover .tool-card-icon {
    transform: scale(1.08) rotate(-4deg);
}

.tool-card-text {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.tool-card-content h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: 0.02em;
    line-height: 1.4;
}

.tool-card-text p {
    font-size: 0.875rem;
    color: var(--card-accent-text, #6366f1);
    font-weight: 500;
    line-height: 1.6;
    letter-spacing: 0.02em;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Tool Container */
.tool-container {
    background-color: var(--surface);
    border-radius: 0.5rem;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.tool-container h1 {
    font-size: 1.875rem;
    margin-bottom: 1rem;
}

.tool-container p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.tool-section {
    margin-bottom: 1.5rem;
}

.tool-section label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.tool-actions {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
}

/* Preset Buttons */
.preset-section {
    margin-top: 1rem;
}

.preset-section label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-preset {
    padding: 0.5rem 1rem;
    background-color: var(--background);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-preset:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-preset.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: 600;
}

/* Error Page */
.error-page {
    text-align: center;
    padding: 4rem 0;
}

.error-page h1 {
    font-size: 6rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.error-page h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.error-page p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }

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

    .tool-actions {
        flex-direction: column;
    }

    .tool-actions .btn {
        width: 100%;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
