/* ===================================================
   NEWS MODAL STYLES
   =================================================== */

.news-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-modal, 1000);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: var(--space-lg, 1rem);
    padding-top: 120px;
    box-sizing: border-box;
}

.news-modal.show {
    opacity: 1;
    visibility: visible;
}

.news-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
}

.news-modal-container {
    position: relative;
    background: var(--bg-primary, #0a0d14);
    border-radius: var(--radius-xl, 1rem);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color, #374151);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.news-modal.show .news-modal-container {
    transform: scale(1) translateY(0);
}

/* Type-specific styling for container */
.news-modal-container.news-type-news {
    border-left: 4px solid #007acc;
}

.news-modal-container.news-type-maintenance {
    border-left: 4px solid #ffc107;
}

.news-modal-container.news-type-critical {
    border-left: 4px solid #dc3545;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 20px rgba(220, 53, 69, 0.2);
}

.news-modal-container.news-type-info {
    border-left: 4px solid #17a2b8;
}

/* Header */
.news-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: var(--space-xl, 1.5rem);
    border-bottom: 1px solid var(--border-color, #374151);
    background: var(--gradient-glass, linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%));
    backdrop-filter: blur(var(--blur-amount, 12px));
    position: relative;
    flex-shrink: 0;
}

.news-modal-title-section {
    display: flex;
    align-items: flex-start;
    gap: var(--space-lg, 1rem);
    flex: 1;
    min-width: 0;
    padding-right: 60px;
}

.news-modal-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--gradient-glass, linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%));
    border-radius: var(--radius-lg, 0.75rem);
    border: 1px solid var(--border-color, #374151);
}

#news-modal-type-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

#news-modal-type-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: block;
    margin: auto;
}

.news-modal-title-content {
    flex: 1;
    min-width: 0;
}

.news-modal-title-content h1 {
    margin: 0 0 var(--space-sm, 0.5rem) 0;
    font-size: var(--font-xl, 1.25rem);
    font-weight: 700;
    color: var(--text-primary, #ffffff);
    line-height: 1.3;
    font-family: var(--font-display, 'Space Grotesk');
    word-wrap: break-word;
}

.news-modal-meta {
    display: flex;
    align-items: center;
    gap: var(--space-md, 0.75rem);
    flex-wrap: wrap;
}

.news-type-badge {
    padding: var(--space-xs, 0.25rem) var(--space-sm, 0.5rem);
    border-radius: var(--radius-md, 0.5rem);
    font-size: var(--font-xs, 0.75rem);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.news-type-badge.news-type-news {
    background: rgba(0, 122, 204, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(0, 122, 204, 0.3);
}

.news-type-badge.news-type-maintenance {
    background: rgba(255, 193, 7, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.news-type-badge.news-type-critical {
    background: rgba(220, 53, 69, 0.2);
    color: #f87171;
    border: 1px solid rgba(220, 53, 69, 0.3);
    animation: criticalPulse 2s infinite;
}

.news-type-badge.news-type-info {
    background: rgba(23, 162, 184, 0.2);
    color: #22d3ee;
    border: 1px solid rgba(23, 162, 184, 0.3);
}

@keyframes criticalPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.news-date {
    font-size: var(--font-sm, 0.875rem);
    color: var(--text-secondary, #9d9da1);
    font-weight: 500;
}

.news-modal-actions {
    position: absolute;
    top: var(--space-xl, 1.5rem);
    right: var(--space-xl, 1.5rem);
    display: flex;
    gap: 0;
    flex-shrink: 0;
}

.news-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary, #9d9da1);
    cursor: pointer;
    padding: var(--space-sm, 0.5rem);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.news-close-btn:hover {
    background: var(--gradient-danger, linear-gradient(135deg, #ef4444 0%, #dc2626 100%));
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Body */
.news-modal-body {
    flex: 1;
    padding: var(--space-xl, 1.5rem);
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.news-description {
    color: var(--text-secondary, #9d9da1);
    line-height: 1.7;
    font-size: var(--font-base, 1rem);
}

.news-description h1,
.news-description h2,
.news-description h3,
.news-description h4,
.news-description h5,
.news-description h6 {
    color: var(--text-primary, #ffffff);
    margin: var(--space-lg, 1rem) 0 var(--space-md, 0.75rem) 0;
    font-family: var(--font-display, 'Space Grotesk');
}

.news-description h1 {
    font-size: var(--font-2xl, 1.5rem);
}

.news-description h2 {
    font-size: var(--font-xl, 1.25rem);
}

.news-description h3 {
    font-size: var(--font-lg, 1.125rem);
}

.news-description p {
    margin-bottom: var(--space-md, 0.75rem);
}

.news-description p:last-child {
    margin-bottom: 0;
}

.news-description ul,
.news-description ol {
    margin: var(--space-md, 0.75rem) 0;
    padding-left: var(--space-xl, 1.5rem);
}

.news-description li {
    margin-bottom: var(--space-xs, 0.25rem);
}

.news-description blockquote {
    border-left: 4px solid var(--accent-primary, #60a5fa);
    padding-left: var(--space-lg, 1rem);
    margin: var(--space-lg, 1rem) 0;
    font-style: italic;
    background: rgba(96, 165, 250, 0.05);
    padding: var(--space-md, 0.75rem) var(--space-lg, 1rem);
    border-radius: 0 var(--radius-md, 0.5rem) var(--radius-md, 0.5rem) 0;
}

.news-description code {
    background: var(--bg-tertiary, #1e252e);
    padding: var(--space-xs, 0.25rem) var(--space-sm, 0.5rem);
    border-radius: var(--radius-sm, 0.375rem);
    font-family: var(--font-mono, 'Monaco');
    font-size: 0.9em;
    color: var(--accent-secondary, #f59e0b);
}

.news-description pre {
    background: var(--bg-tertiary, #1e252e);
    padding: var(--space-lg, 1rem);
    border-radius: var(--radius-md, 0.5rem);
    overflow-x: auto;
    margin: var(--space-lg, 1rem) 0;
    border: 1px solid var(--border-color, #374151);
}

.news-description pre code {
    background: none;
    padding: 0;
    color: var(--text-primary, #ffffff);
}

.news-description a {
    color: var(--accent-primary, #60a5fa);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all var(--transition-normal, 0.3s ease-out);
}

.news-description a:hover {
    border-bottom-color: var(--accent-primary, #60a5fa);
    color: white;
}

/* Footer */
.news-modal-footer {
    padding: var(--space-md, 0.75rem) var(--space-xl, 1.5rem);
    border-top: 1px solid var(--border-color, #374151);
    background: var(--bg-secondary, #141920);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm, 0.5rem);
    flex-shrink: 0;
}

.news-modal-footer-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-sm, 0.5rem);
    margin-bottom: var(--space-xs, 0.25rem);
}

.news-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs, 0.25rem);
    padding: var(--space-xs, 0.25rem) var(--space-sm, 0.5rem);
    background: rgba(0, 122, 204, 0.1);
    border: 2px solid rgba(0, 122, 204, 0.2);
    border-radius: var(--radius-sm, 0.375rem);
    color: var(--accent-primary, #60a5fa);
    font-size: var(--font-xs, 0.75rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap;
    min-height: 32px;
    height: 32px;
    line-height: 1;
    box-sizing: border-box;
}

.news-action-btn:hover {
    background: rgba(0, 122, 204, 0.2);
    border-color: rgba(0, 122, 204, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 122, 204, 0.3);
    color: white;
}

.news-external-link {
    margin: 0;
    padding: 0;
    border: none;
    text-align: left;
    flex-shrink: 0;
}

.news-modal-info {
    display: flex;
    justify-content: center;
    gap: var(--space-lg, 1rem);
    flex-wrap: wrap;
    margin: 0;
}

.news-info-item {
    font-size: var(--font-xs, 0.75rem);
    color: var(--text-tertiary, #6b7280);
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
}

.news-info-item strong {
    color: var(--text-secondary, #9d9da1);
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .news-modal {
        padding: 0.75rem;
        align-items: flex-start;
        /*padding-top: 80px;*/
        /*padding-bottom: 1rem;*/
        padding-left: max(0.75rem, env(safe-area-inset-left, 0.75rem));
        padding-right: max(0.75rem, env(safe-area-inset-right, 0.75rem));
        padding-top: max(80px, calc(80px + env(safe-area-inset-top, 0px)));
        padding-bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
    }

    .news-modal-container {
        max-height: calc(100vh - 100px);
        width: 100%;
        margin: 0;
    }

    .news-modal-body {
        padding: var(--space-lg, 1rem);
        max-height: calc(100vh - 280px);
    }

    .news-modal-header {
        padding: var(--space-lg, 1rem);
    }

    .news-modal-title-section {
        flex-direction: column;
        gap: var(--space-md, 0.75rem);
        text-align: left;
        padding-right: 50px;
    }

    .news-modal-title-content h1 {
        font-size: var(--font-lg, 1.125rem);
        line-height: 1.3;
        margin: 0 0 var(--space-xs, 0.25rem) 0;
        text-align: left;
    }

    .news-modal-meta {
        gap: var(--space-sm, 0.5rem);
    }

    .news-modal-actions {
        top: var(--space-lg, 1rem);
        right: var(--space-lg, 1rem);
    }

    .news-close-btn {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }

    .news-modal-footer {
        padding: var(--space-sm, 0.5rem) var(--space-lg, 1rem);
        gap: var(--space-xs, 0.25rem);
    }

    .news-modal-footer-actions {
        gap: var(--space-xs, 0.25rem);
        margin-bottom: var(--space-xs, 0.25rem);
    }

    .news-action-btn {
        flex: 1;
        max-width: 120px;
        min-height: 36px;
        height: 36px;
        font-size: var(--font-xs, 0.75rem);
        padding: var(--space-xs, 0.25rem) var(--space-sm, 0.5rem);
        margin: 0;
        vertical-align: top;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .news-modal-info {
        justify-content: center;
        gap: var(--space-md, 0.75rem);
    }

    .news-info-item {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .news-modal {
        padding: 0.5rem;
        padding-top: 70px;
    }

    .news-modal-container {
        max-height: calc(100vh - 80px);
        border-radius: var(--radius-md, 8px);
    }

    .news-modal-body {
        padding: var(--space-md, 0.75rem);
        max-height: calc(100vh - 240px);
    }

    .news-modal-header {
        padding: var(--space-md, 0.75rem);
    }

    .news-modal-title-section {
        padding-right: 45px;
    }

    .news-modal-title-content h1 {
        font-size: var(--font-base, 1rem);
    }

    .news-modal-actions {
        top: var(--space-md, 0.75rem);
        right: var(--space-md, 0.75rem);
    }

    .news-close-btn {
        width: 32px;
        height: 32px;
        font-size: 1.125rem;
    }

    .news-modal-footer {
        padding: var(--space-xs, 0.25rem) var(--space-md, 0.75rem);
    }

    .news-action-btn {
        min-height: 32px;
        height: 32px;
        font-size: 0.7rem;
        max-width: 100px;
        margin: 0;
        vertical-align: top;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .news-description {
        font-size: var(--font-sm, 0.875rem);
    }

    .news-info-item {
        font-size: 0.65rem;
    }

    .news-modal-info {
        gap: var(--space-sm, 0.5rem);
    }
}

/* Landscape orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .news-modal {
        padding-top: 60px;
    }

    .news-modal-container {
        max-height: calc(100vh - 80px);
    }

    .news-modal-body {
        max-height: calc(100vh - 220px);
    }

    .news-modal-footer {
        padding: var(--space-xs, 0.25rem) var(--space-lg, 1rem);
    }

    .news-modal-footer-actions {
        margin-bottom: 0;
    }
}

/* Scrollbar styling for modal body */
.news-modal-body::-webkit-scrollbar {
    width: 6px;
}

.news-modal-body::-webkit-scrollbar-track {
    background: var(--bg-tertiary, #1e252e);
    border-radius: var(--radius-sm, 0.375rem);
}

.news-modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color, #374151);
    border-radius: var(--radius-sm, 0.375rem);
}

.news-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary, #60a5fa);
}

/* Focus states for accessibility */
.news-action-btn:focus,
.news-close-btn:focus {
    outline: 2px solid var(--accent-primary, #60a5fa);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .news-modal,
    .news-modal-container,
    .news-action-btn,
    .news-close-btn {
        transition: none !important;
    }

    .news-type-badge.news-type-critical {
        animation: none !important;
    }
}

/* Light theme adjustments */
[data-theme="light"] .news-modal-container {
    background: var(--bg-primary, #ffffff);
    color: var(--text-primary, #0f172a);
}

[data-theme="light"] .news-modal-backdrop {
    background: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] .news-description h1,
[data-theme="light"] .news-description h2,
[data-theme="light"] .news-description h3,
[data-theme="light"] .news-description h4,
[data-theme="light"] .news-description h5,
[data-theme="light"] .news-description h6 {
    color: var(--text-primary, #0f172a);
}

[data-theme="light"] .news-description code {
    background: var(--bg-tertiary, #f1f5f9);
    color: var(--accent-secondary, #d97706);
}

[data-theme="light"] .news-description pre {
    background: var(--bg-tertiary, #f1f5f9);
    border-color: var(--border-color, #e2e8f0);
}

[data-theme="light"] .news-description pre code {
    color: var(--text-primary, #0f172a);
}