/* Analysis Page - Base Styles */

/* Analysis Subpage Header */
.analysis-subpage-header {
    margin-bottom: 2rem;
}

.analysis-header-card {
    background: var(--card-bg, #FFFFFF);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color, #f1f5f9);
}

.analysis-header-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.analysis-subpage-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0;
}

.analysis-subpage-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    line-height: 1.3;
    flex: 1;
}

.analysis-subpage-date-wrapper {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-shrink: 0;
}

.analysis-subpage-date {
    font-size: 0.9rem;
    color: #6b7280;
    font-family: 'IRANSansWeb', 'Tahoma', 'Arial', sans-serif;
    direction: rtl;
    text-align: right;
}

/* Mobile: Date above image */
@media (max-width: 768px) {
    .analysis-subpage-title-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .analysis-subpage-date-wrapper {
        order: 2;
        margin-bottom: 1rem;
    }
    
    .analysis-content-with-image {
        order: 3;
    }
    
    .analysis-header-image {
        order: 1;
    }
}

.analysis-content-with-image {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.analysis-header-text {
    flex: 1;
    min-width: 0;
}

.analysis-header-image {
    flex-shrink: 0;
    width: 300px;
}

.analysis-subpage-description {
    font-size: 12px;
    line-height: 1.6;
    color: #6b7280;
    margin: 0;
    text-align: justify;
}

/* Image Container with Hover Effect */
.analysis-image-container {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
}

.analysis-chart-image,
.analysis-image-container picture img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.analysis-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 8px;
    pointer-events: none;
}

.analysis-image-container:hover .analysis-image-overlay {
    opacity: 1;
}

.analysis-image-container:hover .analysis-chart-image,
.analysis-image-container:hover picture img {
    filter: brightness(0.7);
}

.analysis-zoom-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    transition: all 0.3s ease;
    cursor: pointer;
    pointer-events: auto;
}

.analysis-zoom-icon:hover {
    background: white;
    transform: scale(1.1);
}

.analysis-zoom-icon svg {
    width: 24px;
    height: 24px;
}

/* Image Modal */
.analysis-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.analysis-modal-content {
    position: relative;
    padding: 20px;
    width: fit-content;
    max-width: 90%;
    height: fit-content;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.analysis-modal-img {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: modalImageZoom 0.3s ease;
    display: block;
}

@keyframes modalImageZoom {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.analysis-modal-close {
    position: absolute;
    top: 20px;
    left: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    line-height: 1;
    padding-top: 5px;
    margin: 0;
}

.analysis-modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

/* Responsive for subpage header */
@media (max-width: 768px) {
    .analysis-header-card {
        padding: 1.5rem;
    }
    
    .analysis-header-content {
        gap: 1rem;
    }
    
    .analysis-content-with-image {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .analysis-header-image {
        width: 100%;
    }
    
    .analysis-subpage-title {
        font-size: 1.3rem;
    }
    
    .analysis-subpage-date {
        font-size: 0.85rem;
    }
    
    .analysis-subpage-description {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .analysis-header-card {
        padding: 1rem;
    }
    
    .analysis-header-content {
        gap: 0.75rem;
    }
    
    .analysis-content-with-image {
        gap: 1rem;
    }
    
    .analysis-subpage-title {
        font-size: 1.2rem;
    }
    
    .analysis-subpage-date {
        font-size: 0.8rem;
    }
    
    .analysis-subpage-description {
        font-size: 12px;
        line-height: 1.5;
    }
    
    .analysis-zoom-icon {
        width: 40px;
        height: 40px;
    }
    
    .analysis-zoom-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .analysis-modal-close {
        top: 10px;
        left: 15px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }
    
    .analysis-modal-content {
        padding: 10px;
    }
}

/* Layout */
.analysis-layout {
    display: flex;
    flex-direction: row;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    align-items: flex-start;
}

.analysis-content {
    flex: 1;
    width: 100%;
    min-width: 0; /* Prevent grid overflow */
}

.analysis-sidebar {
    display: flex;
    flex-direction: column;
    flex: 0 0 350px;
    width: 350px;
    height: fit-content;
    gap: 20px;
    position: relative;
}



/* Sidebar */
.analysis-sidebar .sidebar-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 2rem;
}

.analysis-sidebar-last-widget {
    margin-top: 0;
}

/* Reset all plugin margins in sidebar for consistent spacing */
.analysis-sidebar .sidebar-content .arzpaya-trade-widget,
.analysis-sidebar .sidebar-content .arzpaya-exchange-container,
.analysis-sidebar .sidebar-content .arzpaya-app-download {
    margin: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    max-width: 100%;
}

/* Additional specificity to override plugin styles */
.analysis-sidebar .sidebar-content > .arzpaya-trade-widget,
.analysis-sidebar .sidebar-content > .arzpaya-exchange-container,
.analysis-sidebar .sidebar-content > .arzpaya-app-download {
    margin: 0 !important;
}

/* Force spacing using adjacent sibling selector as fallback */
.analysis-sidebar .sidebar-content > * + * {
    margin-top: 20px !important;
}

/* Ensure consistent styling for all sidebar widgets */
.analysis-sidebar .sidebar-content .arzpaya-trade-widget,
.analysis-sidebar .sidebar-content .arzpaya-exchange-container {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Sticky Sidebar Widget - Last Shortcode (Desktop Only) */
.analysis-sidebar .sticky-sidebar-widget {
    position: relative;
    width: 100%;
    transition: none;
}

/* Desktop: Make last widget sticky when scroll reaches its starting position */
@media (min-width: 1025px) {
    .analysis-sidebar .sticky-sidebar-widget.is-sticky {
        position: fixed;
        top: 80px;
        width: 350px; /* Match sidebar width */
        z-index: 10;
        max-width: 350px;
    }
    
    /* Reset margins for sticky widget */
    .analysis-sidebar .sticky-sidebar-widget .arzpaya-trade-widget,
    .analysis-sidebar .sticky-sidebar-widget .arzpaya-exchange-container,
    .analysis-sidebar .sticky-sidebar-widget .arzpaya-app-download {
        margin: 0 !important;
    }
}

/* Mobile Trade Widget */
.mobile-trade-widget {
    display: none;
    margin-top: 2rem;
}

/* Breadcrumb */
.mobile-breadcrumb {
    display: none;
    margin-bottom: 1rem;
}

.desktop-breadcrumb {
    margin-bottom: 2rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .analysis-layout {
        flex-direction: column;
        gap: 30px;
    }
    
    .analysis-sidebar {
        display: none; /* Hide sidebar on tablet */
    }
    
    .analysis-content {
        min-height: auto;
    }
    
    .mobile-trade-widget {
        display: block;
    }
}

@media (max-width: 768px) {
    .analysis-layout {
        padding: 0 15px;
        gap: 20px;
    }
    
    .analysis-sidebar {
        display: none; /* Hide sidebar on mobile */
    }
    
    .mobile-breadcrumb {
        display: block;
    }
    
    .desktop-breadcrumb {
        display: none;
    }
}

@media (max-width: 480px) {
    .analysis-layout {
        padding: 0 10px;
        gap: 15px;
    }
}

/* Dark theme support using data-theme attribute */
[data-theme="dark"] .analysis-header-card {
    background: var(--card-bg, #1a2332);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .analysis-subpage-title {
    color: var(--text-primary, #FFFFFF);
}

[data-theme="dark"] .analysis-subpage-date {
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}

[data-theme="dark"] .analysis-subpage-description {
    color: var(--text-secondary, rgba(255, 255, 255, 0.85));
}

