/*
|--------------------------------------------------------------------------
| WebSoftTools Global Stylesheet
|--------------------------------------------------------------------------
|
| This file contains all styles for the entire site, including:
| 1. CSS Variables (Colors, Fonts, Layout)
| 2. Reset and Base Styles
| 3. WordPress-style Narrow/Full-Width Layout
| 4. Header, Footer, and Navigation
| 5. Hero Section & Counters
| 6. Tool List & Forms
| 7. Search Modal
| 8. Dark Mode
| 9. Responsive Breakpoints
|
*/

/* 1. CSS Variables */
:root {
    /* Colors - Light Mode */
    --primary: #3e84f4;
    --primary-hover: #2d73e3;
    --secondary: #36b056;
    --secondary-hover: #2a9a48;
    --text: #222222;
    --text-light: #555555;
    --border: #e0e0e0;
    --bg: #ffffff;
    --bg-alt: #f9f9f9;
    --footer-bg: #1a202c;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    
    /* Layout */
    --content-width: 1100px;
    --radius: 8px;
    --transition: all 0.2s ease-in-out;

    /* Fonts (System Stack) */
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

/* 8. Dark Mode Variables */
[data-theme="dark"] {
    --primary: #4a90e2;
    --primary-hover: #5aa1f7;
    --secondary: #44c066;
    --secondary-hover: #36b056;
    --text: #f0f0f0;
    --text-light: #bbbbbb;
    --border: #444444;
    --bg: #1a1a1a;
    --bg-alt: #222222;
    --footer-bg: #111111;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.08);
}

/* 2. Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-stack);
    color: var(--text);
    background-color: var(--bg);
    line-height: 1.6;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* This is the main content wrapper that allows the footer to stick to the bottom */
.site-main {
    flex-grow: 1;
}

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    line-height: 1.3;
    font-weight: 700;
}
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

p {
    margin-bottom: 1.25rem;
    color: var(--text-light);
}

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

ul {
    list-style-position: inside;
    margin-bottom: 1.25rem;
}
li {
    margin-bottom: 0.5rem;
}

/* 3. WordPress-style Narrow/Full-Width Layout */
/*
| The <header> and <footer> are full-width by default.
| The .site-container class is used *inside* pages
| to constrain the main content to a narrow width.
*/
.site-container {
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 2.5rem 1.5rem; /* 40px top/bottom, 24px left/right */
}

/* Section titles (used on homepage, category pages) */
.section-title {
    color: var(--text);
    border-bottom: 3px solid var(--primary);
    padding-bottom: 0.5rem;
    display: inline-block;
    margin-bottom: 1rem;
}
.section-intro {
    font-size: 1.1rem;
    color: var(--text-light);
    max-width: 800px;
    margin-bottom: 2.5rem;
}
.category-title {
    color: var(--text);
    margin-top: 2.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

/* 4. Header, Footer, and Navigation */
header {
    background-color: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--content-width);
    margin: 0 auto;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.logo img {
    height: 40px;
    width: 40px;
}
.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}
.logo-text span {
    color: var(--secondary);
}
.nav-desktop {
    display: flex;
    gap: 1rem;
}
.nav-desktop a {
    color: var(--text-light);
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    text-decoration: none;
}
.nav-desktop a:hover {
    background-color: var(--bg-alt);
    color: var(--primary);
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.header-btn, .theme-toggle {
    background-color: var(--bg-alt);
    border: 1px solid var(--border);
    color: var(--text-light);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}
.theme-toggle {
    padding: 0.5rem;
    width: 38px;
    height: 38px;
    justify-content: center;
    font-size: 1.2rem;
    line-height: 1;
}
.header-btn:hover, .theme-toggle:hover {
    background-color: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
}
.search-icon {
    font-size: 1.2rem;
    transform: rotate(90deg);
}

/* Mobile Nav */
.mobile-menu-btn {
    display: none; /* Show on mobile */
    font-size: 1.5rem;
    padding: 0.5rem;
    width: 38px;
    height: 38px;
    justify-content: center;
}
.mobile-nav {
    display: none; /* Toggled by JS */
    flex-direction: column;
    background-color: var(--bg);
    border-bottom: 1px solid var(--border);
    position: absolute;
    top: 65px; /* Height of header */
    left: 0;
    right: 0;
    z-index: 999;
    padding: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
.mobile-nav a, .mobile-nav button {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}
.mobile-nav a:hover {
    background-color: var(--bg-alt);
    color: var(--primary);
}
.mobile-nav .header-btn, .mobile-nav .theme-toggle {
    width: 100%;
    margin-bottom: 0.5rem;
    justify-content: center;
}

/* Breadcrumbs */
.breadcrumbs {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: -1rem; /* Pulls content up */
}
.breadcrumbs a {
    color: var(--primary);
}
.breadcrumbs span {
    color: var(--text-light);
    margin: 0 0.25rem;
}

/* Footer */
footer {
    background-color: var(--footer-bg);
    color: #e2e8f0;
    padding: 3rem 1.5rem 1.5rem;
    width: 100%;
    margin-top: auto; /* Pushes to bottom */
}
.footer-container {
    max-width: var(--content-width);
    margin: 0 auto 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
}
.footer-col {
    font-size: 0.95rem;
}
.footer-col h3 {
    color: white;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}
.footer-col .logo-text {
    color: white;
}
.footer-col p {
    color: #cbd5e0;
    font-size: 0.9rem;
    line-height: 1.7;
}
.footer-col ul {
    list-style: none;
}
.footer-col li {
    margin-bottom: 0.75rem;
}
.footer-col a {
    color: #cbd5e0;
    text-decoration: none;
}
.footer-col a:hover {
    color: white;
    text-decoration: underline;
}
.footer-credits {
    text-align: center;
    border-top: 1px solid #3a4150;
    padding-top: 1.5rem;
    font-size: 0.9rem;
    color: #a0aec0;
}

/* 5. Hero Section & Counters */
.hero {
    padding: 5rem 1.5rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(62, 132, 244, 0.1), rgba(54, 176, 86, 0.1));
    background-size: 200% 200%;
    animation: gradient-animation 10s ease infinite;
    border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .hero {
    background: linear-gradient(135deg, rgba(62, 132, 244, 0.15), rgba(54, 176, 86, 0.15));
    background-size: 200% 200%;
    animation: gradient-animation 10s ease infinite;
}
@keyframes gradient-animation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.hero-content {
    max-width: 800px;
    margin: 0 auto;
}
.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 1rem;
}
.hero p {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2.5rem;
}
.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text);
    min-width: 120px;
}
.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}
.stat-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
}
.hero-cta {
    display: flex;
    justify-content: center;
    gap: 1rem;
}
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 700;
    text-decoration: none;
    font-size: 1rem;
    border: 2px solid transparent;
    transition: var(--transition);
}
.btn-primary {
    background-color: var(--primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.btn-secondary {
    background-color: var(--bg-alt);
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover {
    background-color: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

/* 6. Tool List & Forms */
.tool-list-section {
    padding-bottom: 2rem;
}
.tool-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}
.tool-list li {
    margin: 0;
}
.tool-list a {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    background-color: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    height: 100%;
    text-decoration: none;
    transition: var(--transition);
}
.tool-list a:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow);
    border-color: var(--primary);
}
.tool-list strong {
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}
.tool-list span {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Tool Page Specific Forms */
.tool-container {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-top: 1.5rem;
}
.tool-container textarea,
.tool-container input[type="text"],
.tool-container input[type="number"],
.tool-container select {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-stack);
    font-size: 1rem;
}
.tool-container textarea {
    min-height: 150px;
    resize: vertical;
}
.tool-container .btn {
    font-size: 1rem;
    cursor: pointer;
}
.tool-options {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

/* 7. Search Modal */
.search-modal {
    display: none; /* Toggled by JS */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    backdrop-filter: blur(5px);
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}
.search-modal-content {
    width: 90%;
    max-width: 600px;
    background-color: var(--bg);
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}
.search-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2rem;
    color: var(--text-light);
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}
.search-modal-close:hover {
    color: var(--primary);
}
.search-modal-input {
    width: 100%;
    padding: 1.25rem 1.5rem;
    border: none;
    border-bottom: 1px solid var(--border);
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text);
    background-color: transparent;
}
.search-modal-input:focus {
    outline: none;
    border-bottom-color: var(--primary);
}
.search-results {
    max-height: 60vh;
    overflow-y: auto;
}
.search-result-item {
    display: block;
    padding: 1rem 1.5rem;
    text-decoration: none;
    border-bottom: 1px solid var(--border);
}
.search-result-item:last-child {
    border-bottom: none;
}
.search-result-item:hover,
.search-result-item.selected {
    background-color: var(--bg-alt);
}
.search-result-item strong {
    color: var(--primary);
    display: block;
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
}
.search-result-item span {
    color: var(--text-light);
    font-size: 0.9rem;
}
.no-results {
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--text-light);
}

/* Tap to Top Button */
.tap-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    z-index: 500;
    transition: var(--transition);
    display: none; /* Toggled by JS */
}
.tap-to-top:hover {
    background-color: var(--primary-hover);
    transform: translateY(-3px);
}

/* 9. Responsive Breakpoints */
@media (max-width: 768px) {
    .nav-desktop {
        display: none;
    }
    .mobile-menu-btn {
        display: flex;
    }
    .header-actions .header-btn {
        display: none; /* Hide desktop search button */
    }
    .hero h1 {
        font-size: 2.2rem;
    }
    .hero-stats {
        gap: 1rem;
        flex-wrap: wrap;
    }
    .stat-item {
        min-width: 100px;
    }
    .stat-number {
        font-size: 2rem;
    }
    .tool-list {
        grid-template-columns: 1fr; /* Stack on mobile */
    }
    .footer-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .site-container {
        padding: 1.5rem 1rem;
    }
    .hero {
        padding: 3rem 1rem;
    }
    .hero h1 {
        font-size: 1.8rem;
    }
    .hero p {
        font-size: 1.1rem;
    }
    .hero-cta {
        flex-direction: column;
    }
    .logo-text {
        display: none; /* Hide text on very small screens */
    }
}