:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.25);
    --gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --font-main: 'Poppins', sans-serif;
    --border-color: #e2e8f0;
    --input-bg: #f1f5f9;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Animated Background */
.bg-shape {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
}
.shape-1 {
    top: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: rgba(99, 102, 241, 0.15);
    animation: float 20s infinite alternate;
}
.shape-2 {
    bottom: -10%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: rgba(168, 85, 247, 0.15);
    animation: float 25s infinite alternate-reverse;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.8);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-weight: 700;
    font-size: 1.5rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links a {
    margin: 0 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--accent);
}

.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
}

.hamburger {
    display: none;
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 250px;
    height: 100%;
    background: var(--card-bg);
    z-index: 200;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    transition: right 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    display: none;
    backdrop-filter: blur(2px);
}

.mobile-menu-overlay.active {
    display: block;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

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

.mobile-link {
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 500;
    transition: color 0.2s;
}

.mobile-link:hover {
    color: var(--accent);
}

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

.hero-content h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.highlight {
    color: var(--accent);
}

.hero-content p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-bottom: 2.5rem;
}

.search-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

input[type="text"] {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    transition: 0.3s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Tools Grid */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    color: var(--text-primary);
}

.category-tags .tag {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: #e2e8f0;
    cursor: pointer;
    margin-left: 0.5rem;
    font-size: 0.9rem;
    transition: 0.3s;
    color: var(--text-secondary);
}

.category-tags .tag:hover, .category-tags .tag.active {
    background: var(--accent);
    color: white;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.tool-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    cursor: pointer;
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: block;
    text-decoration: none;
    color: var(--text-primary);
}

.tool-card:hover {
    transform: translateY(-10px);
    border-color: var(--accent);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.icon-box {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.color-1 { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.color-2 { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.color-3 { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.color-4 { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.color-5 { background: rgba(236, 72, 153, 0.1); color: #ec4899; }
.color-6 { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }

.tool-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.tool-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    position: relative;
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.15);
    transform: scale(0.7);
    transition: transform 0.3s;
    color: var(--text-primary);
}

.modal.show .modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.close-modal:hover {
    color: var(--accent);
}

/* Modal Internals */
.result-box {
    background: var(--input-bg);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: monospace;
    margin-bottom: 1.5rem;
    word-break: break-all;
    border: 1px solid var(--border-color);
}

.btn-primary {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
    margin-top: 1rem;
    transition: 0.2s;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.controls label {
    display: block;
    margin: 10px 0;
    color: var(--text-secondary);
}

.checkboxes {
    display: flex;
    gap: 15px;
    margin: 10px 0;
}

.btn-copy {
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 1.2rem;
}

textarea {
    width: 100%;
    height: 150px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-primary);
    margin-top: 1rem;
    resize: none;
    font-family: inherit;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.stats-row {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    font-weight: bold;
    color: var(--accent);
}

.qr-placeholder {
    margin-top: 1rem;
    text-align: center;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-placeholder img {
    border-radius: 8px;
    border: 5px solid white;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

/* Speed Test Styles */
.speed-meter {
    width: 100%;
    height: 20px;
    background: #e2e8f0;
    border-radius: 10px;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
}
.needle {
    width: 0%;
    height: 100%;
    background: var(--gradient);
    transition: width 0.2s;
}

footer {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
}

/* Responsive Design & Optimization */
@media (max-width: 1024px) {
    .container {
        padding: 2rem 3%;
    }
}

@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 2.5rem;
    }
    .hero-section {
        padding: 4rem 1rem;
    }
    .navbar {
        padding: 1rem;
    }
    .desktop-nav {
        display: none;
    }
    .hamburger {
        display: block;
    }
    .container {
        padding: 1.5rem;
    }
    .tools-grid {
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 2rem;
    }
    .hero-content p {
        font-size: 1rem;
    }
    .container {
        padding: 1rem;
    }
    .tool-card {
        padding: 1.5rem;
    }
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .category-tags {
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0.5rem;
    }
    .category-tags .tag {
        margin-left: 0;
        margin-right: 0.5rem;
    }
    .modal-content {
        padding: 1.5rem;
        width: 95%;
    }
}
