/* Modal Styles - CRITICAL: These were missing in the original code */

.modal-overlay {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    visibility: hidden;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--primary-dark);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    color: var(--primary);
}


.modal-overlay .close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    margin: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    transition: color 0.2s;
    
}


.modal-overlay .close-btn:hover {
    color: var(--text);
}

/* Custom scrollbar for modal content */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: var(--bg-dark);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Detail Modal Grid Layout */
#detailModal .modal-content {
    max-width: 1200px;
    width: 95%;
    /* display: flex; was causing issues? let's stick to default block or flow root */
    display: block;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 30px;
    width: 100%;
}

.detail-left {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.detail-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (max-width: 768px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

/* Dynamic Resizing Classes */
#detailModal .modal-content.single-col {
    max-width: 500px !important;
}

.single-col .detail-grid {
    grid-template-columns: 1fr !important;
}

.single-col .detail-right {
    display: none !important;
}

.media-actions {
    margin-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
    display: flex;
    gap: 10px;
}

/* Projects & References Styles */
.project-item {
    transition: all 0.2s ease;
}

.project-item:hover {
    border-color: var(--primary) !important;
}

.reference-item {
    transition: all 0.2s ease;
}

.reference-item:hover {
    background: var(--bg-card) !important;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}