/**
 * Multi-Tools - Main Stylesheet
 */

/* Global Styles */
:root {
    /* Fresh Modern Color Palette */
    --primary-color: #00b4d8; /* Vibrant cyan-blue */
    --primary-dark: #0077b6; /* Darker variant */
    --secondary-color: #ff6b6b; /* Warm coral */
    --secondary-dark: #ee5a52; /* Darker coral */
    --accent-color: #4ecdc4; /* Mint green */
    --accent-dark: #45b7aa; /* Darker mint */
    --purple-accent: #a8e6cf; /* Soft mint */
    --orange-accent: #ffd93d; /* Bright yellow */
    
    /* System colors with fresh twist */
    --success-color: #06d6a0; /* Modern green */
    --info-color: #118ab2; /* Ocean blue */
    --warning-color: #f77f00; /* Vibrant orange */
    --danger-color: #ef476f; /* Modern pink-red */
    --light-color: #f8fafc; /* Slightly cooler white */
    --dark-color: #1a202c; /* Warmer dark */

    /* Gradient definitions */
    --primary-gradient: linear-gradient(135deg, #00b4d8, #0077b6);
    --secondary-gradient: linear-gradient(135deg, #ff6b6b, #ee5a52);
    --accent-gradient: linear-gradient(135deg, #4ecdc4, #45b7aa);
    --warm-gradient: linear-gradient(135deg, #ffd93d, #f77f00);
    --cool-gradient: linear-gradient(135deg, #a8e6cf, #4ecdc4);

    /* Additional accessibility variables */
    --link-color: #00b4d8;
    --link-hover-color: #0077b6;
    --focus-outline-color: #00b4d8;
}

/* Ensure all images maintain their aspect ratio */
img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #2d3748; /* Modern dark gray */
    line-height: 1.6;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%); /* Subtle gradient background */
    min-height: 100vh;
}

a {
    text-decoration: none; /* Remove underline by default */
    transition: all 0.3s ease;
    color: var(--primary-color); /* Fresh cyan-blue */
    font-weight: 500; /* Slightly bolder text for links */
}

a:hover {
    text-decoration: none; /* Keep consistent with no underline */
    color: var(--primary-dark); /* Darker on hover */
    transform: translateY(-1px); /* Subtle lift effect */
}

a:focus {
    outline: 2px solid var(--primary-color); /* Visible focus indicator */
    outline-offset: 2px;
}

/* Header Styles */
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

/* Logo styling for consistent dimensions across the site */
.navbar-brand img, footer img, .modal-title img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.navbar-nav .nav-link {
    font-weight: 500;
    text-decoration: none;
}

.navbar-nav .dropdown-item {
    text-decoration: none;
}

.navbar-nav .nav-link.active {
    color: var(--primary-color) !important;
}

.dropdown-menu {
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.dropdown-item.active, .dropdown-item:active {
    background-color: var(--primary-color);
    color: white; /* Ensure text has good contrast with background */
}

/* Modern button styling */
.btn-primary {
    background: var(--primary-gradient);
    border: none;
    box-shadow: 0 4px 15px rgba(0, 180, 216, 0.3);
    transition: all 0.3s ease;
}

.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, #0077b6, #005577);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 180, 216, 0.4);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: transparent;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover, .btn-outline-primary:focus {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 180, 216, 0.3);
}

/* Add focus styles for all buttons for better accessibility */
.btn:focus {
    box-shadow: 0 0 0 0.25rem rgba(0, 180, 216, 0.5);
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Expanding Search Box */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    padding: 5px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Bouncy effect */
    overflow: hidden;
    width: 40px;
    height: 40px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.search-box.expanded,
.search-box:focus-within {
    width: 220px;
    border-radius: 50px;
    background-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    justify-content: space-between;
}

.search-input {
    background: transparent;
    border: none;
    outline: none;
    padding: 5px 10px;
    color: white; /* White text for dark backgrounds */
    font-size: 16px;
    width: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Match the box transition */
    opacity: 0;
    position: absolute;
    left: -9999px; /* Initially position off-screen */
}

.search-box.expanded .search-input {
    position: static; /* Return to normal flow when expanded */
    margin-left: 5px;
    background-color: rgba(0, 0, 0, 0.3); /* Darker background for better text contrast */
    border-radius: 4px;
}

.search-box.expanded .search-input,
.search-box:focus-within .search-input {
    width: 170px;
    opacity: 1;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.9); /* Higher contrast placeholder text */
}

.search-input:focus {
    outline: 2px solid white; /* Visible focus indicator */
    outline-offset: 2px;
}

.search-button {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2; /* Ensure the button stays clickable */
    margin-right: 0;
}

.search-box.expanded .search-button {
    margin-right: 5px;
}

.search-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Add a subtle pulse animation to the search icon */
@keyframes search-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.search-box:not(.expanded):not(:focus-within) .search-button i {
    animation: search-pulse 2s infinite ease-in-out;
}

/* Mobile Search Bar */
.mobile-search-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 10px 15px;
    background-color: #343a40;
    z-index: 1030;
    transition: all 0.3s ease;
    transform: translateY(-100%);
}

.mobile-search-bar.active {
    transform: translateY(0);
}

.mobile-search-toggle {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Push content down when mobile search is active */
body.search-active {
    padding-top: 56px;
}

/* Main Content Styles */
.tool-container {
    background-color: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.tool-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}

.tool-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.tool-description {
    color: #666;
    font-size: 1.1rem;
}

.how-to-use {
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.how-to-use h4 {
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Sidebar Styles */
.sidebar {
    position: sticky;
    top: 2rem;
}

.sidebar-ad {
    background-color: #f8f9fa;
    border: 1px dashed #ddd;
    border-radius: 0.5rem;
    padding: 2rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
}

/* Tool Page Right Sidebar */
.col-lg-4 .sidebar {
    position: sticky;
    top: 2rem;
    height: fit-content;
}

.col-lg-4 .card {
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Ensure all cards in the right sidebar have consistent styling */
.col-lg-4 .card-header {
    padding: 1rem;
}

.col-lg-4 .card-body {
    padding: 1.25rem;
}

/* Add a subtle hover effect to related tools links */
.col-lg-4 .list-group-item {
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.col-lg-4 .list-group-item:hover {
    background-color: rgba(13, 110, 253, 0.05);
    transform: translateX(3px);
    border-left-color: #0d6efd;
}

/* Tool Grid Styles */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.tool-card {
    background-color: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

.tool-card:hover, .tool-card.hover-effect {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Mobile-specific card styles */
@media (max-width: 767.98px) {
    .tool-card:hover {
        transform: translateY(-3px);
    }
}

.tool-card .card-body {
    padding: 1.5rem;
}

.tool-card .card-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.tool-card .card-text {
    color: #666;
    margin-bottom: 1.5rem;
}

.tool-card .tool-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.tool-card .badge {
    font-weight: 500;
}

/* Category Section Styles */
.category-section {
    margin-bottom: 3rem;
}

.category-section h2 {
    font-weight: 700;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
}

/* Footer Styles */
footer {
    background-color: var(--dark-color);
    color: #fff;
}

footer h5, footer h6 {
    font-weight: 600;
    margin-bottom: 1.25rem;
}

footer .text-muted {
    color: #c8cfd6 !important; /* Lighter gray for better contrast on dark background */
}

footer a.text-muted {
    color: #e9ecef !important; /* Even lighter for links to ensure good contrast */
    text-decoration: none; /* Remove underline for consistency */
    border-bottom: none; /* Remove border for cleaner look */
}

footer a.text-muted:hover {
    color: #fff !important;
    text-decoration: none;
    border-bottom: none; /* No border on hover for consistency */
}

footer a.text-muted:focus {
    outline: 2px solid #fff; /* Visible focus indicator */
    outline-offset: 2px;
}

footer .social-icons a {
    font-size: 1.25rem;
    margin-right: 1rem;
    text-decoration: none;
}

footer .list-inline-item:not(:last-child) {
    margin-right: 1.5rem;
}

footer .list-inline-item a {
    text-decoration: none;
}

/* Ad Banner Styles */
.ad-banner {
    background-color: #f8f9fa;
    border: 1px dashed #ddd;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: #666;
}

.ad-banner.horizontal {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Toast Notifications */
.toast-container {
    z-index: 1100;
}

.toast {
    min-width: 250px;
}

/* Responsive Adjustments */
@media (max-width: 767.98px) {
    .tool-header h1 {
        font-size: 1.5rem;
    }

    .tool-description {
        font-size: 1rem;
    }

    .sidebar {
        position: static;
        margin-top: 1.5rem;
    }

    /* Fix for tool page right sidebar on mobile */
    .col-lg-4 .sidebar {
        position: static;
        margin-top: 1.5rem;
    }

    .col-lg-4 .card {
        margin-bottom: 1.5rem;
    }

    .tool-grid {
        grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
        gap: 1rem;
    }

    /* Responsive search box */
    .search-box.expanded,
    .search-box:focus-within {
        width: 180px;
    }

    .search-box.expanded .search-input,
    .search-box:focus-within .search-input {
        width: 130px;
    }

    /* Improve button spacing on mobile */
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    /* Adjust card padding for mobile */
    .card-body {
        padding: 1rem;
    }

    /* Improve tool cards on mobile */
    .tool-card {
        margin-bottom: 1rem;
    }

    /* Adjust spacing for mobile */
    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    .mb-4 {
        margin-bottom: 1.5rem !important;
    }

    /* Improve form elements on mobile */
    input, select, textarea {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }

    /* Adjust category filter buttons */
    .d-flex.gap-2.flex-wrap {
        gap: 0.5rem !important;
    }

    /* Make tool icons smaller on mobile */
    .tool-card .tool-icon {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }
}

/* Additional mobile optimizations for smaller screens */
@media (max-width: 575.98px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    h1, .h1 {
        font-size: 1.75rem;
    }

    h2, .h2 {
        font-size: 1.5rem;
    }

    .display-4 {
        font-size: 1.75rem;
    }

    .lead {
        font-size: 1rem;
    }

    /* Adjust hero section for mobile */
    .bg-primary.text-white.py-5 {
        text-align: center;
    }

    /* Improve filter buttons on very small screens */
    .btn-outline-primary {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    /* Adjust count boxes for mobile */
    .count-box {
        padding: 0.75rem 0.5rem;
    }

    .count-number {
        font-size: 1.5rem;
    }

    /* Improve tool page layout */
    .tool-container {
        padding: 1rem;
    }

    /* Fix dropdown menus on mobile */
    .dropdown-menu {
        width: 100%;
        max-height: 70vh;
        overflow-y: auto;
    }
}

/* Accessibility Improvements */
a[target="_blank"]::after {
    content: " \f08e"; /* External link icon */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.8em;
    margin-left: 0.3em;
    display: inline-block;
}



/* Tool-specific Styles */

/* File Upload Area */
.upload-area {
    border: 2px dashed #ddd;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.upload-area:hover, .upload-area.highlight {
    border-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.05);
}

/* Result Box */
.result-box {
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-top: 1rem;
}

/* Loading Spinner */
.spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 0.5rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Geometric Tools Design for About Page */
.tools-design-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 300px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 1rem;
    position: relative;
    overflow: hidden;
}

.geometric-tools-design {
    position: relative;
    width: 250px;
    height: 200px;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.tool-shape {
    position: absolute;
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

.tool-circle {
    width: 60px;
    height: 60px;
    background: var(--primary-gradient);
    border-radius: 50%;
    top: 20px;
    left: 30px;
    animation-delay: 0s;
    box-shadow: 0 4px 15px rgba(0, 180, 216, 0.3);
}

.tool-square {
    width: 50px;
    height: 50px;
    background: var(--secondary-gradient);
    border-radius: 8px;
    top: 40px;
    right: 40px;
    animation-delay: 1s;
    transform: rotate(15deg);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.tool-triangle {
    width: 0;
    height: 0;
    border-left: 25px solid transparent;
    border-right: 25px solid transparent;
    border-bottom: 45px solid var(--accent-color);
    top: 120px;
    left: 50px;
    animation-delay: 2s;
    filter: drop-shadow(0 4px 15px rgba(78, 205, 196, 0.3));
}

.tool-hexagon {
    width: 40px;
    height: 40px;
    background: var(--warning-color);
    position: relative;
    top: 100px;
    right: 20px;
    animation-delay: 3s;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    box-shadow: 0 4px 15px rgba(247, 127, 0, 0.3);
}

.connecting-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.line {
    position: absolute;
    background: linear-gradient(90deg, var(--primary-color), transparent);
    height: 2px;
    animation: drawLine 3s ease-in-out infinite;
}

@keyframes drawLine {
    0%, 100% { width: 0; opacity: 0; }
    50% { width: 80px; opacity: 0.6; }
}

.line-1 {
    top: 50px;
    left: 80px;
    transform: rotate(25deg);
    animation-delay: 0.5s;
}

.line-2 {
    top: 90px;
    left: 120px;
    transform: rotate(-45deg);
    animation-delay: 1.5s;
}

.line-3 {
    top: 130px;
    left: 60px;
    transform: rotate(60deg);
    animation-delay: 2.5s;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tools-design-container {
        height: 200px;
    }
    
    .geometric-tools-design {
        width: 200px;
        height: 150px;
        transform: scale(0.8);
    }
}