/* new-tools-widget.css - Version 2.9.2 - ACCESSIBILITY COMPLIANT */

/* Widget Container */
.new-tools-widget {
    width: 100%;
    max-width: 1550px;
    margin: 40px auto;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    border: 1px solid #ddd;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

/* Widget Header */
.new-tools-widget-header {
    text-align: center;
    margin-bottom: 25px;
}

.new-tools-widget-header h2 {
    font-size: 1.5rem;
    color: #333;
    margin: 0 0 10px 0;
    font-weight: normal;
}

.new-tools-widget-header p {
    color: #666;
    font-size: 1rem;
    margin: 0;
    line-height: 1.5;
}

/* Tools Container */
.new-tools-container {
    margin: 20px 0;
    width: 100%;
}

/* FIXED: Grid Layout */
.new-tools-scroll {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 100%;
    justify-items: center;
}

/* Force 3 columns on desktop */
@media screen and (min-width: 992px) {
    .new-tools-scroll {
        grid-template-columns: repeat(3, 1fr);
        justify-items: stretch;
    }
}

/* 🔥 NEW: Card wrapper to contain both card and labels - INTEGRATED DESIGN */
.new-tool-card-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    
    /* Create visual unity */
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
}

.new-tool-card-wrapper:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
    border-color: #007bff;
    transform: translateY(-2px);
}

/* 🔥 UPDATED: Tool Card - Now part of integrated design */
.new-tool-card {
    /* Make anchor behave like block element */
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    flex: 1;
    
    /* Visual styling - remove border and shadow (handled by wrapper) */
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 18px;
    transition: color 0.3s ease;
    cursor: pointer;
    gap: 14px;
    box-shadow: none;
    
    /* Ensure consistent link behavior */
    outline-offset: 2px;
}

.new-tool-card:hover {
    background: transparent;
    border: none;
    box-shadow: none;
    transform: none;
    text-decoration: none;
    color: inherit;
}

/* Hover states */
.new-tool-card:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
    border-color: #007bff;
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

/* 🔥 ACCESSIBILITY: Focus states for keyboard navigation */
.new-tool-card:focus-visible {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12), 0 0 0 4px rgba(0, 102, 204, 0.1);
    border-color: #0066cc;
    text-decoration: none;
    color: inherit;
}

/* Card Content Styling */
.new-tool-card .tool-card-title {
    font-size: 1.3rem;
    color: #333;
    margin: 0;
    font-weight: 600;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.new-tool-card:hover .tool-card-title {
    color: #007bff;
}

.new-tool-card .tool-card-subtitle {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.4;
}

/* Legacy support for existing h3 and p elements */
.new-tool-card h3 {
    font-size: 1.3rem;
    color: #333;
    margin: 0;
    font-weight: 600;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.new-tool-card:hover h3 {
    color: #007bff;
}

.new-tool-card p {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.4;
}

/* Screenshot */
.new-tool-screenshot {
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #f8f9fa;
}

.new-tool-screenshot img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Labels Container - INTEGRATED FOOTER DESIGN */
.new-tool-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 12px 18px 18px 18px;
    margin-top: 0;
    
    /* Visual integration */
    background: rgba(248, 249, 250, 0.8);
    border-top: 1px solid rgba(224, 224, 224, 0.5);
    backdrop-filter: blur(10px);
}

/* 🔥 UPDATED: Simple anchor-based labels */
.tool-category-label,
.tool-tag-label {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    cursor: pointer;
    min-height: 32px;
    outline-offset: 1px;
}

/* Category Label Styling */
.tool-category-label {
    background-color: #62706d !important;
    color: white !important;
}

.tool-category-label:hover,
.tool-category-label:focus-visible {
    background-color: #4e5c59 !important;
    transform: scale(1.05);
    outline: 2px solid #0066cc;
    outline-offset: 1px;
    color: white !important;
    text-decoration: none;
}

/* Tag Label Styling */
.tool-tag-label {
    background-color: #2b6cb0 !important;
    color: white !important;
}

.tool-tag-label:hover,
.tool-tag-label:focus-visible {
    background-color: #245a94 !important;
    transform: scale(1.05);
    outline: 2px solid #0066cc;
    outline-offset: 1px;
    color: white !important;
    text-decoration: none;
}

/* Legacy support for existing anchor-based labels - UPDATED FOR PROPER LAYOUT */
.new-tool-card .tool-category,
.new-tool-card .tool-tag {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    min-height: 32px;
    outline-offset: 1px;
    cursor: pointer;
}

/* Legacy Category Styling */
.new-tool-card .tool-category {
    background-color: #7a8481 !important;
    color: white !important;
}

.new-tool-card .tool-category:hover,
.new-tool-card .tool-category:focus-visible {
    background-color: #5a6b67 !important;
    transform: scale(1.05);
    text-decoration: none;
    color: white !important;
    outline: 2px solid #0066cc;
    outline-offset: 1px;
}

/* Legacy Tag Styling */
.new-tool-card .tool-tag {
    background-color: #4a90e2 !important;
    color: white !important;
}

.new-tool-card .tool-tag:hover,
.new-tool-card .tool-tag:focus-visible {
    background-color: #357abd !important;
    transform: scale(1.05);
    text-decoration: none;
    color: white !important;
    outline: 2px solid #0066cc;
    outline-offset: 1px;
}

/* View All Button */
.new-tools-widget-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.view-all-btn {
    display: inline-block;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 12px 25px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    
    /* Ensure minimum touch target size */
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.view-all-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #21618c 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
    color: white;
    text-decoration: none;
}

.view-all-btn:focus-visible {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3), 0 0 0 4px rgba(0, 102, 204, 0.1);
    color: white;
    text-decoration: none;
}

/* 🔥 ACCESSIBILITY: High Contrast Mode Support */
@media (prefers-contrast: high) {
    .new-tool-card {
        border-color: #000;
        background: #fff;
    }
    
    .new-tool-card:hover,
    .new-tool-card:focus-visible {
        border-color: #000;
        background: #f0f0f0;
    }
    
    .tool-category-label[role="button"],
    .new-tool-card .tool-category {
        background-color: #000 !important;
        color: #fff !important;
        border: 1px solid #000 !important;
    }
    
    .tool-tag-label[role="button"],
    .new-tool-card .tool-tag {
        background-color: #000 !important;
        color: #fff !important;
        border: 1px solid #000 !important;
    }
    
    .view-all-btn {
        background: #000 !important;
        color: #fff !important;
        border: 1px solid #000 !important;
    }
}

/* 🔥 ACCESSIBILITY: Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .new-tool-card,
    .tool-category-label[role="button"],
    .tool-tag-label[role="button"],
    .new-tool-card .tool-category,
    .new-tool-card .tool-tag,
    .view-all-btn {
        transition: none !important;
    }
    
    .new-tool-card:hover,
    .tool-category-label[role="button"]:hover,
    .tool-tag-label[role="button"]:hover,
    .new-tool-card .tool-category:hover,
    .new-tool-card .tool-tag:hover,
    .view-all-btn:hover {
        transform: none !important;
    }
}

/* Responsive Design */
@media screen and (max-width: 991px) {
    .new-tools-scroll {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        justify-items: center;
    }
}

@media screen and (max-width: 768px) {
    .new-tools-widget {
        margin: 20px auto;
        padding: 15px;
    }
    
    .new-tools-scroll {
        grid-template-columns: 1fr;
        gap: 15px;
        justify-items: center;
    }
    
    .new-tool-card {
        max-width: 100%;
    }
    
    .new-tools-widget-header h2 {
        font-size: 1.3rem;
    }
    
    .view-all-btn {
        padding: 12px 20px;
        font-size: 0.85rem;
        width: 100%;
        max-width: 300px;
    }
    
    /* Ensure touch targets are accessible on mobile */
    .tool-category-label[role="button"],
    .tool-tag-label[role="button"],
    .new-tool-card .tool-category,
    .new-tool-card .tool-tag {
        min-height: 44px;
        padding: 8px 14px;
    }
}

@media screen and (max-width: 480px) {
    .new-tool-card .tool-card-title,
    .new-tool-card h3 {
        font-size: 1.1rem;
    }
    
    .new-tool-card .tool-card-subtitle,
    .new-tool-card p {
        font-size: 0.85rem;
    }
    
    /* Smaller labels on very small screens */
    .tool-category-label[role="button"],
    .tool-tag-label[role="button"],
    .new-tool-card .tool-category,
    .new-tool-card .tool-tag {
        font-size: 0.7rem;
        padding: 6px 10px;
        min-height: 36px;
    }
}

/* 🔥 ACCESSIBILITY: Screen Reader Only Content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}