/* 
   Viral Tools Theme 
   Modern, Mobile-First, Clean UI
*/

:root {
    --primary: #6c5ce7;
    --primary-dark: #5b4cc4;
    --secondary: #a29bfe;
    --accent: #fd79a8;
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --card-bg: rgba(255, 255, 255, 0.9);
    --text-main: #2d3436;
    --text-light: #636e72;
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    --radius: 20px;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
    padding-bottom: 50px;
}

/* Typography */
h1,
h2,
h3 {
    line-height: 1.2;
    margin-bottom: 0.5em;
    font-weight: 800;
}

h1 {
    font-size: 2.2rem;
}

h2 {
    font-size: 1.5rem;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Layout */
.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}


.header {
    text-align: center;
    margin-bottom: 40px;
    padding-top: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header img {
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.05));
    transition: transform 0.3s;
}

.header img:hover {
    transform: rotate(-5deg) scale(1.05);
    /* Playful hover */
}

.header h1 {
    font-size: 2.5rem;
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    letter-spacing: -1px;
}

.header p {
    color: var(--text-light);
    font-size: 1.2rem;
    font-weight: 500;
}

/* Section Title */
.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 40px 0 25px 0;
    font-size: 1.6rem;
    color: var(--text-main);
    font-weight: 800;
}

/* PREMIUM GRID SYSTEM */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

/* Base Card */
.card {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    /* Softer shadow */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy hover */
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(108, 92, 231, 0.15);
}

/* Image Banner Card (Most Attractive) */
.card-image {
    padding: 0;
    height: 320px;
    /* Taller */
}

/* Image Wrapper for SEO & Optimization (Replaces background-image div) */
.card-img-wrapper {
    width: 100%;
    height: 60%;
    position: relative;
    overflow: hidden;
}

.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.card:hover .card-img-wrapper img {
    transform: scale(1.1);
    /* Zoom effect on hover */
}

/* Gradient Overlay */
.card-img-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to top, rgba(255, 255, 255, 1), transparent);
    pointer-events: none;
}

.card-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Emoji "Glow" Card (For tools without images) */
.card-glow {
    text-align: center;
    justify-content: center;
    align-items: center;
}

.card-icon-large {
    font-size: 4rem;
    margin-bottom: 15px;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.15));
    /* 3D effect for emoji */
    transition: transform 0.3s;
}

.card-glow:hover .card-icon-large {
    transform: scale(1.2) rotate(5deg);
}

/* Typography Inside Cards */
.card-title {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-main);
    line-height: 1.3;
}

.card-desc {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 15px;
    line-height: 1.5;
}

.card-btn {
    margin-top: auto;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    position: relative;
    align-self: flex-start;
}

.card-image .card-btn {
    align-self: flex-start;
    /* Left align for image cards */
}

.card-glow .card-btn {
    background: #f0f3f7;
    padding: 10px 20px;
    border-radius: 50px;
    align-self: center;
}

/* Tags (New, Viral) */
.tag {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #ff7675;
    color: white;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 5px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    z-index: 2;
    box-shadow: 0 5px 10px rgba(255, 118, 117, 0.3);
}

.tag.blue {
    background: #0984e3;
    box-shadow: 0 5px 10px rgba(9, 132, 227, 0.3);
}

/* Buttons & Inputs (Shared from before) */
.action-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(45deg, var(--primary), var(--accent));
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(108, 92, 231, 0.3);
    transition: transform 0.2s;
}

.action-btn:active {
    transform: scale(0.98);
}

.tool-container {
    background: white;
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    text-align: center;
    margin-top: 20px;
}

.input-group {
    margin: 25px 0;
    text-align: left;
}

input,
select {
    width: 100%;
    padding: 15px;
    border: 2px solid #dfe6e9;
    border-radius: 12px;
    font-size: 1.1rem;
    background: #fdfdfd;
}

/* Tool Specific UI */
.result-box {
    display: none;
    /* Hidden by default */
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-top: 30px;
    border: 2px solid #e1e1e1;
    animation: fadeIn 0.5s ease;
}

.result-box.show {
    display: block;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 15px 0;
}

/* Loader Animation */
.loader-bar {
    width: 100%;
    height: 10px;
    background: #e1e1e1;
    border-radius: 10px;
    margin: 20px 0;
    overflow: hidden;
    position: relative;
}

.loader-progress {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 10px;
    transition: width 0.2s linear;
}

/* Tool Share Buttons */
/* Tool Share Buttons (Compact Grid) */
.share-section {
    margin-top: 25px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* 2 Columns */
    gap: 10px;
}

.share-btn {
    width: 100%;
    padding: 10px 5px;
    /* Smaller padding */
    border: none;
    border-radius: 8px;
    /* Slightly tighter radius */
    font-weight: 600;
    /* Less heavy */
    cursor: pointer;
    font-size: 0.9rem;
    /* Compact font */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: transform 0.2s, box-shadow 0.2s;
}

/* Make WhatsApp prominence? maybe full width? User said "too wide", so maybe not. */
/* Let's keep them all equal for now, or span WhatsApp 2 cols if desired. */
/* If user wants "short", equal grid is best. */

.share-btn:active {
    transform: scale(0.95);
}

/* Result Box Styling (Clear & Attractive) */
@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 15px rgba(108, 92, 231, 0.3);
        transform: scale(1);
        border-color: #6c5ce7;
    }

    50% {
        box-shadow: 0 0 30px rgba(108, 92, 231, 0.6);
        transform: scale(1.02);
        border-color: #a29bfe;
    }

    100% {
        box-shadow: 0 0 15px rgba(108, 92, 231, 0.3);
        transform: scale(1);
        border-color: #6c5ce7;
    }
}

.result-value {
    display: inline-block;
    padding: 30px 40px;

    /* Crystal Clear White Background */
    /* background: #ffffff; */

    /* High Contrast Text */
    color: #000000 !important;
    font-size: 2.2rem;
    /* Larger and clearer */
    font-weight: 800;
    line-height: 1.2;

    /* Premium Border & Rounding */
    border-radius: 20px;
    border: 4px solid #6c5ce7;
    margin: 20px 0;

    /* Clean Glow */
    animation: pulseGlow 2s infinite ease-in-out;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);

    /* Visibility Safety */
    position: relative;
    z-index: 10;
    overflow: visible;
}

.share-btn:active {
    transform: scale(0.98);
}

.share-btn.whatsapp {
    background: #25D366;
    color: white;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3);
}

.share-btn.facebook {
    background: #1877F2;
    color: white;
    box-shadow: 0 4px 10px rgba(24, 119, 242, 0.3);
}

.share-btn.twitter {
    background: #1DA1F2;
    color: white;
    box-shadow: 0 4px 10px rgba(29, 161, 242, 0.3);
}

.share-btn.telegram {
    background: #0088cc;
    color: white;
    box-shadow: 0 4px 10px rgba(0, 136, 204, 0.3);
}

.share-btn.instagram {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(225, 48, 108, 0.3);
}

.share-btn.snapchat {
    background: #FFFC00;
    color: black;
    box-shadow: 0 4px 10px rgba(230, 227, 0, 0.4);
    text-shadow: none;
    /* Black text usually doesn't need shadow */
}

.share-btn.copy {
    background: #636e72;
    color: white;
    box-shadow: 0 4px 10px rgba(99, 110, 114, 0.3);
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Blog Preview Mini Cards */
.mini-blog-card {
    display: flex;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s;
}

.mini-blog-card:hover {
    transform: translateY(-3px);
}

.mini-blog-img {
    width: 120px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.mini-blog-content {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mini-blog-title {
    font-weight: 700;
    margin-bottom: 5px;
    font-size: 1rem;
    line-height: 1.3;
}

.mini-blog-meta {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 600px) {
    .header h1 {
        font-size: 2rem;
    }

    .card-image {
        height: auto;
    }

    .card-img-bg {
        height: 180px;
    }
}

/* Floating Share Button (Mobile Retention) */
.fixed-share-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #25D366;
    color: white;
    padding: 12px 30px;
    border-radius: 50px;
    box-shadow: 0 10px 20px rgba(37, 211, 102, 0.4);
    font-weight: bold;
    z-index: 1000;
    display: none;
    /* Hidden by default, JS will show it */
    align-items: center;
    gap: 10px;
    cursor: pointer;
    animation: bounce 2s infinite;
    text-decoration: none;
    transition: opacity 0.5s ease;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    40% {
        transform: translateX(-50%) translateY(-10px);
    }

    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

/* 
   -----------------------------------
   MOBILE RESPONSIVENESS FIXES
   -----------------------------------
*/
@media (max-width: 600px) {

    /* 1. Fix Result Box Overflow */
    .result-value {
        padding: 20px 10px !important;
        font-size: 1.6rem !important;
        width: 100%;
        box-sizing: border-box;
        word-wrap: break-word;
        /* Prevent text overflow */
        white-space: normal;
    }

    /* 2. Fix "More Tools" Grid (Stacking) */
    .trending-tools-section>div {
        grid-template-columns: 1fr !important;
        /* Single column stack */
        gap: 12px;
    }

    /* 3. Ensure Ad Banner Safety */
    .ad-slot,
    .ad-banner {
        max-width: 100%;
        overflow: hidden;
        display: flex;
        justify-content: center;
    }

    .ad-slot iframe {
        max-width: 100%;
    }

    /* 4. Tighter Share Section */
    .share-section {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .share-btn {
        font-size: 0.85rem;
        padding: 10px 5px;
    }
}

/* Ensure images in trending cards don't shrink */
.trend-card span {
    font-size: 2rem;
    min-width: 50px;
    text-align: center;
}

/* Ad Container - Prevents Layout Shift */
#ad-container {
    min-height: 280px;
    /* Reserves space for 250px ad + margins */
    width: 100%;
    margin: 30px auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

/* Result Highlight Animation */
@keyframes highlightText {
    0% {
        transform: scale(1);
        color: var(--text-main);
    }

    50% {
        transform: scale(1.1);
        color: var(--primary);
    }

    100% {
        transform: scale(1);
        color: var(--text-main);
    }
}

.highlight-pulse {
    animation: highlightText 0.6s ease-in-out;
}

/* Trending Tools Animation */
@keyframes gentleBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}

.trend-card {
    transition: transform 0.2s;
    animation: gentleBounce 3s infinite ease-in-out;
}

.trend-card:nth-child(even) {
    animation-delay: 1.5s;
    /* Staggered animation */
}

.trend-card:hover {
    transform: translateY(-5px) scale(1.02) !important;
    animation: none;
    /* Stop bounce on hover */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1) !important;
}