/**
 * Insights Dynamic Content Styles
 * Handles loading states, errors, and dynamic blog integration
 */

/* Insights Title Section */
.insights-title-section {
    padding: 60px 0 40px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-bottom: 1px solid #eee;
}

.insights-main-title {
    text-align: center;
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--secondary-color, #2c3e50);
    margin: 0;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.insights-main-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 4px;
    background: linear-gradient(135deg, var(--primary-color, #e74c3c), #c0392b);
    border-radius: 2px;
}

.insights-main-title::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: var(--primary-color, #e74c3c);
    opacity: 0.6;
}

/* Enhanced Loading State Styles */
.insights-loading {
    text-align: center;
    padding: 80px 20px;
    color: var(--secondary-color, #2c3e50);
}

.loading-container {
    max-width: 400px;
    margin: 0 auto;
}

.insights-loading .loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color, #e74c3c);
    border-radius: 50%;
    animation: insightsSpinner 1.2s linear infinite;
    margin: 0 auto 30px;
}

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

/* Progress Bar Styles */
.loading-progress {
    margin: 30px 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color, #e74c3c), #c0392b, var(--primary-color, #e74c3c));
    background-size: 200% 100%;
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s ease-out;
    animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.loading-percentage {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color, #e74c3c);
    margin-bottom: 15px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.loading-text {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 20px 0;
    color: var(--secondary-color, #2c3e50);
}

/* Loading Steps */
.loading-steps {
    margin-top: 30px;
    text-align: left;
}

.step {
    padding: 8px 15px;
    margin: 5px 0;
    border-radius: 20px;
    background: #f8f9fa;
    border: 2px solid transparent;
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    opacity: 0.5;
}

.step.active {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.1), rgba(192, 57, 43, 0.1));
    border-color: var(--primary-color, #e74c3c);
    color: var(--secondary-color, #2c3e50);
    opacity: 1;
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.2);
}

.step.completed {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border-color: #27ae60;
    color: white;
    opacity: 1;
    transform: scale(0.98);
}

/* Cache Status Indicator */
.cache-status {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(52, 152, 219, 0.3);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.cache-status.show {
    opacity: 1;
    transform: translateY(0);
}

.cache-status.cached {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    box-shadow: 0 3px 10px rgba(39, 174, 96, 0.3);
}

/* Error State Styles */
.insights-error {
    text-align: center;
    padding: 80px 20px;
}

.insights-error .error-message {
    background: #fff;
    border-radius: 12px;
    padding: 50px 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border-left: 6px solid #e74c3c;
    max-width: 600px;
    margin: 0 auto;
}

.insights-error .error-message i {
    font-size: 4rem;
    color: #e74c3c;
    margin-bottom: 25px;
    display: block;
}

.insights-error .error-message h3 {
    color: var(--secondary-color, #2c3e50);
    margin-bottom: 15px;
    font-size: 1.5rem;
    font-weight: 600;
}

.insights-error .error-message p {
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
}

.insights-error .error-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Enhanced Button Styles for Insights */
.btn-primary {
    background-color: var(--primary-color, #e74c3c);
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.3);
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color, #e74c3c);
    padding: 14px 28px;
    border: 2px solid var(--primary-color, #e74c3c);
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background-color: var(--primary-color, #e74c3c);
    color: white;
    transform: translateY(-2px);
}

.btn-outline:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Pagination Styles */
.insights-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    margin: 60px 0 40px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 10px;
}

#insights-page-info {
    color: var(--secondary-color, #2c3e50);
    font-weight: 600;
    font-size: 1rem;
    padding: 0 20px;
}

/* Admin Actions */
.admin-actions {
    text-align: center;
    margin-top: 50px;
    padding-top: 40px;
    border-top: 2px solid #eee;
}

/* Blog Card Image Heights */
.blog-card-image {
    height: 320px; /* Increased from default 220px */
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.05);
}

/* Enhanced Blog Card Animations */
.blog-card {
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    animation: insightsFadeInUp 0.8s ease-out;
    animation-fill-mode: both;
}

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

@keyframes insightsFadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.blog-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}

/* Enhanced Blog Card Category */
.blog-card-category {
    background: linear-gradient(135deg, var(--primary-color, #e74c3c), #c0392b);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

/* Blog Card Meta Information */
.blog-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 15px 0 20px;
    padding: 12px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.blog-card-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

.blog-card-meta i {
    color: var(--primary-color, #e74c3c);
    font-size: 0.8rem;
}

/* Enhanced Read More Button */
.blog-card .read-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color, #e74c3c);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 10px 0;
    border-bottom: 2px solid transparent;
}

.blog-card .read-more:hover {
    color: #c0392b;
    border-bottom-color: #c0392b;
    transform: translateX(5px);
}

.blog-card .read-more i {
    transition: transform 0.3s ease;
    font-size: 0.9rem;
}

.blog-card:hover .read-more i {
    transform: translateX(3px);
}

/* Toast Notification Styles */
.insights-toast {
    position: fixed;
    top: 30px;
    right: 30px;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    z-index: 10000;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 400px;
    animation: insightsToastSlideIn 0.4s ease-out;
}

.insights-toast.error {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.insights-toast.warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

.insights-toast.info {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

@keyframes insightsToastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Empty State */
.insights-empty {
    text-align: center;
    padding: 100px 20px;
    color: #666;
}

.insights-empty i {
    font-size: 5rem;
    color: #ddd;
    margin-bottom: 30px;
    display: block;
}

.insights-empty h3 {
    color: var(--secondary-color, #2c3e50);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.insights-empty p {
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .insights-title-section {
        padding: 50px 0 30px;
    }
    
    .insights-main-title {
        font-size: 2.2rem;
        letter-spacing: 1px;
    }
    
    .insights-main-title::after {
        width: 100px;
        height: 3px;
        bottom: -12px;
    }
    
    .blog-card-image {
        height: 280px; /* Tablet height */
    }
    
    .insights-loading,
    .insights-error {
        padding: 60px 15px;
    }
    
    .loading-container {
        max-width: 350px;
    }
    
    .loading-percentage {
        font-size: 1.3rem;
    }
    
    .step {
        font-size: 0.85rem;
        padding: 6px 12px;
    }
    
    .insights-error .error-message {
        padding: 40px 25px;
    }
    
    .insights-error .error-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .insights-pagination {
        flex-direction: column;
        gap: 20px;
        padding: 25px 15px;
    }
    
    .admin-actions {
        margin-top: 40px;
        padding-top: 30px;
    }
    
    .insights-toast {
        top: 20px;
        right: 20px;
        left: 20px;
        max-width: none;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-outline {
        width: 100%;
        max-width: 250px;
        justify-content: center;
    }
    
    .blog-card-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .blog-card-meta span {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .insights-title-section {
        padding: 40px 0 25px;
    }
    
    .insights-main-title {
        font-size: 1.8rem;
        letter-spacing: 0.5px;
    }
    
    .insights-main-title::after {
        width: 80px;
        height: 3px;
        bottom: -10px;
    }
    
    .insights-main-title::before {
        width: 40px;
        top: -8px;
    }
    
    .blog-card-image {
        height: 240px; /* Mobile height */
    }
    
    .insights-loading .loading-spinner {
        width: 50px;
        height: 50px;
        border-width: 4px;
    }
    
    .loading-container {
        max-width: 300px;
    }
    
    .loading-percentage {
        font-size: 1.2rem;
    }
    
    .step {
        font-size: 0.8rem;
        padding: 5px 10px;
        margin: 3px 0;
    }
    
    .progress-bar {
        height: 6px;
    }
    
    .cache-status {
        top: 10px;
        right: 10px;
        font-size: 0.75rem;
        padding: 6px 12px;
    }
    
    .insights-error .error-message {
        padding: 30px 20px;
    }
    
    .insights-error .error-message i {
        font-size: 3rem;
    }
    
    .insights-error .error-message h3 {
        font-size: 1.3rem;
    }
    
    .blog-card:hover {
        transform: translateY(-8px) scale(1.01);
    }
    
    #insights-page-info {
        font-size: 0.9rem;
        padding: 0 10px;
    }
}

/* Article Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    padding: 20px;
    visibility: hidden;
}

.modal-overlay.modal-show {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    position: relative;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.modal-show .modal-content {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--primary-color, #e74c3c);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.modal-close:hover {
    background: #c0392b;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.4);
}

.modal-scroll-content {
    max-height: 90vh;
    overflow-y: auto;
    scroll-behavior: smooth;
}

#modal-img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 16px 16px 0 0;
}

#modal-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--secondary-color, #2c3e50);
    margin: 30px 30px 20px;
    line-height: 1.3;
}

#modal-body {
    padding: 0 30px 30px;
}

.modal-article-meta {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-category {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color, #e74c3c), #c0392b);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.3);
}

.modal-meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    color: #666;
    font-size: 0.95rem;
}

.modal-meta-info span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-meta-info i {
    color: var(--primary-color, #e74c3c);
    font-size: 0.9rem;
}

.modal-article-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
    margin-bottom: 30px;
}

.modal-article-content h1,
.modal-article-content h2,
.modal-article-content h3 {
    color: var(--secondary-color, #2c3e50);
    margin: 25px 0 15px;
    font-weight: 600;
}

.modal-article-content h1 {
    font-size: 1.8rem;
}

.modal-article-content h2 {
    font-size: 1.5rem;
}

.modal-article-content h3 {
    font-size: 1.3rem;
}

.modal-article-content p {
    margin-bottom: 15px;
    text-align: justify;
}

.modal-article-content ul,
.modal-article-content ol {
    margin: 15px 0;
    padding-left: 25px;
}

.modal-article-content li {
    margin-bottom: 8px;
}

.modal-article-content blockquote {
    border-left: 4px solid var(--primary-color, #e74c3c);
    padding: 15px 20px;
    margin: 20px 0;
    background: #f8f9fa;
    font-style: italic;
    border-radius: 0 8px 8px 0;
}

.modal-article-images {
    margin: 30px 0;
}

.modal-content-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 15px 0;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.modal-content-image:hover {
    transform: scale(1.02);
}

.modal-article-footer {
    padding: 25px 0;
    border-top: 2px solid #f0f0f0;
    text-align: center;
}

.modal-article-footer .btn-primary {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.modal-article-footer .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.3);
}

/* Modal Responsive Design */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 10px;
    }
    
    .modal-content {
        max-width: 100%;
        margin: 0;
        border-radius: 12px;
    }
    
    #modal-img {
        height: 250px;
        border-radius: 12px 12px 0 0;
    }
    
    #modal-title {
        font-size: 1.6rem;
        margin: 25px 20px 15px;
    }
    
    #modal-body {
        padding: 0 20px 25px;
    }
    
    .modal-close {
        top: 15px;
        right: 15px;
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    .modal-meta-info {
        flex-direction: column;
        gap: 12px;
    }
    
    .modal-article-content {
        font-size: 1rem;
        line-height: 1.7;
    }
}

@media (max-width: 480px) {
    .modal-overlay {
        padding: 5px;
    }
    
    .modal-content {
        border-radius: 8px;
    }
    
    #modal-img {
        height: 200px;
        border-radius: 8px 8px 0 0;
    }
    
    #modal-title {
        font-size: 1.4rem;
        margin: 20px 15px 12px;
    }
    
    #modal-body {
        padding: 0 15px 20px;
    }
    
    .modal-close {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .modal-category {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .modal-meta-info {
        font-size: 0.85rem;
    }
    
    .modal-article-content {
        font-size: 0.95rem;
        line-height: 1.6;
    }
    
    .modal-article-content h1 {
        font-size: 1.5rem;
    }
    
    .modal-article-content h2 {
        font-size: 1.3rem;
    }
    
    .modal-article-content h3 {
        font-size: 1.1rem;
    }
    
    .modal-article-footer .btn-primary {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}