/* Web-Calculator.Net - Main Stylesheet */
/* Modern, Mobile-First, SEO-Friendly Design */

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.navbar .container {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--dark);
}

.navbar-brand .icon {
    font-size: 1.5rem;
}

.navbar-search {
    flex: 1;
    max-width: 400px;
    min-width: 260px;
    /* Prevent collapse */
}

.search-wrapper {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
    color: var(--secondary);
    transition: color 0.2s;
}

.search-btn:hover {
    color: var(--primary);
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    display: none;
    padding: 0.5rem 0;
    max-height: 400px;
    overflow-y: auto;
}

.search-item {
    display: block;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background: var(--light);
}

.search-title {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.95rem;
}

.search-cat {
    font-size: 0.8rem;
    color: var(--secondary);
}

.search-no-results {
    padding: 1rem;
    text-align: center;
    color: var(--secondary);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
}

.navbar-links {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.navbar-links a {
    color: var(--secondary);
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.navbar-links a:hover {
    background: var(--light);
    color: var(--primary);
}

/* ============================================
   HERO
   ============================================ */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 2rem;
}

.hero-search {
    max-width: 500px;
    margin: 0 auto;
}

.hero-search .search-input {
    padding: 1rem 1.5rem;
    font-size: 1rem;
    border: none;
    box-shadow: var(--shadow);
}

/* ============================================
   CATEGORIES & CALCULATORS GRID
   ============================================ */
.categories-section,
.featured-section,
.calculators-section {
    padding: 3rem 0;
}

.section-title {
    font-size: 1.75rem;
    text-align: center;
    margin-bottom: 2rem;
}

.categories-grid,
.calculators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--dark);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    height: 100%;
}

.category-card:hover,
.calculator-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
    border-color: var(--primary);
}

.category-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.calc-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: var(--light);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-inline: auto;
    /* Center horizontal */
}

.category-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.category-card p,
.calculator-card p {
    color: var(--secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.calculator-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    /* Increased padding */
    text-decoration: none;
    color: var(--dark);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    height: 100%;
}

.calculator-card h3,
.calculator-card h4 {
    color: var(--dark);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

/* ============================================
   CATEGORY PAGE
   ============================================ */
.category-page,
.calculator-page,
.legal-page {
    padding: 2rem 0;
    min-height: 70vh;
}

.category-header {
    text-align: center;
    margin-bottom: 3rem;
}

.category-icon-large {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.category-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.category-header p {
    color: var(--secondary);
    font-size: 1.1rem;
}

/* ============================================
   CALCULATOR PAGE
   ============================================ */
.breadcrumb {
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--secondary);
}

.breadcrumb a {
    color: var(--primary);
}

.calculator-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

.calculator-main {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    border: 1px solid var(--border);
}

.calculator-main h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.calculator-main>p {
    color: var(--secondary);
    margin-bottom: 1.5rem;
}

.calculator-form {
    background: var(--light);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    /* Fix for gray background on mobile */
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group input {
    flex: 1;
}

.input-group select {
    width: 80px;
    flex-shrink: 0;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-block {
    display: block;
    width: 100%;
}

.result-box {
    background: white;
    border: 2px solid var(--success);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    margin-top: 1.5rem;
}

.result-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--success);
}

.result-label {
    color: var(--secondary);
    font-size: 0.9rem;
}

.result-category {
    font-weight: 600;
    margin-top: 0.5rem;
}

/* Sidebar */
.calculator-sidebar {
    position: sticky;
    top: 80px;
}

.calculator-sidebar h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.related-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.related-list a {
    display: block;
    padding: 0.75rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--dark);
    font-size: 0.9rem;
}

.related-list a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ============================================
   SEO CONTENT
   ============================================ */
.seo-content {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    line-height: 1.8;
}

.seo-content h2 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
}

.seo-content h3 {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem;
}

.seo-content h4 {
    font-size: 1.1rem;
    margin: 1rem 0 0.5rem;
}

.seo-content p {
    margin-bottom: 1rem;
    color: #475569;
}

.seo-content ul,
.seo-content ol {
    margin: 1rem 0 1rem 1.5rem;
}

.seo-content li {
    margin-bottom: 0.5rem;
    color: #475569;
}

/* ============================================
   LEGAL PAGE
   ============================================ */
.legal-content {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.legal-content h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.last-updated {
    color: var(--secondary);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.legal-content h2 {
    font-size: 1.25rem;
    margin: 2rem 0 1rem;
    color: var(--dark);
}

.legal-content p {
    color: #475569;
    margin-bottom: 1rem;
}

.legal-content ul {
    margin: 1rem 0 1rem 1.5rem;
}

.legal-content li {
    margin-bottom: 0.5rem;
    color: #475569;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: var(--dark);
    color: white;
    padding: 3rem 0 1.5rem;
    margin-top: 3rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.footer-section p {
    color: #94a3b8;
    font-size: 0.9rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #94a3b8;
    font-size: 0.9rem;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid #334155;
    color: #64748b;
    font-size: 0.85rem;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 992px) {
    .calculator-container {
        grid-template-columns: 1fr;
    }

    .calculator-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1.5rem;
        /* Increased padding for better spacing */
    }

    .navbar .container {
        flex-wrap: wrap;
    }

    /* ... existing rules ... */

    .navbar-search {
        order: 3;
        flex: 100%;
        max-width: 100%;
        margin-top: 0.5rem;
    }

    .mobile-menu-btn {
        display: block;
        margin-left: auto;
    }

    .navbar-links {
        display: none;
        flex: 100%;
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem 0;
    }

    .navbar-links.active {
        display: flex;
    }

    .hero {
        padding: 2.5rem 0;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .categories-grid,
    .calculators-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .calculator-main {
        padding: 1rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

/* ============================================
   USER FEATURES (Favorites & History)
   ============================================ */
.star-btn {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 0.3rem 0.8rem;
    font-size: 0.9rem;
    color: #64748b;
    cursor: pointer;
    margin-left: 1rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    vertical-align: middle;
    font-weight: 500;
}

.star-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    text-decoration: none;
}

.star-btn.active {
    color: #b45309;
    background: #fffbeb;
    border-color: #fcd34d;
}

.star-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.star-text {
    font-size: 0.85rem;
}

/* User Sections on Homepage */
.user-section {
    padding: 2rem 0;
    display: none;
    /* Hidden by default, shown by JS */
    background: #f1f5f9;
    border-bottom: 1px solid var(--border);
}

.user-section .section-title {
    text-align: left;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-star {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: #fbbf24;
    font-size: 1rem;
}

/* Adjust grid for user sections if needed */
.calculator-card {
    position: relative;
}

/* Report Issue Button */
.report-issue-btn {
    display: inline-block;
    margin-top: 1.5rem;
    color: #f59e0b;
    /* Amber 500 */
    font-size: 0.9rem;
    text-decoration: none;
    border: 1px dashed #f59e0b;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
    background: #fffbeb;
}

.report-issue-btn:hover {
    background: #f59e0b;
    color: white;
    border-style: solid;
}

/* Report Modal Styles */
.report-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.report-modal {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    animation: modalSlideIn 0.3s ease;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.report-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.report-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--dark);
}

.report-header .close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
}

.report-body {
    padding: 1.5rem;
}

.report-body p {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: #64748b;
    font-size: 0.95rem;
}

.report-body textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

.report-body textarea:focus {
    border-color: var(--primary);
}

.report-footer {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.btn-cancel {
    background: white;
    border: 1px solid var(--border);
    color: #64748b;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
}

.btn-submit {
    background: var(--primary);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.report-status {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    min-height: 1.2em;
}