/* --- 1. GLOBAL STYLES --- */
:root {
    --primary: #3b82f6; /* Bright Blue */
    --dark: #0f172a;    /* Navy Black */
    --light: #f8fafc;   /* Soft White */
    --gray: #64748b;    /* Text Gray */
    --border: #e2e8f0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    /* Wohi Pro Gradient Background */
    background-color: #f0f4f8;
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,0) 0, hsla(253,16%,7%,0) 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,0) 0, hsla(225,39%,30%,0) 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,0) 0, hsla(339,49%,30%,0) 50%);
    color: var(--dark);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- 2. NAVBAR (UPDATED FOR MENU BUTTON) --- */
.navbar {
    display: flex;
    justify-content: space-between; /* Logo Left, Button Right */
    align-items: center;
    padding: 15px 5%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    height: 70px; /* Fixed height taake hile nahi */
}

/* Logo Fix */
.logo {
    flex-shrink: 0; /* Logo squeeze nahi hoga */
}

.logo a {
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo i { color: var(--primary); }

/* Note: Nav links ab menu button replace kar raha hai, but code rakhne mein harj nahi */
.nav-links { list-style: none; display: flex; gap: 30px; }
.nav-links li a {
    text-decoration: none;
    color: var(--gray);
    font-weight: 500;
    transition: color 0.2s;
}
.nav-links li a:hover { color: var(--primary); }

/* --- 3. HERO SECTION & TOOL BOX --- */
.hero {
    padding: 60px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    text-align: center;
}

/* ✅ FIX FOR PAGES: Tool Pages ab Box mein dikhenge */
.converter-card {
    background: white;
    width: 100%;
    max-width: 700px;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    margin: 0 auto;
}

/* Main Page Titles */
.main-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 15px;
    background: -webkit-linear-gradient(45deg, #0f172a, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sub-title {
    font-size: 1.1rem;
    color: var(--gray);
    margin-bottom: 30px;
}

/* --- 4. GRID SYSTEM (FIXED) --- */
.tools-grid {
    padding: 20px 5% 80px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.grid-container {
    display: grid;
    /* ✅ FIXED: PC par 4 Columns pakke */
    grid-template-columns: repeat(4, 1fr); 
    gap: 25px;
    width: 100%;
}

/* Card Styling */
.tool-card {
    background: white;
    padding: 30px 20px;
    border-radius: 16px;
    text-align: center;
    text-decoration: none;
    color: var(--dark);
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

.tool-card i {
    font-size: 2.5rem;
    margin-bottom: 15px;
}
.tool-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 5px; }
.tool-card p { font-size: 0.85rem; color: var(--gray); }

/* --- 5. UPLOAD BOX & CONTROLS --- */
.upload-box {
    border: 2px dashed var(--primary);
    border-radius: 15px;
    padding: 40px 20px;
    background: #eff6ff;
    position: relative;
    cursor: pointer;
    transition: 0.3s;
    margin-bottom: 20px;
}
.upload-box:hover { background: #dbeafe; }
.icon-area { font-size: 40px; color: var(--primary); margin-bottom: 10px; }
.upload-box p { font-size: 1rem; color: #475569; font-weight: 500; }
.browse-text { color: var(--primary); text-decoration: underline; }

input[type="file"] { display: none; }
.upload-box label { position: absolute; top: 0; left: 0; width: 100%; height: 100%; cursor: pointer; }

#convertBtn, button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 15px;
    width: 100%;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 15px;
}
button:hover { background: #2563eb; }

#downloadLink {
    display: block;
    background: #10b981;
    color: white;
    text-decoration: none;
    padding: 15px;
    border-radius: 10px;
    font-weight: 600;
    margin-top: 15px;
    text-align: center;
}

/* --- 4. SEARCH BAR (Responsive & Pro) --- */
.search-container {
    position: relative;
    max-width: 700px; /* PC par itna rahega */
    margin: 10px auto 40px;
    width: 90%; /* Default width */
}

#toolSearch {
    width: 100%;
    padding: 18px 25px 18px 60px; /* PC Padding */
    border-radius: 50px;
    border: 2px solid #e2e8f0;
    font-size: 1.1rem;
    background: white;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

#toolSearch:focus {
    border-color: var(--primary);
    box-shadow: 0 15px 30px -10px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.search-icon {
    position: absolute;
    left: 25px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 1.4rem;
    pointer-events: none;
}

/* 📱 MOBILE SPECIFIC FIX (Ye zaroori hai) */
@media (max-width: 768px) {
    .search-container {
        width: 100%; /* Mobile par Pura Phela do */
        padding: 0 15px; /* Side se thoda gap */
        margin-bottom: 30px;
    }

    #toolSearch {
        padding: 15px 20px 15px 50px; /* Mobile ke liye padding adjust ki */
        font-size: 1rem; /* Font thoda normal kiya taake fit aaye */
        height: 55px; /* Touch friendly height fix kar di */
    }

    .search-icon {
        left: 30px; /* Icon ko adjust kiya padding ke hisaab se */
        font-size: 1.2rem;
    }
}
/* Helpers */
.hidden-area { display: none; margin-top: 25px; }
.preview-box { background: #f8fafc; padding: 15px; border-radius: 10px; border: 1px solid var(--border); margin-bottom: 15px; }
img, video { max-width: 100%; border-radius: 8px; }

/* SEO Content Area */
.seo-content {
    background: white;
    margin-top: 40px;
    border-top: 1px solid var(--border);
}
.seo-content h2, .seo-content h3 { color: var(--dark); margin-top: 25px; }
.seo-content p, .seo-content li { color: #475569; line-height: 1.7; margin-bottom: 10px; }

/* --- 6. FOOTER --- */
footer {
    background: var(--dark);
    color: white;
    padding: 40px 20px;
    text-align: center;
    margin-top: auto;
}
.footer-content p { color: #94a3b8; margin-bottom: 15px; }
.links a { color: #cbd5e1; text-decoration: none; margin: 0 15px; font-size: 0.9rem; }
.links a:hover { color: white; }

/* --- 7. RESPONSIVE MEDIA QUERIES --- */

/* Tablet (2 Columns) */
@media (max-width: 1024px) {
    .grid-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Small Tablet (2 Columns) */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    .main-title { font-size: 2rem; }
    .tool-card { min-height: 160px; padding: 20px; }
    .tool-card i { font-size: 2rem; }
}

/* Mobile (1 Column) */
@media (max-width: 480px) {
    .grid-container {
        grid-template-columns: 1fr;
    }
    .converter-card { padding: 25px; }
}

/* --- UPDATED MENU BUTTON (Top Right & Compact) --- */
.menu-btn {
    background-color: var(--primary, #3b82f6); /* Blue Filled Background */
    color: white;
    border: none;
    padding: 8px 16px; /* Chota aur Compact Padding */
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    
    /* Flex for Icon + Text */
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.menu-btn:hover {
    background-color: #1d4ed8; /* Darker Blue on Hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Mobile Specifc for Menu Button (Hide Text) */
@media (max-width: 480px) {
    .menu-btn span {
        display: none;
    }
    .menu-btn {
        padding: 8px 12px;
    }
}

/* --- FULL SCREEN OVERLAY --- */
.tools-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(15, 23, 42, 0.98); /* Dark Blue Theme */
    z-index: 9999; /* Sabse upar */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 40px 20px;
    
    /* Animation: Slide Down */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: all 0.3s ease-in-out;
}

/* Jab Menu Open Hoga */
.tools-overlay.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Close Button (X) */
.close-menu {
    position: absolute;
    top: 20px;
    right: 30px;
    background: none;
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
}

/* --- TOOL LINKS GRID (50 Tools List) --- */
.menu-content {
    width: 100%;
    max-width: 1000px;
    text-align: center;
    overflow-y: auto; /* Agar list lambi ho to scroll kare */
    max-height: 90vh;
}

.menu-content h2 {
    color: white;
    margin-bottom: 30px;
    font-size: 2rem;
}

.tools-grid-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); /* Auto Responsive */
    gap: 15px;
    text-align: left;
}

.tool-link-item {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.95rem;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tool-link-item:hover {
    background: var(--primary, #2563eb);
    transform: translateX(5px); /* Thoda right move karega */
}

/* Mobile Adjustment for Grid */
@media (max-width: 600px) {
    .tools-grid-list {
        grid-template-columns: 1fr 1fr; /* Mobile pe 2 column */
    }
}

/* =========================================
   ⚡ CRITICAL FIX FOR MENU BUTTON ⚡
   ========================================= */

.menu-btn {
    /* Global Button Style ko Override karne ke liye '!important' zaroori hai */
    width: auto !important;  /* Pori screen nahi lega, jitna text hai utna rahega */
    margin-top: 0 !important; /* Upar se chipkega nahi */
    padding: 8px 16px !important;
    
    background-color: var(--primary, #3b82f6);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    
    /* Flex alignment fix */
    display: inline-flex !important; 
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    height: 40px; /* Fixed height styling */
}

.menu-btn:hover {
    background-color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Navbar Flex Correction */
.navbar {
    display: flex !important;
    justify-content: space-between !important; /* Logo Left, Button Right */
    align-items: center !important;
    flex-direction: row !important; /* Row mein rahe, column na bane */
}

/* Mobile Specific Fix */
@media (max-width: 480px) {
    .menu-btn span {
        display: none; /* Text chupao */
    }
    .menu-btn {
        padding: 0 12px !important; /* Chota button */
        width: 40px !important; /* Square shape only icon */
        justify-content: center;
    }
}