/**
 * CSR Tools - Tools Grid Styles - Bootstrap Enhanced
 * Primary Colors: #c93939, #ea4445, #222222
 * Version 2.0.0
 * 
 * @package CSR_Tools
 */

/* ==========================================================================
   Grid Container
   ========================================================================== */
.csr-tools-grid-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 15px;
}

/* ==========================================================================
   Header Section - Hero Style
   ========================================================================== */
.grid-header {
    text-align: center;
    margin-bottom: 60px;
    padding: 40px 20px;
    background: linear-gradient(135deg, #c93939 0%, #ea4445 100%);
    border-radius: 16px;
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(201, 57, 57, 0.25);
}

.grid-header h1 {
    font-size: 48px;
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 20px 0;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.grid-subtitle {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* ==========================================================================
   Filter Tabs - Bootstrap Nav Pills Style
   ========================================================================== */
.grid-filters {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 50px;
    flex-wrap: wrap;
    padding: 0 15px;
}

.filter-btn {
    padding: 12px 28px;
    border: 2px solid #dee2e6;
    background: #ffffff;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.filter-btn:hover {
    border-color: #c93939;
    color: #c93939;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(201, 57, 57, 0.15);
}

.filter-btn.active {
    background: linear-gradient(135deg, #c93939 0%, #ea4445 100%);
    border-color: #c93939;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(201, 57, 57, 0.25);
}

.filter-btn .count {
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
}

.filter-btn.active .count {
    background: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   Tools Grid - Bootstrap Grid System
   ========================================================================== */
.csr-tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-bottom: 80px;
}

.csr-tools-grid[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.csr-tools-grid[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

/* ==========================================================================
   Tool Card - Bootstrap Card Enhanced
   ========================================================================== */
.tool-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 2px solid transparent;
}

.tool-card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    transform: translateY(-8px);
    border-color: #c93939;
}

.tool-card-inner {
    padding: 36px 28px;
    border-top: 4px solid #c93939;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.tool-card-inner h3 {
    color: #222222;
}

/* Category-specific top border colors */
.tool-card[data-category="csr"] .tool-card-inner {
    border-top-color: #2271b1;
}

.tool-card[data-category="ssl"] .tool-card-inner {
    border-top-color: #c93939;
}

.tool-card[data-category="converter"] .tool-card-inner {
    border-top-color: #8b5cf6;
}

/* Icon */
.tool-icon {
    font-size: 64px;
    margin-bottom: 24px;
    line-height: 1;
    transition: transform 0.3s ease;
    text-align: center;
}

.tool-card:hover .tool-icon {
    transform: scale(1.15) rotate(5deg);
}

/* Title */
.tool-title {
    font-size: 22px;
    font-weight: 700;
    color: #222222;
    margin: 0 0 14px 0;
    line-height: 1.3;
    text-align: center;
}

/* Description */
.tool-description {
    font-size: 15px;
    color: #6c757d;
    line-height: 1.6;
    margin: 0 0 24px 0;
    flex-grow: 1;
    text-align: center;
}

/* Button */
.tool-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #c93939 0%, #ea4445 100%);
    color: #ffffff;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
    margin-top: auto;
    box-shadow: 0 4px 8px rgba(201, 57, 57, 0.2);
}

.tool-button:hover {
    background: linear-gradient(135deg, #a82e2e 0%, #c93939 100%);
    color: #ffffff;
    transform: translateX(5px);
    box-shadow: 0 6px 16px rgba(201, 57, 57, 0.3);
}

.tool-button .arrow {
    transition: transform 0.3s ease;
    font-size: 18px;
}

.tool-button:hover .arrow {
    transform: translateX(5px);
}

/* Category-specific button colors */
.tool-card[data-category="csr"] .tool-button {
    background: linear-gradient(135deg, #2271b1 0%, #3582c4 100%);
}

.tool-card[data-category="csr"] .tool-button:hover {
    background: linear-gradient(135deg, #135e96 0%, #2271b1 100%);
}

.tool-card[data-category="converter"] .tool-button {
    background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
}

.tool-card[data-category="converter"] .tool-button:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
}

/* ==========================================================================
   Info Section - Bootstrap Row/Col Style
   ========================================================================== */
.grid-info-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-bottom: 80px;
    padding: 60px 0;
    border-top: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
}

.info-box {
    text-align: center;
    padding: 24px;
}

.info-icon {
    font-size: 56px;
    margin-bottom: 20px;
    display: block;
}

.info-box h3 {
    font-size: 20px;
    font-weight: 700;
    color: #222222;
    margin: 0 0 12px 0;
}

.info-box p {
    font-size: 15px;
    color: #6c757d;
    line-height: 1.6;
    margin: 0;
}

/* ==========================================================================
   Help Section - Call to Action
   ========================================================================== */
.grid-help-section {
    background: linear-gradient(135deg, #222222 0%, #333333 100%);
    color: #ffffff;
    padding: 60px 40px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.grid-help-section h2 {
    color: #ffffff;
    font-size: 32px;
    margin: 0 0 40px 0;
    font-weight: 700;
}

.help-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.help-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    color: #ffffff;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.help-link:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-4px);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.help-icon {
    font-size: 28px;
}

/* ==========================================================================
   Responsive Design - Bootstrap Breakpoints
   ========================================================================== */

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .csr-tools-grid-container {
        max-width: 1320px;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199px) {
    .csr-tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .csr-tools-grid[data-columns="4"] {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991px) {
    .csr-tools-grid-container {
        padding: 40px 20px;
    }
    
    .grid-header {
        padding: 30px 20px;
        margin-bottom: 40px;
    }
    
    .grid-header h1 {
        font-size: 36px;
    }
    
    .grid-subtitle {
        font-size: 17px;
    }
    
    .csr-tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
    
    .csr-tools-grid[data-columns="4"],
    .csr-tools-grid[data-columns="3"] {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tool-card-inner {
        padding: 28px 24px;
    }
    
    .tool-icon {
        font-size: 52px;
    }
    
    .tool-title {
        font-size: 20px;
    }
    
    .grid-info-section {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 40px 0;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767px) {
    .csr-tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .grid-header h1 {
        font-size: 32px;
    }
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575px) {
    .csr-tools-grid-container {
        padding: 30px 10px;
    }
    
    .grid-header {
        padding: 24px 16px;
        margin-bottom: 30px;
        border-radius: 12px;
    }
    
    .grid-header h1 {
        font-size: 28px;
    }
    
    .grid-subtitle {
        font-size: 15px;
    }
    
    .csr-tools-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .csr-tools-grid[data-columns="4"],
    .csr-tools-grid[data-columns="3"],
    .csr-tools-grid[data-columns="2"] {
        grid-template-columns: 1fr;
    }
    
    .tool-card-inner {
        padding: 24px 20px;
    }
    
    .tool-icon {
        font-size: 48px;
    }
    
    .tool-title {
        font-size: 19px;
    }
    
    .tool-description {
        font-size: 14px;
    }
    
    .tool-button {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    .grid-filters {
        gap: 8px;
        margin-bottom: 30px;
    }
    
    .filter-btn {
        padding: 10px 20px;
        font-size: 14px;
        flex: 1;
        min-width: 0;
        justify-content: center;
    }
    
    .filter-btn .count {
        display: none;
    }
    
    .grid-info-section {
        gap: 24px;
        padding: 30px 0;
        margin-bottom: 40px;
    }
    
    .help-links {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .help-link {
        justify-content: center;
        padding: 14px 24px;
        font-size: 15px;
    }
    
    .grid-help-section {
        padding: 40px 20px;
    }
    
    .grid-help-section h2 {
        font-size: 24px;
        margin-bottom: 30px;
    }
}

/* ==========================================================================
   Animations - Staggered Fade In
   ========================================================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tool-card {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

/* Stagger effect for cards */
.tool-card:nth-child(1) { animation-delay: 0.05s; }
.tool-card:nth-child(2) { animation-delay: 0.1s; }
.tool-card:nth-child(3) { animation-delay: 0.15s; }
.tool-card:nth-child(4) { animation-delay: 0.2s; }
.tool-card:nth-child(5) { animation-delay: 0.25s; }
.tool-card:nth-child(6) { animation-delay: 0.3s; }
.tool-card:nth-child(7) { animation-delay: 0.35s; }
.tool-card:nth-child(8) { animation-delay: 0.4s; }

/* Pulse animation for new badge */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* ==========================================================================
   Category Badges
   ========================================================================== */
.category-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-badge.new {
    background: linear-gradient(135deg, #ea4445 0%, #ff6b6b 100%);
    color: #ffffff;
    animation: pulse 2s infinite;
}

.category-badge.popular {
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
    color: #222222;
}

/* ==========================================================================
   Statistics Bar (optional feature)
   ========================================================================== */
.grid-stats-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 30px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 50px;
    border-top: 4px solid #c93939;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 36px;
    font-weight: 800;
    color: #c93939;
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 13px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ==========================================================================
   Hover Effects - Advanced
   ========================================================================== */

/* Gradient animation on hover */
.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(201, 57, 57, 0.05) 0%, rgba(234, 68, 69, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tool-card:hover::before {
    opacity: 1;
}

/* Icon background circle on hover */
.tool-icon-wrapper {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(201, 57, 57, 0.1) 0%, rgba(234, 68, 69, 0.1) 100%);
    transition: all 0.3s ease;
}

.tool-card:hover .tool-icon-wrapper {
    background: linear-gradient(135deg, rgba(201, 57, 57, 0.2) 0%, rgba(234, 68, 69, 0.2) 100%);
    transform: rotate(360deg);
}

/* ==========================================================================
   Dark Mode Support (Optional)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    .csr-tools-grid-container {
        background: #1a1a1a;
    }
    
    .grid-header {
        background: linear-gradient(135deg, #8b0000 0%, #a52a2a 100%);
    }
    
    .filter-btn {
        background: #2c2c2c;
        border-color: #3c3c3c;
        color: #e5e5e5;
    }
    
    .filter-btn:hover {
        border-color: #ea4445;
        color: #ea4445;
    }
    
    .tool-card {
        background: #2c2c2c;
        border-color: #3c3c3c;
    }
    
    .tool-title {
        color: #ffffff;
    }
    
    .tool-description {
        color: #b0b0b0;
    }
    
    .info-box h3 {
        color: #222222;
    }
    
    .info-box p {
        color: #b0b0b0;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    .grid-filters,
    .tool-button,
    .grid-help-section {
        display: none;
    }
    
    .csr-tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tool-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    .grid-header {
        background: none;
        color: #222222;
        box-shadow: none;
    }
    
    .grid-header h1 {
        color: #222222;
        text-shadow: none;
    }
}

/* ==========================================================================
   Accessibility Improvements
   ========================================================================== */

/* Focus visible for keyboard navigation */
.tool-card:focus-visible {
    outline: 3px solid #c93939;
    outline-offset: 4px;
}

.filter-btn:focus-visible,
.help-link:focus-visible {
    outline: 3px solid #c93939;
    outline-offset: 2px;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .tool-card {
        border: 2px solid #222222;
    }
    
    .tool-button {
        border: 2px solid #222222;
    }
}

/* ==========================================================================
   Loading States
   ========================================================================== */
.tool-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

.tool-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid rgba(201, 57, 57, 0.3);
    border-top-color: #c93939;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Special Effects - Glassmorphism (Optional)
   ========================================================================== */
.tool-card.glass-effect {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.p-3 {
    padding: 1rem;
}

.p-4 {
    padding: 1.5rem;
}

.d-none {
    display: none;
}

.d-block {
    display: block;
}

.d-flex {
    display: flex;
}