/* ==========================================================================
   Class Tools Page Styles
   Following downloads/wishlist design patterns for consistency
   ========================================================================== */

/* ==========================================================================
   Tools List Page Styles
   ========================================================================== */

/* Tools Page Layout */
.tools-page {
    min-height: 100vh;
    background: var(--bg-primary);
}

/* Disable problematic animations on tools page to prevent glitch */
.tools-page .tool-card {
    animation: none !important;
}

.tools-page .fade-in-up {
    animation: none !important;
}

/* Main Content Area */
.tools-main {
    padding: var(--space-12) 0;
}

.tools-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

/* Tools Header */
.tools-header {
    text-align: center;
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--gray-200);
}

.tools-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 var(--space-2) 0;
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

.tools-subtitle {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    margin: 0 auto;
    max-width: 600px;
}

/* RTL Support - Ensure centering works properly in RTL mode */
html[dir="rtl"] .tools-header,
html[dir="rtl"] .tools-title,
html[dir="rtl"] .tools-subtitle,
html[lang="ar"] .tools-header,
html[lang="ar"] .tools-title,
html[lang="ar"] .tools-subtitle,
html[lang="ku"] .tools-header,
html[lang="ku"] .tools-title,
html[lang="ku"] .tools-subtitle,
[dir="rtl"] .tools-header,
[dir="rtl"] .tools-title,
[dir="rtl"] .tools-subtitle,
[lang="ar"] .tools-header,
[lang="ar"] .tools-title,
[lang="ar"] .tools-subtitle,
[lang="ku"] .tools-header,
[lang="ku"] .tools-title,
[lang="ku"] .tools-subtitle {
    text-align: center !important;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

/* Tool Card */
.tool-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
    text-decoration: none;
    color: inherit;
}

.tool-image {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--gray-100);
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tool-image.placeholder {
    color: var(--text-muted);
    font-size: 3rem;
}

.tool-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tool-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-2) 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-card-desc {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0 0 var(--space-3) 0;
    line-height: 1.5;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-actions {
    margin-top: auto;
}

.tool-btn {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    transition: all 0.2s ease;
    width: 100%;
}

.tool-btn-primary {
    background: var(--bg-gradient);
    color: white;
}

.tool-btn-primary:hover {
    opacity: 0.9;
    color: white;
}

.tool-btn-secondary {
    background: var(--gray-100);
    color: var(--text-secondary);
}

.tool-btn-secondary:hover {
    background: var(--gray-200);
    color: var(--text-secondary);
}

/* Empty State */
.tools-empty {
    text-align: center;
    padding: var(--space-16) var(--space-4);
    color: var(--text-muted);
}

.tools-empty-icon {
    font-size: 4rem;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.tools-empty h3 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: var(--text-secondary);
}

.tools-empty p {
    font-size: var(--font-size-base);
    margin-bottom: var(--space-6);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-1);
    margin-top: var(--space-6);
}

.page-link {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--gray-200);
    background: var(--white);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.page-link:hover {
    background: var(--gray-100);
    border-color: var(--primary-color);
    color: var(--text-secondary);
}

.page-link:not([href]) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ==========================================================================
   Tool Detail Page Styles
   ========================================================================== */

/* Tool Detail Page Layout */
.tool-detail-page {
    min-height: 100vh;
    background: var(--bg-primary);
}

/* Main Content Area */
.tool-detail-main {
    padding: var(--space-12) 0;
}

.tool-detail-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

/* Tool Detail Header */
.tool-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--gray-200);
}

.tool-detail-title {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.tool-detail-actions {
    display: flex;
    gap: var(--space-2);
}

/* Tool Content Wrapper */
.tool-content-wrapper {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: var(--space-6);
    overflow: hidden;
}

.tool-content {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    border-radius: var(--radius-md);
    overflow: hidden;
}

#toolIframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--radius-md);
}

/* Tool Info */
.tool-info {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.tool-desc {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-4);
}

.tool-usage {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--gray-100);
}

.tool-usage h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-2) 0;
}

.tool-usage-content {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 1024px) {
    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: var(--space-4);
    }
    
    .tool-detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }
    
    .tool-detail-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .tools-container,
    .tool-detail-container {
        padding: 0 var(--space-3);
    }
    
    .tools-main,
    .tool-detail-main {
        padding: var(--space-8) 0;
    }
    
    .tools-header {
        margin-bottom: var(--space-6);
    }
    
    .tools-title {
        font-size: var(--font-size-2xl);
    }
    
    .tools-subtitle {
        font-size: var(--font-size-base);
    }
    
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4);
    }
    
    .tool-detail-title {
        font-size: var(--font-size-xl);
    }
    
    .tool-detail-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .tool-btn {
        width: 100%;
    }
    
    .tool-content {
        height: 60vh;
        min-height: 400px;
    }
    
    .tool-content-wrapper {
        padding: var(--space-3);
    }
    
    .tool-info {
        padding: var(--space-3);
    }
}

@media (max-width: 480px) {
    .tools-container,
    .tool-detail-container {
        padding: 0 var(--space-2);
    }
    
    .tools-main,
    .tool-detail-main {
        padding: var(--space-6) 0;
    }
    
    .tools-header {
        margin-bottom: var(--space-4);
    }
    
    .tools-title {
        font-size: var(--font-size-xl);
    }
    
    .tool-card {
        padding: var(--space-3);
    }
    
    
    .tool-detail-header {
        margin-bottom: var(--space-4);
    }
    
    .tool-detail-title {
        font-size: var(--font-size-lg);
    }
    
    .tool-content {
        height: 50vh;
        min-height: 300px;
    }
    
    .tool-content-wrapper {
        padding: var(--space-2);
    }
    
    .tool-info {
        padding: var(--space-2);
    }
}

/* ==========================================================================
   Loading States and Accessibility
   ========================================================================== */

/* Loading states */
.tool-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Focus states for accessibility */
.tool-btn:focus,
.tool-card:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Animation for tool cards - DISABLED to prevent glitch */
.tool-card {
    /* animation: fadeInUp 0.3s ease-out; */
    opacity: 1;
    transform: none;
}

/* .tool-card:nth-child(1) { animation-delay: 0.1s; }
.tool-card:nth-child(2) { animation-delay: 0.2s; }
.tool-card:nth-child(3) { animation-delay: 0.3s; }
.tool-card:nth-child(4) { animation-delay: 0.4s; }
.tool-card:nth-child(5) { animation-delay: 0.5s; }
.tool-card:nth-child(6) { animation-delay: 0.6s; } */

/* ==========================================================================
   Fullscreen Mode Enhancements
   ========================================================================== */

.tool-content.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: var(--white);
    border-radius: 0;
}

.tool-content.fullscreen #toolIframe {
    border-radius: 0;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .tool-detail-actions,
    .tool-content-wrapper {
        display: none;
    }
    
    .tool-info {
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
}
