/* --- VARIABLES --- */
:root {
    --primary: #4f46e5;
    --primary-soft: #eef2ff;
    --bg-body: #f8fafc;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-sub: #64748b;
    --border: #e2e8f0;
    --hover-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-body: #0f172a;
    --surface: #1e293b;
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --border: #334155;
    --primary-soft: #312e81;
    --hover-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* --- RESET & BASE --- */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; 
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.3s ease;
    padding-bottom: 2rem;
}

/* --- THEME TOGGLE (Responsive Position) --- */
.theme-switch {
    position: fixed;
    /* Default for Mobile: Bottom Right */
    bottom: 1.5rem;
    right: 1.5rem;
    top: auto; 
    
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.5rem;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    gap: 5px;
    z-index: 2000;
    box-shadow: var(--hover-shadow);
    transition: all 0.3s ease;
}

/* For PC / Tablets: Top Right */
@media (min-width: 768px) {
    .theme-switch {
        top: 1.5rem;
        bottom: auto;
        right: 1.5rem;
    }
}

.theme-switch span {
    width: 32px; 
    height: 32px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    border-radius: 50%;
    transition: 0.3s;
}

.active-theme { 
    background: var(--primary); 
    color: white; 
}

/* --- HEADER --- */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 4rem 1rem 5rem 1rem;
    text-align: center;
    position: relative;
}

header h1 {
    font-size: clamp(2rem, 8vw, 3rem);
    font-weight: 800;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p { 
    color: var(--text-sub); 
    font-size: 1.1rem; 
}

/* --- SEARCH --- */
.search-container {
    max-width: 650px;
    margin: -1.75rem auto 3rem auto;
    padding: 0 1.25rem;
    position: sticky;
    top: 1rem;
    z-index: 50;
}

.search-box {
    width: 100%;
    padding: 1.2rem 1.75rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--hover-shadow);
    font-size: 1rem;
    outline: none;
    background: var(--surface);
    color: var(--text-main);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-box:focus { 
    border-color: var(--primary); 
    transform: translateY(-2px); 
}

/* --- GRID & LAYOUT --- */
.container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 1.5rem; 
}

.category-section { 
    margin-bottom: 4rem; 
}

.category-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.category-title::after { 
    content: ""; 
    flex: 1; 
    height: 1px; 
    background: var(--border); 
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

/* --- TOOL CARD --- */
.tool-card {
    background: var(--surface);
    border-radius: 18px;
    padding: 1.5rem;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
    border-color: var(--primary);
}

.tool-icon {
    font-size: 1.5rem;
    background: var(--primary-soft);
    min-width: 56px; 
    height: 56px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    border-radius: 14px;
}

.tool-meta h3 { 
    font-size: 1.05rem; 
    font-weight: 700; 
    margin-bottom: 0.25rem; 
}

.tool-meta p { 
    font-size: 0.85rem; 
    color: var(--text-sub); 
    line-height: 1.4; 
}

/* --- APP VIEWER --- */
#tool-viewer {
    position: fixed;
    inset: 0;
    background: var(--bg-body);
    z-index: 1000;
    display: none;
    flex-direction: column;
    animation: slideUp 0.4s cubic-bezier(0, 0, 0.2, 1);
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.viewer-header {
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.back-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-body);
    color: var(--text-main);
    cursor: pointer; 
    font-weight: 700;
}

iframe { 
    width: 100%; 
    flex-grow: 1; 
    border: none; 
}

/* --- RESPONSIVE --- */
@media (max-width: 640px) {
    header { padding: 3rem 1rem 4rem 1rem; }
    .tools-grid { grid-template-columns: 1fr; }
}

/* --- NAVBAR STYLES --- */
.main-navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(var(--surface), 0.8); /* Fallback */
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    backdrop-filter: blur(10px); /* Glass effect */
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    background: var(--primary);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-sub);
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.3s;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
}

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-toggle span {
    width: 25px;
    height: 2px;
    background: var(--text-main);
    border-radius: 2px;
}

/* Update this in your main.css */
.mobile-menu {
    display: none;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem; /* Increased padding for better look */
    position: absolute;
    width: 100%;
    top: 100%;
    left: 0;
    
    /* Centering logic */
    text-align: center; 
    box-sizing: border-box;
}

.mobile-menu a {
    display: block;
    padding: 1rem 0; /* More vertical space */
    color: var(--text-main);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    font-size: 1.1rem;
    font-weight: 600;
}

/* Remove the border from the very last link */
.mobile-menu a:last-child {
    border-bottom: none;
}

/* --- FOOTER STYLES --- */
.main-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 4rem 0 1rem 0;
    margin-top: 4rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-brand {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.footer-desc {
    color: var(--text-sub);
    line-height: 1.6;
    max-width: 300px;
}

.footer-col h4 {
    color: var(--text-main);
    margin-bottom: 1.2rem;
    font-size: 1.1rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.8rem;
}

.footer-links a {
    text-decoration: none;
    color: var(--text-sub);
    transition: 0.3s;
}

.footer-links a:hover {
    color: var(--primary);
    padding-left: 5px;
}

.social-icons {
    display: flex;
    gap: 0.75rem;
}

.social-link {
    width: 42px;
    height: 42px;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center; 
    justify-content: center;
    border-radius: 12px; /* Matching your tool-card style */
    text-decoration: none;
    color: var(--text-main);
    font-size: 1.1rem; /* Size of the icon */
    transition: all 0.3s ease;
}

.social-link:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.4);
}

/* Optional: specifically for the X/Twitter icon size tweak */
.social-link .fa-x-twitter {
    font-size: 1rem;
}


.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem; /* Adds space between the grid and the line */
    border-top: 1px solid var(--border);
    color: var(--text-sub);
    font-size: 0.9rem;
    
    /* Force the line to take up the full width of the footer container */
    width: 100%; 
    grid-column: 1 / -1; /* If it is inside a grid, this makes it span all columns */
}
/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .mobile-toggle { display: flex; }
    .mobile-menu.active { display: block; }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-desc { margin: 0 auto; }
    .social-icons { justify-content: center; }
}
