/* News Popup Styles - Externalized for safety */
.modal-news-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    /* Ultra high z-index */
    display: flex;
    /* Changed from hidden to flex by JS, but this is base state */
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

/* State when active */
.modal-news-overlay.modal-news-active {
    opacity: 1;
    visibility: visible;
}

.modal-news-content {
    background: #111;
    width: 700px;
    height: 400px;
    max-width: 95%;
    display: flex;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-news-overlay.modal-news-active .modal-news-content {
    transform: scale(1);
}

/* Fix for nested structure in index.php */
.modal-news-body {
    display: flex;
    width: 100%;
    height: 100%;
}

.modal-news-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    color: white;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 10;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    transition: color 0.3s, transform 0.3s;
}

.modal-news-close:hover {
    color: #00d4ff;
    /* Fallback primary color */
    transform: scale(1.1);
}

.modal-news-img {
    flex: 1;
    max-width: 50%;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.modal-news-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-news-text {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    height: 100%;
    overflow-y: auto;
}

.modal-news-text h2 {
    color: #00d4ff;
    /* Fallback primary color */
    margin-bottom: 20px;
    font-size: 2rem;
    line-height: 1.2;
}

.modal-news-text div {
    color: #ccc;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

.btn-news-action {
    padding: 12px 30px;
    background: #00d4ff;
    /* Fallback primary color */
    color: #000;
    font-weight: bold;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-news-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 212, 255, 0.3);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .modal-news-overlay {
        display: none !important;
    }
    .modal-pdf-overlay {
        display: none !important;
    }
}

/* PDF Modal Styles */
.modal-pdf-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.modal-pdf-overlay.modal-pdf-active {
    opacity: 1;
    visibility: visible;
}

.modal-pdf-content {
    background: #111;
    width: 90%;
    height: 90%;
    max-width: 1000px;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-pdf-overlay.modal-pdf-active .modal-pdf-content {
    transform: scale(1);
}

.modal-pdf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-pdf-header h3 {
    margin: 0;
    color: #00d4ff;
    font-size: 1.25rem;
}

.modal-pdf-close {
    font-size: 2rem;
    color: white;
    background: transparent;
    border: none;
    cursor: pointer;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    transition: color 0.3s, transform 0.3s;
    line-height: 1;
}

.modal-pdf-close:hover {
    color: #00d4ff;
    transform: scale(1.1);
}

.modal-pdf-body {
    flex: 1;
    width: 100%;
    height: calc(100% - 60px);
    background: #222;
}

.modal-pdf-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Notes Modal Specific Styles */
.modal-notes-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.modal-notes-overlay.modal-notes-active {
    opacity: 1;
    visibility: visible;
}

.modal-notes-content {
    background: #0d0d0d;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.15);
    position: relative;
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-notes-overlay.modal-notes-active .modal-notes-content {
    transform: scale(1);
}

.modal-notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.modal-notes-header h3 {
    margin: 0;
    color: #00d4ff;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.modal-notes-close {
    font-size: 2.2rem;
    color: rgba(255, 255, 255, 0.6);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.3s, transform 0.3s;
    line-height: 0.8;
}

.modal-notes-close:hover {
    color: #ffaa00;
    transform: scale(1.1);
}

.modal-notes-body {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    background: radial-gradient(circle at top right, rgba(0, 212, 255, 0.05), transparent 60%);
}

.notes-subtitle {
    color: #aaa;
    font-size: 1rem;
    margin-bottom: 24px;
}

.notes-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 50vh;
    padding-right: 8px;
}

/* Custom Scrollbar for notes body */
.modal-notes-body::-webkit-scrollbar,
.notes-grid::-webkit-scrollbar {
    width: 6px;
}
.modal-notes-body::-webkit-scrollbar-track,
.notes-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}
.modal-notes-body::-webkit-scrollbar-thumb,
.notes-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
.modal-notes-body::-webkit-scrollbar-thumb:hover,
.notes-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.4);
}

/* Card Style for items */
.note-item-card {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    text-decoration: none !important;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.note-item-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 10% 50%, rgba(0, 212, 255, 0.08), transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.note-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: rgba(0, 212, 255, 0.08);
    border-radius: 12px;
    margin-right: 20px;
    flex-shrink: 0;
    transition: transform 0.3s ease, background-color 0.3s ease;
    border: 1px solid rgba(0, 212, 255, 0.15);
}

.note-item-details {
    flex: 1;
}

.note-item-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #ffaa00;
    background: rgba(255, 170, 0, 0.1);
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 170, 0, 0.15);
}

.note-item-title {
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 6px 0;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.note-item-desc {
    color: #888;
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.4;
}

.note-item-action {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #00d4ff;
    font-size: 0.9rem;
    font-weight: 600;
    margin-left: 20px;
    opacity: 0.8;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hover effects */
.note-item-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(0, 212, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

.note-item-card:hover .note-item-glow {
    opacity: 1;
}

.note-item-card:hover .note-item-icon {
    transform: scale(1.05);
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.4);
}

.note-item-card:hover .note-item-title {
    color: #00d4ff;
}

.note-item-card:hover .note-item-action {
    opacity: 1;
    transform: translateX(4px);
}

/* RESPONSIVE FOR NOTES SELECTION MODAL */
@media (max-width: 768px) {
    .modal-notes-content {
        width: 95%;
        max-height: 90vh;
        border-radius: 16px;
    }
    
    .modal-notes-header {
        padding: 16px 20px;
    }
    
    .modal-notes-header h3 {
        font-size: 1.25rem;
    }
    
    .modal-notes-body {
        padding: 20px;
    }
    
    .notes-subtitle {
        font-size: 0.9rem;
        margin-bottom: 16px;
    }
    
    .note-item-card {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .note-item-icon {
        width: 48px;
        height: 48px;
        margin-right: 0;
    }
    
    .note-item-action {
        margin-left: 0;
        align-self: flex-end;
    }
}