/* Analysis Main Page - Specific Styles */

/* Enhanced styles for main analysis page only */
.analysis-section {
    background: var(--card-bg, #FFFFFF);
    border: 1px solid var(--border-color, rgba(33, 51, 100, 0.1));
    border-radius: 12px;
    box-shadow: var(--shadow-card, 0 4px 12px rgba(0, 0, 0, 0.08));
    margin-bottom: 2rem;
}

/* Header Section Styles - Matching price, buy, and staking pages */
.analysis-header {
    margin-bottom: 50px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--border-color, #e0e0e0);
    background: transparent;
    border-radius: 0;
    padding: 0 0 30px 0;
    color: inherit;
    text-align: right;
}

.analysis-title {
    font-size: 2.5em;
    font-weight: 600;
    color: var(--text-heading, #1a1a1a);
    margin-bottom: 30px !important;
    line-height: 1.3;
}

.analysis-description {
    font-size: 1.1em;
    color: var(--text-body, #4a4a4a);
    max-width: 900px;
    margin: 0 auto;
    text-align: justify;
    opacity: 1;
}

/* Responsive Styles for Header */
@media (max-width: 768px) {
    .analysis-header {
        margin-bottom: 40px;
        padding-bottom: 25px;
    }
    
    .analysis-title {
        font-size: 2.2em;
        margin-bottom: 20px;
    }
    
    .analysis-description {
        font-size: 1.1em;
        line-height: 1.8;
        text-align: right;
    }
}

@media (max-width: 480px) {
    .analysis-title {
        font-size: 1.8em;
        margin-bottom: 15px;
    }
    
    .analysis-description {
        font-size: 1em;
        line-height: 1.7;
    }
}

/* Enhanced grid for main page */
.analysis-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    padding: 1rem;
}

/* Tab content containers */
[data-tab-content] {
    display: none;
}

[data-tab-content="all"] {
    display: grid;
}

/* No analysis found message */
.no-analysis-found {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-muted, #64748b);
}

.no-analysis-found p {
    font-size: 1.1rem;
    margin: 0;
}

/* No search results message - centered in result box */
.analysis-no-results {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    padding: 3rem;
    text-align: center;
    color: var(--text-muted, #64748b);
}

.analysis-no-results > div {
    width: 100%;
}

.analysis-no-results h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-muted, #64748b);
}

.analysis-no-results p {
    font-size: 1rem;
    margin: 0;
    color: var(--text-muted, #64748b);
}

/* Enhanced cards with hover effects */
.analysis-card {
    background: var(--card-bg, #FFFFFF);
    border: 1px solid var(--border-color, rgba(33, 51, 100, 0.1));
    border-radius: 12px;
    box-shadow: var(--shadow-card, 0 4px 12px rgba(0, 0, 0, 0.08));
    padding: 1.5rem;
    transition: box-shadow 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* Performance optimizations */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0); /* Force hardware acceleration */
}

/* Animation states - only applied when JS adds classes */
.analysis-card.animate-on-scroll {
    opacity: 0;
    transform: translate3d(0, 20px, 0); /* Use translate3d for GPU acceleration */
    will-change: opacity, transform;
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.analysis-card.animate-on-scroll.animated {
    opacity: 1;
    transform: translate3d(0, 0, 0); /* Use translate3d for GPU acceleration */
    will-change: auto;
}

.analysis-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover, 0 6px 20px rgba(0, 0, 0, 0.12));
}

.analysis-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.analysis-type {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

/* تحلیل فنی - آبی */
.analysis-type.technical {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* تحلیل بنیادی - سبز */
.analysis-type.fundamental {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    border-color: #047857;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* تحلیل عمومی - خاکستری */
.analysis-type.analysis {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: #ffffff;
    border-color: #374151;
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.3);
}

/* تحلیل بازار - نارنجی */
.analysis-type.market {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    border-color: #b45309;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* Hover effects */
.analysis-card:hover .analysis-type.technical {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.analysis-card:hover .analysis-type.fundamental {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.analysis-card:hover .analysis-type.analysis {
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.4);
    transform: translateY(-1px);
}

.analysis-card:hover .analysis-type.market {
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
}

/* Dark mode styles */
[data-theme="dark"] .analysis-type.technical {
    background: linear-gradient(135deg, #1e40af, #1e3a8a);
    border-color: #1d4ed8;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.4);
}

[data-theme="dark"] .analysis-type.fundamental {
    background: linear-gradient(135deg, #047857, #065f46);
    border-color: #059669;
    box-shadow: 0 2px 8px rgba(4, 120, 87, 0.4);
}

[data-theme="dark"] .analysis-type.analysis {
    background: linear-gradient(135deg, #4b5563, #374151);
    border-color: #6b7280;
    box-shadow: 0 2px 8px rgba(75, 85, 99, 0.4);
}

[data-theme="dark"] .analysis-type.market {
    background: linear-gradient(135deg, #d97706, #b45309);
    border-color: #f59e0b;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.4);
}

/* Dark mode hover effects */
[data-theme="dark"] .analysis-card:hover .analysis-type.technical {
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.5);
}

[data-theme="dark"] .analysis-card:hover .analysis-type.fundamental {
    box-shadow: 0 4px 12px rgba(4, 120, 87, 0.5);
}

[data-theme="dark"] .analysis-card:hover .analysis-type.analysis {
    box-shadow: 0 4px 12px rgba(75, 85, 99, 0.5);
}

[data-theme="dark"] .analysis-card:hover .analysis-type.market {
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.5);
}

/* Dark mode date styling */
[data-theme="dark"] .analysis-date {
    color: var(--text-secondary-dark, rgba(255, 255, 255, 0.6));
}

.analysis-date {
    font-size: 0.8rem;
    color: var(--text-secondary, rgba(33, 51, 100, 0.6));
    direction: ltr;
    font-weight: 400;
}

.analysis-card .analysis-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #213364);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.analysis-excerpt {
    color: var(--text-secondary, rgba(33, 51, 100, 0.8));
    line-height: 1.6;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.analysis-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, rgba(33, 51, 100, 0.1));
}

.analysis-reading-time {
    background: var(--nav-bg, #f8f9fa);
    color: var(--text-body, #213364);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.analysis-reading-time svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.7;
}


.analysis-read-more {
    color: var(--accent-primary, #3D72FE);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.analysis-read-more:hover {
    color: var(--accent-secondary, #1b4fd8);
    text-decoration: none;
}

/* Enhanced filters */
.analysis-filters-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap; /* Prevent wrapping to keep in one line */
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Tabs */
.analysis-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    flex: 0 0 auto; /* Don't shrink tabs */
}

.analysis-tab {
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    background: transparent;
    border-radius: 8px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    font-family: 'IRANSansWeb', 'Tahoma', 'Arial', sans-serif;
    white-space: nowrap; /* Prevent text wrapping */
}

.analysis-tab:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.analysis-tab.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

/* Search box */
.analysis-search-box {
    position: relative;
    min-width: 200px;
    max-width: 300px;
    flex: 1 1 auto; /* Allow search box to shrink if needed */
}

/* Search input placeholder font family */
.analysis-search-input::placeholder {
    color: #94a3b8;
    font-family: 'IRANSansWeb', 'Tahoma', 'Arial', sans-serif;
}

/* Featured analysis highlight */
.analysis-card.featured {
    background: linear-gradient(135deg, #fef7cd 0%, #fef3c7 100%);
    border: 2px solid #f59e0b;
}

.analysis-card.featured .analysis-type {
    background: #f59e0b;
    color: white;
}

/* Loading animation enhancement */
.analysis-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    background: white;
    border-radius: 8px;
    margin: 2rem 0;
}

.analysis-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced pagination */
.analysis-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.pagination-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-numbers {
    display: flex;
    gap: 0.25rem;
}

.page-number {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #64748b;
}

.page-number:hover {
    background: #f8fafc;
}

.page-number.active {
    background: #3b82f6;
    color: white;
}

.page-dots {
    padding: 0.5rem 0.25rem;
    color: #94a3b8;
}


/* Animation for cards */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.analysis-card {
    animation: fadeInUp 0.6s ease forwards;
}

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

/* Enhanced search */
.analysis-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px dashed var(--accent-primary, #3b82f6);
    border-radius: 8px;
    font-size: 0.85rem;
    background: transparent;
    transition: all 0.3s ease;
    font-family: 'IRANSansWeb', 'Tahoma', 'Arial', sans-serif;
}

.analysis-search-input:focus {
    outline: none;
    background: transparent;
    border: 1px solid #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Enhanced mobile responsiveness */
@media (max-width: 1024px) {
    /* On tablet, sidebar is hidden, so we can keep 2 columns */
    .analysis-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* Allow wrapping on tablet if needed */
    .analysis-filters-container {
        flex-wrap: wrap;
    }
}

/* Desktop specific: Ensure filters stay in one line */
@media (min-width: 1025px) {
    .analysis-filters-container {
        flex-wrap: nowrap;
    }
    
    .analysis-tabs {
        flex-shrink: 0; /* Prevent tabs from shrinking */
    }
    
    .analysis-search-box {
        flex-shrink: 1; /* Allow search box to shrink if needed */
        min-width: 180px; /* Minimum width for search box */
    }
}

@media (max-width: 768px) {
    .analysis-section {
        padding: 1rem 0;
        margin-bottom: 1rem;
    }
    
    .analysis-filters-container {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1rem;
        flex-wrap: nowrap; /* Keep in column layout */
    }
    
    .analysis-tabs {
        justify-content: flex-start; /* Align tabs to start */
        flex-wrap: nowrap; /* Keep tabs in one line */
        overflow-x: auto; /* Allow horizontal scroll if needed */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        gap: 0.5rem;
        padding-bottom: 0.25rem; /* Space for scrollbar */
    }
    
    .analysis-tabs::-webkit-scrollbar {
        height: 4px;
    }
    
    .analysis-tabs::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 2px;
    }
    
    .analysis-tabs::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 2px;
    }
    
    .analysis-tabs::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }
    
    .analysis-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
        white-space: nowrap;
        flex-shrink: 0; /* Prevent tabs from shrinking */
    }
    
    .analysis-search-box {
        min-width: auto;
        max-width: 100%;
        width: 100%;
    }
    
    .analysis-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0.5rem;
    }
    
    .analysis-card {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .analysis-tabs {
        flex-wrap: nowrap; /* Keep tabs in one line even on small mobile */
        gap: 0.4rem;
        overflow-x: auto;
    }
    
    .analysis-tab {
        flex: 0 0 auto; /* Don't allow tabs to grow or shrink */
        min-width: auto;
        text-align: center;
        padding: 0.45rem 0.65rem;
        font-size: 0.7rem;
    }
    
    .pagination-btn,
    .page-number {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
}

/* Dark mode support (if theme supports it) */
@media (prefers-color-scheme: dark) {
    .analysis-section {
        background: var(--card-bg, #1a2332);
        border-color: var(--border-color, rgba(255, 255, 255, 0.1));
        box-shadow: var(--shadow-card, 0 4px 12px rgba(0, 0, 0, 0.25));
    }
    
    
    /* .analysis-grid {
    } */
    
    .analysis-card {
        background: var(--card-bg, #1a2332);
        border-color: var(--border-color, rgba(255, 255, 255, 0.1));
        box-shadow: var(--shadow-card, 0 4px 12px rgba(0, 0, 0, 0.25));
        color: var(--text-body, #FFFFFF);
    }
    
    .analysis-card:hover {
        box-shadow: var(--shadow-hover, 0 6px 20px rgba(0, 0, 0, 0.35));
    }
    
    .analysis-card .analysis-title {
        color: var(--text-primary, #FFFFFF);
    }
    
    .analysis-excerpt {
        color: var(--text-secondary, rgba(255, 255, 255, 0.85));
    }
    
    .analysis-card-header {
        border-bottom-color: var(--border-color, rgba(255, 255, 255, 0.1));
    }
    
    .analysis-card-footer {
        border-top-color: var(--border-color, rgba(255, 255, 255, 0.1));
    }
    
    .analysis-reading-time {
        background: rgba(255, 255, 255, 0.1);
        color: var(--text-body, #FFFFFF);
    }
    
    .analysis-date {
        color: var(--text-secondary, rgba(255, 255, 255, 0.85));
    }
    
    .analysis-read-more {
        color: var(--accent-primary, #3D72FE);
    }
    
    .analysis-read-more:hover {
        color: var(--accent-secondary, #1b4fd8);
    }
    
    .analysis-tab {
        background: var(--card-bg, #1a2332);
    }
    
    .analysis-search-input {
        background: var(--card-bg, #1a2332);
        color: var(--text-body, #FFFFFF);
        border: 1px dashed var(--accent-primary, #3b82f6);
    }
    
    .analysis-search-input:focus {
        background: var(--card-bg, #1a2332);
        border: 1px solid var(--accent-primary, #3b82f6);
        box-shadow: 0 0 0 3px rgba(61, 114, 254, 0.2);
    }
}

/* Dark theme support using data-theme attribute (similar to staking) */
[data-theme="dark"] .analysis-search-input {
    background: var(--card-bg, #1a2332);
    color: var(--text-body, #FFFFFF);
    border: 1px dashed var(--accent-primary, #3b82f6);
}

[data-theme="dark"] .analysis-search-input:focus {
    background: var(--card-bg, #1a2332);
    border: 1px solid var(--accent-primary, #3b82f6);
    box-shadow: 0 0 0 2px rgba(61, 114, 254, 0.2);
}

/* Dark theme for tabs */
[data-theme="dark"] .analysis-tab {
    color: #e2e8f0;
}

[data-theme="dark"] .analysis-tab:hover {
    color: #3b82f6;
}

[data-theme="dark"] .analysis-tab.active {
    color: white;
}
