/* Base Styles */
:root {
    --primary-color: #3a86ff;
    --secondary-color: #ff006e;
    --text-color: #333;
    --background-color: #fff;
    --card-bg: #f9f9f9;
    --footer-bg: #2c3e50;
    --footer-text: #ecf0f1;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-color);
    background-color: var(--background-color);
    line-height: 1.6;
    transition: var(--transition);
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.2;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
}

h2 {
    font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    margin-top: 3rem;
    text-align: center;
}

p {
    margin-bottom: 1rem;
}

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

a:hover {
    color: var(--secondary-color);
}

/* Header Styles */
header {
    text-align: center;
    padding: 60px 0 20px;
    background: linear-gradient(135deg, rgba(58, 134, 255, 0.1) 0%, rgba(255, 0, 110, 0.1) 100%);
    position: relative;
    overflow: hidden;
}

.hero-title {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    margin-bottom: 10px;
    position: relative;
}

.hero-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-color);
    margin-bottom: 30px;
    opacity: 0.9;
    font-weight: 300;
}

.search-bar {
    display: flex;
    justify-content: center;
    margin: 30px 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.search-bar input {
    width: 100%;
    padding: 15px 20px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    outline: none;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.search-bar input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.2);
}

.search-bar button {
    padding: 0 25px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.search-bar button:hover {
    background-color: var(--secondary-color);
}

/* Ad Container */
.ad-container {
    margin: 20px auto;
    text-align: center;
}

.top-ad {
    max-width: 970px;
    margin: 30px auto;
}

/* Main Content Layout */
main {
    display: flex;
    margin: 40px auto;
    position: relative;
}

.sidebar-ad {
    width: 160px;
    position: sticky;
    top: 40px;
    height: fit-content;
    margin-right: 40px;
}

.content {
    flex: 1;
}

/* Category Cards */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.category-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 30px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.category-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.category-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--primary-color);
    animation: iconFloat 3s ease-in-out infinite;
    display: inline-block;
}

@keyframes iconFloat {
    0% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

.category-card h3 {
    margin-bottom: 15px;
    font-size: 1.4rem;
    color: var(--text-color);
}

.category-card p {
    color: #777;
    margin-bottom: 0;
    font-size: 0.9rem;
}

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

.tool-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.14);
}

.tool-card i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.tool-card h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.tool-card p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.tool-card a {
    display: inline-block;
    padding: 8px 20px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 25px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.tool-card a:hover {
    background-color: var(--secondary-color);
    color: white;
    transform: translateY(-2px);
}

/* Footer */
footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: 50px 0;
    margin-top: 60px;
}

.footer-content {
    text-align: center;
}

.footer-content h3 {
    font-size: 1.5rem;
    margin-bottom: 25px;
    position: relative;
    display: inline-block;
}

.footer-content h3::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background-color: var(--primary-color);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--footer-text);
    font-size: 1.2rem;
    transition: var(--transition);
}

.social-links a:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px);
}

footer p {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #ddd;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive Styles */
@media (max-width: 1024px) {
    main {
        flex-direction: column;
        align-items: center;
    }

    .sidebar-ad {
        width: 100%;
        max-width: 300px;
        margin-right: 0;
        margin-bottom: 30px;
        position: relative;
        top: 0;
    }

    .category-grid, .tool-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    header {
        padding: 40px 0 10px;
    }

    .search-bar {
        flex-direction: row;
        margin: 20px auto;
    }

    .search-bar input {
        padding: 12px 15px;
    }

    .category-grid, .tool-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }

    h2 {
        margin-top: 2rem;
    }
}

@media (max-width: 480px) {
    .search-bar input {
        font-size: 0.9rem;
        padding: 10px;
    }

    .search-bar button {
        padding: 0 15px;
    }

    .category-grid, .tool-grid {
        grid-template-columns: 1fr;
    }
}

/* Tool Page Styles */
.tool-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 30px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.tool-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.tool-header {
    text-align: center;
    margin-bottom: 30px;
}

.tool-description {
    max-width: 700px;
    margin: 0 auto 30px;
    text-align: center;
    color: #555;
    font-size: 1.1rem;
    line-height: 1.7;
}

.tool-content {
    margin-bottom: 30px;
    background-color: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.tool-inputs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

label {
    font-weight: 500;
    margin-bottom: 8px;
    color: #444;
}

input, select {
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    outline: none;
    transition: var(--transition);
    width: 100%;
}

input:focus, select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.2);
}

button {
    padding: 12px 25px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    width: fit-content;
    margin: 0 auto;
    display: block;
}

button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.result {
    margin-top: 25px;
    padding: 20px;
    background-color: #f0f9ff;
    border-radius: 10px;
    border-left: 5px solid var(--primary-color);
    display: none;
    text-align: center;
}

.result h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.result p {
    margin-bottom: 0;
    font-size: 1.1rem;
    line-height: 1.6;
}

.back-button {
    display: inline-block;
    margin: 30px auto 0;
    text-align: center;
    background-color: #f1f1f1;
    color: var(--text-color);
    padding: 10px 25px;
    border-radius: 30px;
    transition: var(--transition);
    font-weight: 500;
}

.back-button:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* Responsive tool inputs */
@media (min-width: 600px) {
    .tool-inputs {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .tool-container {
        padding: 20px;
        margin: 20px auto;
    }

    .tool-description, .tool-header h1 {
        padding: 0 10px;
    }
}
