/* Modern Tools Page Styles */
/* Note: common_modern.css is loaded in HTML before this file, providing CSS variables */

/* Main Container */
.tools-main {
    background: var(--bg-secondary);
    min-height: 100vh;
    padding: 4rem 0;
}

.tools-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Search and Filter Section */
.search-filter-section {
    margin-bottom: 3rem;
    animation: fadeInUp 0.5s ease-out;
}

.search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto 2rem;
}

.search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.1rem;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 1rem 3rem 1rem 3.5rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.clear-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.clear-btn:hover {
    color: var(--text-primary);
}

.filter-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 2rem;
}

.filter-btn {
    padding: 0.7rem 1.5rem;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-btn:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.search-results {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 1rem;
    min-height: 24px;
}

.search-results.active {
    color: var(--text-primary);
    font-weight: 500;
}

/* Category Section */
.category-section {
    margin-bottom: 5rem;
    animation: fadeInUp 0.6s ease-out;
    scroll-margin-top: 100px;
}

.category-section:last-child {
    margin-bottom: 2rem;
}

/* Category Header */
.category-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
    position: relative;
}

.category-icon-wrapper {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
    transition: transform 0.3s ease;
}

.category-icon-wrapper:hover {
    transform: scale(1.1) rotate(5deg);
}

.category-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.5px;
}

.category-underline {
    flex: 1;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color) 0%, transparent 100%);
    border-radius: 2px;
    margin-left: 1rem;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

/* Tool Card */
.tool-card {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    position: relative;
    outline: none;
}

[data-theme="dark"] .tool-card {
    background: #2d3548;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.tool-card:hover::before,
.tool-card:focus::before {
    transform: scaleX(1);
}

.tool-card:hover,
.tool-card:focus {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(26, 115, 232, 0.15), 0 10px 20px rgba(0, 0, 0, 0.08);
    border-color: rgba(26, 115, 232, 0.2);
}

[data-theme="dark"] .tool-card:hover,
[data-theme="dark"] .tool-card:focus {
    box-shadow: 0 20px 40px rgba(26, 115, 232, 0.4), 0 10px 20px rgba(0, 0, 0, 0.6);
    border-color: rgba(26, 115, 232, 0.6);
    background: #343d52;
}

.tool-card:active {
    transform: translateY(-4px);
}

.tool-card-inner {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
}

/* Tool Icon Container */
.tool-icon-container {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.08) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    overflow: hidden;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

[data-theme="dark"] .tool-icon-container {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.25) 0%, rgba(118, 75, 162, 0.2) 100%);
    border: 2px solid rgba(102, 126, 234, 0.4);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.2);
}

.tool-card:hover .tool-icon-container,
.tool-card:focus .tool-icon-container {
    transform: scale(1.05);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.12) 100%);
    border-color: rgba(102, 126, 234, 0.4);
}

[data-theme="dark"] .tool-card:hover .tool-icon-container,
[data-theme="dark"] .tool-card:focus .tool-icon-container {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.4) 0%, rgba(118, 75, 162, 0.3) 100%);
    border-color: rgba(102, 126, 234, 0.6);
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.4);
}

.tool-icon {
    width: 50px;
    height: 50px;
    object-fit: contain;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1;
}

.tool-card:hover .tool-icon,
.tool-card:focus .tool-icon {
    transform: scale(1.1);
}

.tool-icon-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.9), rgba(118, 75, 162, 0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 16px;
}

.tool-icon-overlay i {
    color: white;
    font-size: 1.8rem;
    transform: translateX(-10px);
    transition: transform 0.3s ease;
}

.tool-card:hover .tool-icon-overlay,
.tool-card:focus .tool-icon-overlay {
    opacity: 1;
}

.tool-card:hover .tool-icon-overlay i,
.tool-card:focus .tool-icon-overlay i {
    transform: translateX(0);
}

/* Tool Content */
.tool-content {
    text-align: center;
    flex: 1;
}

.tool-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.tool-card:hover .tool-name,
.tool-card:focus .tool-name {
    color: var(--primary-color);
}

.tool-description {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

/* Tool Footer */
.tool-footer {
    display: flex;
    justify-content: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.tool-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

.tool-cta i {
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

.tool-card:hover .tool-cta,
.tool-card:focus .tool-cta {
    gap: 0.75rem;
}

.tool-card:hover .tool-cta i,
.tool-card:focus .tool-cta i {
    transform: translateX(4px);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 900px) {
    .tools-main {
        padding: 3rem 0;
    }

    .tools-container {
        padding: 0 1.5rem;
    }

    .search-box {
        max-width: 100%;
    }

    .filter-buttons {
        gap: 0.5rem;
    }

    .filter-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .category-section {
        margin-bottom: 4rem;
    }

    .category-header {
        margin-bottom: 2rem;
    }

    .category-icon-wrapper {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .category-title {
        font-size: 1.5rem;
    }

    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 1.5rem;
    }

    .tool-card-inner {
        padding: 1.5rem;
    }

    .tool-icon-container {
        width: 70px;
        height: 70px;
    }

    .tool-icon {
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 600px) {
    .tools-main {
        padding: 2rem 0;
    }

    .tools-container {
        padding: 0 1rem;
    }

    .search-filter-section {
        margin-bottom: 2rem;
    }

    .search-box {
        margin-bottom: 1.5rem;
    }

    .search-input {
        padding: 0.9rem 2.5rem 0.9rem 3rem;
        font-size: 0.95rem;
    }

    .filter-buttons {
        gap: 0.5rem;
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }

    .filter-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .search-results {
        font-size: 0.9rem;
    }

    .category-section {
        margin-bottom: 3rem;
    }

    .category-header {
        flex-wrap: wrap;
        margin-bottom: 1.5rem;
    }

    .category-icon-wrapper {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .category-title {
        font-size: 1.3rem;
    }

    .category-underline {
        display: none;
    }

    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .tool-card {
        border-radius: 12px;
    }

    .tool-card-inner {
        padding: 1.25rem;
        gap: 1.25rem;
    }

    .tool-icon-container {
        width: 64px;
        height: 64px;
        border-radius: 12px;
    }

    .tool-icon {
        width: 40px;
        height: 40px;
    }

    .tool-name {
        font-size: 1.1rem;
    }

    .tool-description {
        font-size: 0.9rem;
    }
}

/* Print Styles */
@media print {
    .tools-main {
        background: white;
    }

    .tool-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--border-color);
    }

    .tool-card:hover {
        transform: none;
    }
}
